Automation firing dispite wrong state

Hey,

So ive decided to try some automation with a sonoff temp sensor turning on a light ( just to test)

Ive got it set to trigger on temp change to under xx
Condition to check change temp is below xx

Then turn on light if condition met.

However it never tiggers automatically and if i trigger manually it fires every time regardless what i set the threshold temps to.

No screen shots or yaml atm as away from home but where could i be going wrong?

Entity is sensor.ewelink_th01_temperatureand shows the correct state (value) when typing out.

Can you show us you automation in Yaml format

The most common issue when new users make posts like is that they do not understand that triggers require an event. In the case of a State trigger, the state has to change to and/or from the exact specified value. For Numeric state triggers relationship between the state and the above or below must change from False to True. In your example, if the temperature was under xx when you saved the automation, the temperature must rise above xx then fall below xx in order for a trigger event to occur.

When you manually fire an automation, the trigger and conditions are skipped it just runs the action section of the automation… that is why the button is labelled “Run Actions”.

alias: Master Bed Temp
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.ewelink_th01_temperature
    attribute: ""
    below: 30
    for:
      hours: 0
      minutes: 0
      seconds: 5
condition:
  - type: is_temperature
    condition: device
    device_id: f215194dc96df4cd7b4241bbf8abceaf
    entity_id: sensor.ewelink_th01_temperature
    domain: sensor
    below: 30
action:
  - type: turn_on
    device_id: 73a263ada78a01926e62934ab74b922f
    entity_id: light.hall_light_switch_light
    domain: light
mode: single

First attempt, go easy on me lol

I am changing the state (temp) by sitting on the sensor to heat above xx and putting it under a cold cup to cool. The card shows the temp changjng above and below

It’s 99% correct… and the minor error is one that can easily be caused by one mistaken click in the UI automation editor. If you are not using an attribute as the target of your Numeric state trigger, there shouldn’t be an attibute entry as part of the trigger.

alias: Master Bed Temp
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.ewelink_th01_temperature
    below: 30
    for:
      hours: 0
      minutes: 0
      seconds: 5
condition:
  - type: is_temperature
    condition: device
    device_id: f215194dc96df4cd7b4241bbf8abceaf
    entity_id: sensor.ewelink_th01_temperature
    domain: sensor
    below: 30
action:
  - type: turn_on
    device_id: 73a263ada78a01926e62934ab74b922f
    entity_id: light.hall_light_switch_light
    domain: light
mode: single

Your condition is a little bit of overkill for this automation, but it shouldn’t be a problem.

The condition was me trying to error check, however i have removed the attribute line and now all is working! I assumed as it was empty it wouldnt be an issue.

Thank you for your help! That single line would have had me stumped for days