Weird automation behavior

Hello all,

I have been asking quite a few questions here lately, I am sorry if I annoy someone! As soon as I solve one problem a few more appear.

The latest one is related to some automations I have setup for the climate integration. Here they are:

- id: '1610494420662'
  alias: house heating
  description: ''
  trigger:
  - platform: time
    at: 06:00:00
  - platform: time
    at: '12:00:00'
  - platform: time
    at: '19:00:00'
  condition: []
  action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
    entity_id: climate.home_temperature
  - delay: 02:00:00
  - service: climate.set_hvac_mode
    data:
      hvac_mode: 'off'
    entity_id: climate.home_temperature
  mode: single
- id: '1611098174646'
  alias: heating boost
  description: ''
  trigger:
  - platform: state
    entity_id: climate.home_temperature
  condition:
  - condition: numeric_state
    entity_id: automation.house_heating
    attribute: current
    below: '1'
  action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
    entity_id: climate.home_temperature
  - delay: 
      minutes: "{{ states('input_number.heating_boost')|int }}"
  - service: climate.set_hvac_mode
    data:
      hvac_mode: 'off'
    entity_id: climate.home_temperature
  mode: single

Basically the first one starts the heating at several specified hours and keeps it on for 2 hours then switches it off. If the temperature reaches the target temperature plus some hot tolerance the heating switches to Idle from the climate integration. This automation works as expected.

The second automation I made so that I can get a heating boost in-between the heating schedule. I have created an input number with a slider that moves in steps of 30 mins. And if I press on the climate heating button, this is registered as a change of state for the second automation which starts the heating for the amount of time set in the input number.

This second automation gives me problems. I looked at the logs and I saw that it triggered by itself several times during the night and I cannot explain it. Is there a way I can ensure that this automation triggers only when I want it to?

Cheers

Lucian

This will trigger on any change of state or attribute change.

Add some states to check in the trigger or add some more conditions.

What I was trying to achieve is the following:

Set the heating boost to a value. Then press heat button to turn on heating for the desired time.

I figured that the weird triggering happens because of the trigger I used, i.e. the state change but I do not understand why this happens. Also I don’t know what other trigger to use for this automation.

I wanted to make it as simple as possible to get a heating boost.

An idea that I just had is to condition the trigger to look for a value change of the Heating Boost input_number. Make it so that iti initial value is always 0, then when I increase to 30 or 60, the heating starts.

Is there another way?

P.S.: I would still like to know what changes the state of the climate integration during the night. In my mind it shouldn’t happen.

As I said any state or attribute change will trigger the the trigger you have. A change in current temperature for example.

Trigger on the heat button changing state.

i don’t know how to address only the heat button state…

Probably something like this:

  trigger:
  - platform: state
    entity_id: climate.home_temperature
    attribute: hvac_mode
    to: heat

Though that is going to trigger when your first automation does. Due to this:

  action:
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat

You could turn off the second automation before doing that action. Then turn it on again after, use the homeassistant.turn_off service.

I just tried your suggestion with the trigger and it doesn’t work. I find it very confusing how this climate integration is working…

Was it already in heat mode?

I don’t see why the second automation needs to be an automation. Convert the second automation into a script. Make the Button call the script.

Lovelace Button Card

type: button
name: Boost Heat
show_state: false
tap_action:
  action: call-service
  service: script.turn_on
  service_data:
    entity_id: script.boost_heat
1 Like

no it wasn’t!

I am going to try the script suggestion below! sounds like a simpler solution!

@123 thank you for this suggestion! I have played with it for a bit and it appears to be working. I do have a question thou.

In the script section I have a delay which I set as:

- delay:
    minutes: "{{ states('input_number.heating_boost')|int }}"

However, in the UI editor after I save the script it appears like this:

image

And if I switch to yaml edit:

image

In the scripts.yaml file the script appears fine…

Correction: even in the scripts.yaml file, the delay section look like this:

heating_boost:
  icon: mdi:heating
  mode: single
  sequence:
  - condition: state
    entity_id: automation.house_heating
    state: '0'
    attribute: current
  - service: climate.set_hvac_mode
    data:
      hvac_mode: heat
    entity_id: climate.home_temperature
  - delay: '[object Object]'
  - service: climate.set_hvac_mode
    data:
      hvac_mode: 'off'
    entity_id: climate.home_temperature
  alias: heating boost

Glad to hear it works now.

The Automation Editor has limitations and that’s one of several reasons why I never use it.

I use a text editor (Visual Studio Code) to compose automations, scripts, etc.