Okay, so here’s my challenge:
I have in my home a MVHR (Mechanical Ventilation with Heat Recovery System) system that has 3 speed settings: low, medium and high. The speeds on the device itself are controlled by a 2 channel WiFi relay I installed.
When channel 1 is off the speed is ‘Low’
When channel 1 is on and channel 2 is off the speed is ‘Medium’
and when both channels are on the speed is ‘High’
Now, I would like to do 2 things in HA:
- To display a single drop down in the UI that lets me select the speed (low, medium, high), and also updates automatically when the relay switches are toggled from somewhere else
- To automate setting the speed based on some triggers (button pressed, humidity sensor, etc.)
I achieved the first by using the rather obscure ‘select’ template as follows in my configuration.yaml
:
template:
- select:
- name: "WtW Ventilatie Stand"
unique_id: wtw_ventilatie_stand
icon: mdi:fan
state: >
{%
set map = {
is_state('switch.relais_wtw_zolder1','off'): 'Laag',
is_state('switch.relais_wtw_zolder1','on') and is_state('switch.relais_wtw_zolder2','off'): 'Middel',
is_state('switch.relais_wtw_zolder1','on') and is_state('switch.relais_wtw_zolder2','on'): 'Hoog',
} %}
{{ map.get(True) }}
select_option:
- choose:
- conditions: "{{ option == 'Laag' }}"
sequence:
- service: switch.turn_off
target:
entity_id:
- switch.relais_wtw_zolder1
- switch.relais_wtw_zolder2
- conditions: "{{ option == 'Middel' }}"
sequence:
- service: switch.turn_on
target:
entity_id: switch.relais_wtw_zolder1
- service: switch.turn_off
target:
entity_id: switch.relais_wtw_zolder2
- conditions: "{{ option == 'Hoog' }}"
sequence:
- service: switch.turn_on
target:
entity_id:
- switch.relais_wtw_zolder1
- switch.relais_wtw_zolder2
options: "{{ ['Laag', 'Middel', 'Hoog'] }}"
(note: the speeds are in Dutch; ‘Laag’ means low, ‘Middel’ means medium and ‘Hoog’ means high)
I’m not entirely sure this the right approach; I can get the drop down in the UI using the following card yaml:
type: entities
entities:
- entity: select.wtw_ventilatie_stand
title: Ventilatiestand
And it works exacly like I would expect.
But I’m at a loss on how to use it in an automation; that would require a method to set the state of my select.wtw_ventilatie_stand
entity from that automation, and I can’t find any way to do that.
So, am I doing this wrong? Any tips would be greatly appreciated.