Hei,
I have come here for help, I have set up a modbus based integration of my komfovent recuperator, the modbus integration produced a number of sensors, one of them is called : sensor.komfovent_mode_num
which reports a numeric value based on recuperator mode used. I have a way to change these statuses, however I need to read their individual states to setup my lovelace card properly and have statuses to follow on/off logic, I need to have individual states of these modes. modes are:
sensor value / mode
1 / Away
2 / Normal
3 / Intensive
4 / Boost
5 / Fireplace
Any help would be greatly appreaceated, as I am a novice in templaes, I was thinking about using automation, but template seems to make more sense here.
If I understand your description, a binary sensor for each mode, then you would do it like:
template:
- binary_sensor:
- name: Komfovent mode Away
state: "{{ states('sensor.komfovent_mode_num') == '1' }}"
availability: "{{ has_value( 'sensor.komfovent_mode_num' ) }}"
- name: Komfovent mode Normal
state: "{{ states('sensor.komfovent_mode_num') == '2' }}"
availability: "{{ has_value( 'sensor.komfovent_mode_num' ) }}"
...
If you wanted a sensor to display the current mode it would be:
template:
- binary_sensor:
- name: Komfovent mode Away
state: |
{% set modes = { "1": "Away", "2":"Normal",
"3": "Intensive", "4": "Boost", "5": "Fireplace" } %}
{{ modes.get(states('sensor.komfovent_mode_num')) }}
availability: "{{ has_value( 'sensor.komfovent_mode_num' ) }}"
1 Like
Thank you, I have used your solution