i have setup a rest sensor for my Solar panels , refer below … when the panels are producing no power ( ie at night) , the rest call produces a null but i can not get the template to determine if the value is null , it always tries to evaluate the value and returns a 2 !!!
i’m after the P_PV value, works when daylight !!
JSON
{
“Body” : {
“Data” : {
“Inverters” : {
“1” : {
“DT” : 76,
“E_Day” : 31861,
“E_Total” : 8564700,
“E_Year” : 7369462.5,
“P” : 0
}
},
“Site” : {
“E_Day” : 31861,
“E_Total” : 8564700,
“E_Year” : 7369462.5,
“Meter_Location” : “grid”,
“Mode” : “meter”,
“P_Akku” : null,
“P_Grid” : 489.16998906619847,
“P_Load” : -489.16998906619847,
“P_PV” : null,
“rel_Autonomy” : 0,
“rel_SelfConsumption” : null
},
“Version” : “10”
}
},
“Head” : {
“RequestArguments” : {},
“Status” : {
“Code” : 0,
“Reason” : “”,
“UserMessage” : “”
},
“Timestamp” : “2018-10-07T23:19:09+08:00”
Sensor definition
platform: rest
resource: http://10.0.0.200/solar_api/v1/GetPowerFlowRealtimeData.fcgi
name: “PV”
value_template: >-
{% if value_json.Body.Data.Site.P_PV != null %} {{value_json.Body.Data.Site.P_PV | multiply(0.001) | float(2) | round (2) }}
{% else %} 0
{% endif %}
unit_of_measurement: kWh
any ideas ?
thanks LEEB