aristosv
(Aristos)
September 22, 2020, 6:11pm
1
I am using this to pull the power consumption from Shelly EM.
- platform: rest
name: Sensor Load
resource: http://192.168.1.53/status
username: 'user'
password: 'pass'
authentication: basic
value_template: '{{ value_json.emeters.0.power }}'
scan_interval: 5
unit_of_measurement: KW
My problem is that the number is shown in Watts instead of Kilowatts.
How can I make it shown in Kilowatts?
Thanks
123
(Taras)
September 22, 2020, 6:15pm
2
Assuming power
is not a string value:
value_template: '{{ value_json.emeters.0.power / 1000 }}'
Or this if want to limit the number of decimal places:
value_template: '{{ (value_json.emeters.0.power / 1000) | round(2) }}'
If power
is a string value then you should use thefloat
filter to convert it before performing the division.
aristosv
(Aristos)
September 22, 2020, 6:20pm
3
Thank you.
Is there also a way to remove all those numbers to the right?
Maybe only keep 2.74?
123
(Taras)
September 22, 2020, 6:22pm
4
Use the round
filter as shown in my second example.
aristosv
(Aristos)
September 22, 2020, 6:24pm
5
that was very helpful, thank you very much.
123
(Taras)
September 22, 2020, 6:44pm
6
You’re welcome!
For the benefit of other users, please consider marking my first post with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has an accepted solution. This can help users find answers to similar questions.
1 Like