Temperature automation wasn't triggered

Hi I’m new to HA and have this simple automation:

alias: turn off fan when cool
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.temperature_sensor_1_temperature
    for:
      hours: 0
      minutes: 5
      seconds: 0
    attribute: temperature
    below: 28
conditions: []
actions:
  - type: turn_off
    device_id: fbe8e05414ba65412f94b0723736afe6
    entity_id: e3f7bf5f652acde7657266c523cc945a
    domain: switch
    metadata:
      secondary: false
mode: single

The sensor’s temperature did go below that threshold:

How should I troubleshoot this? Thanks.

You are attempting to access an attribute temperature on your sensor, which more than likely does not exist. The temperature you are watching in the graph is actually the state of the sensor itself. The solution would thus be to remove the line that says attribute: temperature.

Also, in general it is best to avoid device actions. They may be easy to understand in the visual editor but when looking at the code you have absolutely no idea what switch that action toggles. Much better to use a switch.turn_on action directly on your switch entity.

1 Like

Thanks! That fixed it. I’ll need to learn some of the basics.

There is a lot of cases this automation will fail.
I suggest you look at generic thermostat instead which is more robust