Klagio
(Klagio)
1
Hi I have this REST data
“emeters”:[{“power”:811.25,“reactive”:-507.50,“voltage”:227.16,“is_valid”:true,“total”:2264.8,“total_returned”:0.0},
using this REST sensor I able to get the ENERGY value but its in Wh, I need KWh.
Please help in how to change the template
- platform: rest
resource: http://192.168.1.150/status
name: Potenza Generale Consumata
value_template: '{{ value_json.emeters[0]["total"] }}'
scan_interval: 10
unit_of_measurement: "KWh"
tjntomas
(Tomas Jansson)
2
There might be other solutions but try:
value_template: '{{ value_json.emeters[0]["total"] | multiply(0.001) | float }}'
Klagio
(Klagio)
3
Hi, thanks!!
I did this, is it wrong?
value_template: '{{ value_json.emeters[0]["total"] / 1000 }}'
tjntomas
(Tomas Jansson)
4
Not sure about the ["total"]
and I have trouble with the “/” so I use multiply instead. I think it should be
value_template: '{{ value_json.emeters[0].total | multiply(0.001) | float }}'
But use whatever that works!
EDIT: both .total
and ["total"]
works.
Mutt
(Muttley)
5
Just a pedantic point but the units of measurement should be “kWh” as upper case “K” is Kelvin, lower case “k” is kilo