How to get the actual state value from API call /api/states/<entity_id>

Hi,

I’m quite a noob and have a simple question (at least I hope so). So far I´ve integrated my EV in Home Assistant and exposed the SoC as a sensor. I want to send this value to my openWB wallbox over thier HTTP SoC Module. The input should be a URL.

I´ve managed to get a long lived token in HA and made curl with this:

curl -X GET -H "Authorization: Bearer TOKEN" -H "Content-Type: application/json" http://HA:IP:8123/api/states/sensor.cupra_born_state_of_charge

which led to this respond:

since the url that you are supposed to enter in the openWB should only have the actual state value, in this case 38, now my question: How do I have to modify the API query to get only the state, i.e. the numerical value, as the respond?

Thank you very much for your help

Look at the command_line integration, there you can use a template to get the data from the value_json (i.e. the response)…many posts in this forum
And please do not post pictures of data/code…is not easy to copy.paste :slight_smile:

1 Like

You could also use a REST command to send the data to the wallbox

Any specific reason you want to do this out of HA?

1 Like

Thank you for your reply. If I understand this right, with a rest command, I would have to address the API of the wallbox with the corresponding topic via home assistant?
I originally thought there was a simple variant, similar to the simple API command in IO-Broker. Perhaps a solution via MQTT would be more suitable.
The reason why I want to use Home Assistant for this is that I have my EV fully integrated there and the wallbox unfortunately does not offer a native query for the SoC of my car.