I have a shell_command that sends a curl command to my solar provider and has the following response:
{
"updateRefreshRate": 3,
"unit": "kW",
"connections": [
{
"from": "PV",
"to": "Load"
},
{
"from": "Load",
"to": "Grid"
}
],
"grid": {
"status": "Active",
"currentPower": 0.16
},
"load": {
"status": "Active",
"currentPower": 4.04
},
"pv": {
"status": "Active",
"currentPower": 4.2
},
"storage": null,
"evCharger": null,
"loadType": "Residential"
}
This shell command output can be saved in a response_variable called “json_value”.
I can create two sensor templates but I want to update the template state value with the shell_command response.
e.g.
sensor.grid_power = json_value.grid.currentPower
sensor.pv_power = json_value.pv.currentPower
How can I create a sensor that can update itself with the output of the shell_command?
Ideally I would like to use the homeassistant.update_entity service to update these values as required in an automation or script.