HomeAssistant automation not triggering

Hello Guys,

I have a HomeAssistant container installed and working. I have many Shelly Pro 4PM devices, all of my power sockets, lights, heating connected to them. I also have a Shelly H&T device what reports the temperature and humidity, it works well. What I would like to achive to turn off the heating (switch the correct Shelly Pro 4PM entity) if the temperature is above 25 celsius, and turn it on when the temperature is below 23 celsius. So I created 2 automation via the WebUI:

For turning off:

id: '1734990182252'
alias: Street bedroom heating off
description: Turn off the heating if the temperature is above 25 celsius
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.shellyhtg3_84fce639d0d8_temperature
    above: 25
conditions: []
actions:
  - action: switch.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: switch.f_utcai
mode: single

For turning on:

id: '1734990341842'
alias: Street bedroom heating on
description: Turn on the heating if the temperature is above 23 celsius
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.shellyhtg3_84fce639d0d8_temperature
    below: 23
conditions: []
actions:
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.f_utcai
mode: single

Looks like this does not trigger at all, but I see the temperature is around 27-28 celsius, reported back correctly by H&T device in every 5 minutes. If I click to “Run actions” then it will do the switch and turn off the heating, so I guess the action part is correct. As you can see, I don’t have conditions, hence the trigger should have some problems, but if I am correct, then idk how to debug this, because I don’t see anything under Trace. I created this 2 automations via web, so I didn’t touched or applied anything to YAML, this is the pure web based config.
Maybe somebody have experience with this kind of automation and have an idea how can I move forward? I already disabled/enabled the automation, restarted the whole home assistant container as well.

Numeric state triggers using above: and below: only trigger when the state passes through the value. So if it was 27 degrees when you wrote the automation and it has stayed around there, nothing will trigger. The temp has to go from below 25 degrees to above 25 degrees for the first one to trigger and from above 23 degrees to below 23 degrees for the second one to trigger.

1 Like

To accommodate this, add a couple more triggers:

  - trigger: homeassistant
    event: start
  - trigger: event
    event_type: automation_reloaded

and a condition:

conditions:
  - condition: numeric_state
    entity_id: sensor.shellyhtg3_84fce639d0d8_temperature
    above: 25

(and similarly for the ‘below’ automation).

That will then also trigger both automations at HA startup or when you reload automations, and the condition will ensure the correct action is taken.

Alternatively, replace both automations with a Generic Thermostat:

1 Like

You can test an automation by going to Developer Tools | States and changing the state of the trigger entity to one that will fire. As @pkscout says, in this case you would have to change it to below the trigger value to start with. This does not change the “real” value of the sensor, which will be restored next time it refreshes.

Thank you for the help, added the additional triggers and conditions solved the problem, the trigger just fired.

1 Like