I have an Inverter that is exposed on my network via:
> http://[redacted]/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System
Through a web browser this yields:
{
"Body" : {
"Data" : {
"DAY_ENERGY" : {
"Unit" : "Wh",
"Values" : {
"1" : 17000
}
},
"PAC" : {
"Unit" : "W",
"Values" : {
"1" : 3635
}
},
"TOTAL_ENERGY" : {
"Unit" : "Wh",
"Values" : {
"1" : 16092000
}
},
"YEAR_ENERGY" : {
"Unit" : "Wh",
"Values" : {
"1" : 3692000
}
}
}
},
"Head" : {
"RequestArguments" : {
"Scope" : "System"
},
"Status" : {
"Code" : 0,
"Reason" : "",
"UserMessage" : ""
},
"Timestamp" : "2017-09-06T12:46:07+10:00"
}
}
I am trying to get this value:
"PAC" : {
"Unit" : "W",
"Values" : {
"1" : 3635
Which is the Inverters current power output.
I have been trying with the rest sensor configured like this in my configuration.yaml:
# Rest
- platform: rest
name: Inverter
resource: http://[redacted]/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System
method: GET
payload: '{{ value_json["Body"]["Data"]["PAC"]["Values"]["1"] }}'
I thought that this would work, but when run I get this error:
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>400 - Bad Request</title> </head> <body> <h1>400 - Bad Request</h1> </body> </html>
Should I be using a different sensor to query the Inverter?
Any other ideas?
Regards