Hi,
I this YAML running, it reads my PV power meter. it works fine, except that my power meter sometimes report a negative number.
sensors:
smartmeter_import:
device_class: power
unit_of_measurement: 'kWh'
value_template: '{{ states.sensor.smartmeter.attributes["CounterReadingImport"]|float }}'
is there a way to ignore a value that less that last good reading ?
123
(Taras)
2
Perhaps something like this:
sensors:
smartmeter_import:
device_class: power
unit_of_measurement: 'kWh'
value_template: >
{% set cr = state_attr('sensor.smartmeter', 'CounterReadingImport') | float %}
{{ cr if cr > 0 else states('sensor.smartmeter_import') }}
Thanks, I’ll try it out… unfurtally it can take 8-16 hours before it misbehaves…
tjntomas
(Tomas Jansson)
4
If you don’t like to wait, you can set a negative value for the attribute manually in the developer tools state page.
1 Like
123
(Taras)
5
If you wish, you can force the attribute to be a negative value (or any value you want).
- Go to Developer Tools > States.
- In the Entity field, select
sensor.smartmeter
- In State Attributes, locate
CounterReadingImport
and change its value.
- Click the SET STATE button.
EDIT
Ninja’d by tjntomas!
2 Likes
What a fantastic service for a noob like me…
Thanks a lot for the help, it seams to be working… (now real lift testing is needed)
But thanks for the TIP on how to “test”…
123
(Taras)
7
So it’s a day later. Is it working properly?
Hi,
Yet, it working perfectly, had to make a small change, had to replace the “0” with a higher number, but it’s a perfect solution for me…
THANKS!
1 Like