Extracting current battery voltage

Is it possible to somehow extract current battery voltage (preferably from AutoPi itself, not OBD2) and use it in “Custom code”? It is being reported to Cloud, but i wanted to use it locally.

You can do that with Custom Code, but it’s easier to call Cloud API directly. Battery voltage is one of the basic metrics available out of the box.

Hey. I will explore the cloud API. This being said, im looking at https://api.autopi.io/ but dont see a REST command to get battery voltage

For Cloud API, it’s easier to just Inspect what AutoPi website is doing, rather than trying to look at their documentation.

Battery voltage field is: obd.bat.voltage

And a few other basic fields that I’m using.
obd.fuel_level.value
obd.speed.value
obd.rpm.value
rpi.temp.cpu.value

Hello,
In order to to get the current battery voltage you will have to make an API call to the API service, and get that data from there,as the data is not stored on the device.
You can use the /logbook/recent_status endpoint to get that information: https://api.autopi.io/#/logbook/logbook_recent_stats_list

Another option is to fetch the current voltage level for a device. You can use the power.status command for that. In a custom code module you’ll have to invoke the command like this:

__salt__["power.status"]()

Regards,
Alexandru