I am using the modbus component for getting values from my heatpump. This works, but makes getting values like the heatRequest
not easy to fetch: on the ModBus the value for “on” is 8, and for Off is 5 - which is weird, but it is like it is.
I did the conversion to a binary by using a custom template binary sensor:
binary_sensor:
- platform: template
sensors:
heatcircuit0_heatrequest:
value_template: >
{% if states('sensor.heatcircuit0_heatrequest_raw') == '5' %}
false
{% elif states('sensor.heatcircuit0_heatrequest_raw') == '8' %}
true
{% else %}
false
{% endif %}
This is already described e.g. here:
But it could be made easier if the modbus binary_sensors component would add config values like
binary_sensors:
- name: my_sensor
address: 24
value_true: 8 # or value_on
value_false: 5 # or value_off