I have a template sensor “Heating level” with a value set to “Normal”, “Eco” or “Off” based on the electricity price. Further on I have three automations triggered by changes of the “Heating level”. The automations executes differents actions depending on the sensor value. By this I can control three different groups of heating devices at home.
I manually change the value of the “Heating level” on the States tab in Developer tools, everything works fine. All three automations trigger and action is executed as expected. See the following screen dump of the Log book:
The actions are labelled “Gamla huset autoadjust”, “Nybygget autoadjust” and “Daikin autoadjust”. Each action executes a specific scripts, and everrything works as expected.
However, during normal operation when the template sensor is changed by a change in elecrity price, something strange is happening. Only two of the automations are triggered. Instead of the third automation (“Daikin autoadjust”), the entity (Daikin HVAC) is affected directly - not by the script in the “Daikin autoadjust” automation. See the following dump:
I can’t figure out why “Daikin autoadjust” fires when I set the state of the triggering template sensor manually, but not when this state change is triggered by the electricity price. The Daikin control fails due to this. I’m puzzled…
I enclose the YAML of the automations and they are very similar.
- alias: Daikin autoadjust
description: Will adjust settings based on energy price-
trigger:
- platform: state
entity_id: sensor.heating_level
condition: "{{ not is_state_attr('climate.gamla_huset', 'hvac_action', 'off') or is_state('input_boolean.offbyprice_daikin','on') }}"
action:
service: >-
{% if is_state('sensor.heating_level','Normal') %} script.set_daikin_normal
{% elif is_state('sensor.heating_level','Eco') %} script.set_daikin_eco
{% elif is_state('sensor.heating_level','Off') %} script.set_daikin_off
{% else %} script.set_heating_unknown
{% endif %}
id: 619102838d2f47f8b2f6c37fa21aa264
mode: single
- alias: Nybygget autoadjust
description: Will adjust settings based on energy price-
trigger:
- platform: state
entity_id:
- sensor.heating_level
condition: "{{ not is_state_attr('climate.storstugan', 'hvac_action', 'off') or is_state('input_boolean.offbyprice_nybygget','on') }}"
action:
service: >-
{% if is_state('sensor.heating_level','Normal') %} script.set_nybygget_normal
{% elif is_state('sensor.heating_level','Eco') %} script.set_nybygget_eco
{% elif is_state('sensor.heating_level','Off') %} script.set_nybygget_off
{% else %} script.set_heating_unknown
{% endif %}
id: 669b2f3946694ce1b57a48c6dd0bcd18
mode: single
- alias: Gamla huset autoadjust
description: Will adjust settings based on energy price-
trigger:
- platform: state
entity_id:
- sensor.heating_level
condition: "{{ not is_state_attr('climate.badrum_gamla_huset', 'hvac_action', 'off') or is_state('input_boolean.offbyprice_gamla_huset','on') }}"
action:
service: >-
{% if is_state('sensor.heating_level','Normal') %} script.set_gamla_huset_normal
{% elif is_state('sensor.heating_level','Eco') %} script.set_gamla_huset_eco
{% elif is_state('sensor.heating_level','Off') %} script.set_gamla_huset_off
{% else %} script.set_heating_unknown
{% endif %}
mode: single
Any input on this is appreciated!!