Automation won't be triggered

Hi everyone.

Firstly: Happy new year!

I need help with an automation. I want to keep the temperature in the room around 22C. The automation turns a heather (smart socket) on when a temperature sensor registers a change in temperature below 22. I have added two conditions: 1 - my phone is connected to my WIFI - to prevent it to be triggered when I’m not at home and, 2 - every day from 8 -23h.

The problem is: the automation only works after being executed manually for the first time in a day. After manually triggering it for the first time, another automation turns the heater off when the temperature is above 22. After this, the “turn the heater on automation” works fine.

the yaml file is:

alias: Turn heater on
description: ''
trigger:
  - type: temperature
    platform: device
    device_id: c6db6c8c1a520524daa93efbb9efad16
    entity_id: sensor.thermometer_temperature_measurement_2
    domain: sensor
    below: 22
    for:
      hours: 0
      minutes: 0
      seconds: 30
    above: 15
condition:
  - condition: state
    entity_id: sensor.marios_iphone_ssid
    state: My network
  - condition: time
    after: '08:00'
    before: '22:00'
action:
  - type: turn_on
    device_id: 94e0e0dc6dcb978b37260b06be01981b
    entity_id: switch.heater
    domain: switch
mode: single

What am I doing wrong here???

I don’t use the GUI editor (so I don’t use device triggers) but I’m not sure why you have “above: 15” in there? I’m not sure how that would work.

Also the trigger won’t occur unless the temperature goes above and then subsequently below 22. if it’s already below 22 then it won’t trigger again until the temp goes above 22.

Hello @finity, thank you for your response.
I have added the “above 15” just to try to make it work…
I see. The heater turns on by another automation that triggers it at 8 AM. This one is working fine, so, at 8 AM, the heater is turned on, the temperature rises to 22 and it turns off. The problem is that it won’t turn on again unless I execute it manually, then it will work until the end of the day.
I have taken off the condition:

  - condition: state
    entity_id: sensor.marios_iphone_ssid
    state: My network

It worked fine today. But I’m not sure if it will work tomorrow.

The heater turns on by another automation that triggers it at 8 AM. This one is working fine, so, at 8 AM, the heater is turned on, the temperature rises to 22 and it turns off.

So this automation also turns off the heater when temp goes over 22c?

Hi there, thank you @duceduc.

So this automation also turns off the heater when temp goes over 22c?

There are 3 automations controlling the temperature in this room:
1 - turn the heating on at 8 AM - working fine.
2 - keep the temperature above 22 - this one is not working.
3 - turn the heating off when the temperature is above 22 - working fine.

I have changed the time as you suggested:

alias: Turn heater on
description: ''
trigger:
  - type: temperature
    platform: device
    device_id: c6db6c8c1a520524daa93efbb9efad16
    entity_id: sensor.thermometer_temperature_measurement_2
    domain: sensor
    below: 22
    for:
      hours: 0
      minutes: 0
      seconds: 30
condition:
  - condition: time
    after: '08:00:00'
    before: '22:00:00'
action:
  - type: turn_on
    device_id: 94e0e0dc6dcb978b37260b06be01981b
    entity_id: switch.heater
    domain: switch
mode: single

I will see if it will work in the morning.

Thank you once again.

It is working fine now!
I think it was the time format.

Thank you, guys.