Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106341

Another issue with sync between input_select and MQTT

$
0
0

Hi. I’ve managed to partially fix my sync between input_select and MQTT.

  - alias: Set Central Heating Temporary Mode
    initial_state: on
    trigger:
      - platform: state
        entity_id: input_select.central_heating_temporary_mode
    action:
      - service: mqtt.publish
        data_template:
          topic: "ebusd/f47/Hc1SFMode/set"
          payload: >
            {% set tpmode = {
              'None': 'none',
              'Day away': 'onedayholiday',
              'Day in': 'onedaybankholiday',
              'Party': 'party' } %}
            {{ tpmode.get(trigger.to_state.state,'none') }}

  - alias: Get Central Heating Temporary Mode
    initial_state: on
    trigger:
      - platform: mqtt
        topic: "ebusd/f47/Hc1SFMode"
    action:
      service: input_select.select_option
      data_template:
        entity_id: input_select.central_heating_temporary_mode
        option: >
          {% set tpmode = {
            'none': 'None',
            'onedayholiday': 'Day away',
            'onedaybankholiday': 'Day in',
            'party': 'Party' } %}
          {{ tpmode.get('trigger.payload','None') }}

Technically this is working fine, but when I change the input_select in HA, as soon as ithe message is sent to ebusd/f47/Hc1SFMode/set, “Get Central Heating Temporary Mode” automation is triggered with the old value (why? ebusd/f47/Hc1SFMode/ has not changed yet), input_select is changed back to the original value, and “Set Central Heating Temporary Mode” is triggered again sending the original value to ebusd/f47/Hc1SFMode/set. So while i can see the topics changing on MQTT side, its almost instantly changed back.

If i disable “Get Central Heating Temporary Mode” automation, then “Set Central Heating Temporary Mode” works fine and changes ebusd/f47/Hc1SFMode correctly.

Im using similar automations with input_numbers and they work perfectly fine and im not sure why input_select behaves differently:

  - alias: Set Central Heating Heat Curve
    initial_state: on
    trigger:
      - platform: state
        entity_id: input_number.central_heating_heat_curve
    action:
      service: mqtt.publish
      data_template:
        topic: "ebusd/f47/Hc1HeatCurve/set"
        payload: "{{ states.input_number.central_heating_heat_curve.state | float }}"

  - alias: Get Central Heating Heat Curve
    initial_state: on
    trigger:
      - platform: mqtt
        topic: "ebusd/f47/Hc1HeatCurve"
    action:
      service: input_number.set_value
      data_template:
        entity_id: input_number.central_heating_heat_curve
        value: "{{ trigger.payload | float }}"

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106341

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>