Hi Everyone,
I’ve got the following YAML in my sensor file:
- platform: rest
name: "Daily Water Draw"
resource: 'https://summary.ekmmetering.com/summary?key=1234565&meters=132456&format=json&report=dy&limit=1&offset=0&timezone=America~Chicago&fields=Pulse_Cnt_1*'
method: GET
unit_of_measurement: "pulses"
value_template: '{{ value_json.Pulse_Cnt_1_Diff | int }}'
scan_interval: 900
The idea is it’s supposed to return the value 63, from this JSON output:
[
{
"Start_Time_Stamp_UTC_ms": 1646460031227,
"End_Time_Stamp_UTC_ms": 1646526571221,
"End_Date": "Sat Mar 05 2022 18:29:31 GMT-0600 (GMT)",
"Start_Date": "Sat Mar 05 2022 00:00:31 GMT-0600 (GMT)",
"Meter": 350002412,
"Protocol": "v4",
"Count": 1137,
"rejected_bad": 0,
"rejected_duplicates": 0,
"Pulse_Cnt_1_Last": 285975,
"Pulse_Cnt_1_Average": 285935.65,
"Pulse_Cnt_1_StdDev": 1.02,
"Pulse_Cnt_1_DeltaMin": 0,
"Pulse_Cnt_1_DeltaMax": 3,
"Pulse_Cnt_1_Min": 285912,
"Pulse_Cnt_1_Max": 285975,
"Pulse_Cnt_1_Diff": 63
}
]
Regrettably, the sensor in HA is giving me State " unknown" error. I was able to use “value_json.Pulse_Cnt_1_Diff” in the Developer Tools to return 63.
My JSON is very bad, Im assuming the error is in my varaible reference. Any thoughts or kind helping hands out there?