Issues getting temperature-based automation to run

Please format your configuration properly so we can tell whether you have structural errors and so we can use copy/paste without introducing issues with quote marks.

Manually running automations skips any triggers and conditions. It is only useful for testing the actions.

Your 2 examples invoke two different pieces of data i.e. the state of the sensor and the current_temperature attribute. Which of these hold the actual value you want the automation to be based on?

Both the template and Numeric state triggers you have shown require the temperature to change from 40 or above to less than 40 degrees. If it is already under 40 at 6AM, the those triggers will not fire. What you likely want to do is to have triggers for both time and temperature, and mirror those triggers in the Condition block:

trigger:
  - platform: numeric_state
    entity_id: sensor.my_weather_station_temperature
    below: 40
    for: "00:05:00"
  - platform: time
    at: "06:00"
condition:
  - condition: numeric_state
    entity_id: sensor.my_weather_station_temperature
    below: 40
  - condition: time
    after: "06:00"
    before: "20:00"
action: ...
1 Like