Humidity changes but automation doesn't trigger

alias: veg_hum_on
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.temperature_and_humidity_alarm_humidity
    below: 60
condition: []
action:
  - type: turn_on
    device_id: ce86e0ee2fe69387592d097abf846372
    entity_id: 4412f1fd838e99ed1b9cb91c5868aa5f
    domain: switch
mode: single

sensor.temperature_and_humidity_alarm_humidity
state: 45.6

Running this automation manually works.
Restarting HA doesn’t trigger this automation.

as far as I know the humidity would have to pass the threshold of 60 before it will trigger.
taken from the docs

Crossing the threshold means that the trigger only fires if the state wasn’t previously within the threshold. If the current state of your entity is 50 and you set the threshold to below: 75, the trigger would not fire if the state changed to e.g. 49 or 72 because the threshold was never crossed. The state would first have to change to e.g. 76 and then to e.g. 74 for the trigger to fire.

EDIT:
try and avoid using devices in your automations, both as triggers and actions. use entities instead.

3 Likes

As @Frosty mentioned, that will only be triggered if it goes from above to below 60.

Restarting HA will never trigger that automation.

If you want the automation to fire after a restart when the humidity is below 60 do this:

alias: veg_hum_on
description: ""
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.temperature_and_humidity_alarm_humidity
    below: 60
  - platform: homeassistant
    event: 'start'
condition:
  - condition: numeric_state
    entity_id: sensor.temperature_and_humidity_alarm_humidity
    below: 60
action:
  - service: switch.turn_on
    target:
      entity_id: 4412f1fd838e99ed1b9cb91c5868aa5f # replace this with the switch entity_id
mode: single

I also changed you action. Here’s why: Why and how to avoid device_ids in automations and scripts

2 Likes