Hi. I have a problem with the following template. Basically what it should do is updating input_select when a value of particular MQTT topic changes and updating the MQTT topic when input_select value is changed in HA. Unfortunately none of this seems to work - it just keeps both MQTT topic and input select on “Automatic”
Manually submitting the value to MQTT topic works fine.
- alias: Set Central Heating Operation Mode
initial_state: on
trigger:
- platform: state
entity_id: input_select.central_heating_operation_mode
action:
service: mqtt.publish
data_template:
topic: "ebusd/f47/Hc1OPMode/set"
payload: >
{% if is_state('input_select.central_heating_operation_mode','Automatic') %}
auto
{% elif is_state('input_select.central_heating_operation_mode','Night') %}
night
{% elif is_state('input_select.central_heating_operation_mode','Comfort') %}
comfort
{% elif is_state('input_select.central_heating_operation_mode','Summer') %}
summer
{% endif %}
- alias: Get Central Heating Operation Mode
initial_state: on
trigger:
- platform: mqtt
topic: "ebusd/f47/Hc1OPMode"
action:
service: input_select.select_option
data_template:
entity_id: input_select.central_heating_operation_mode
option: >
{% set opmode = {
'auto': 'Automatic',
'night': 'Night',
'comfort': 'Comfort',
'summer': 'Summer' } %}
{{ opmode.get('trigger.payload','Automatic') }}