pabelo76
(Paweł Łucak)
October 28, 2022, 6:37pm
1
Hello
How to exclude reading zero value at Modbus in configuration.yaml (energy reading from meter sometimes gives zero value, which disturbs energy panel values). From what I found out HA has problems with the Modbus standard.
modbus:
- name: "iSMA"
type: tcp
host: 192.168.3.123
port: 502
sensors:
- name: "iSMA Energia pobrana"
device_class: energy
unit_of_measurement: kWh
slave: 1
address: 1020
input_type: holding
count: 2
swap: word
data_type: float32
precision: 2
scan_interval: 60
- name: "iSMA Energia oddana"
device_class: energy
unit_of_measurement: kWh
slave: 1
address: 1022
input_type: holding
count: 2
swap: word
data_type: float32
precision: 2
scan_interval: 60
nikito7
(nikito7)
October 28, 2022, 10:04pm
2
Use templates or filters after modbus sensors
pabelo76
(Paweł Łucak)
October 29, 2022, 9:15am
3
I have it, but how do I make it to attach for value zero the previous reading? With this condition I have at zero the value of the entity undefined
template:
- sensor:
- name: "Energia pobrana"
device_class: energy
unit_of_measurement: kWh
state: >
{% if states('sensor.isma_energia_pobrana') | float > 0 %} {{ states('sensor.isma_energia_pobrana') | float }}
{%- endif %}
- name: "Energia oddana"
device_class: energy
unit_of_measurement: kWh
state: >
{% if states('sensor.isma_energia_oddana') | float > 0 %} {{ states('sensor.isma_energia_oddana') | float }}
{%- endif %}
nikito7
(nikito7)
October 31, 2022, 9:47pm
4
- name: "new sensor"
state: >-
{% set x = states('sensor.modbus')|float(0) %}
{% if x > 0 %}
{{ x }}
{% else %}
{{ states('sensor.new_sensor') }}
{% endif %}
pabelo76
(Paweł Łucak)
May 7, 2023, 9:55am
5
Thank you for the hint.
And how to make that a change of ±10 value is rejected