Automation only fires once and never runs again

Automation works only once and does not run again, this can be seen in the launch history


alias: KotelOff2259t19
description: ""
trigger:
  - platform: time
    at: "22:59:00"
condition:
  - type: is_temperature
    condition: device
    device_id: c3af142ada46a7078e32086ac4ac8d69
    entity_id: sensor.sonoff_1000725f1a_temperature
    domain: sensor
    above: 19
action:
  - type: turn_off
    device_id: 6107a6cb224c69cbb07751291cf3444c
    entity_id: switch.sonoff_100109343c_1
    domain: switch
mode: restart

If you edit the automation: change the name or time, then it will work 1 time, the next day it does not work.

Please tell me where to fix it. I am just starting to use

You should share trace logs with us.

It will be triggered once every day at specific time (22:59), so share one positive and one negative trace log and we can help you

you sure that the condition (temperature above 19) was met on the second day?

I don’t think that’s correct.

the docs you linked to says it will cancel the previous run of the automation and restart the automation.

I don’t think that means the first run needs to finish first.

What you are describing is how the queued mode works.

You’re right, I misread it. I’ve edited my post

1 Like

After the update, Home Assistant cleaned the logs, you have to wait.

Yes, the temperature is always more than 19 degrees

In the beginning I had the Single mode, then when the automation did not work the next day I changed it to restart

Is the switch turned on while running the automation? Could be the reason it isn’t fired if it is already turned off.

I renamed automation 2 times and it started
Related logbook entries

December 15, 2022
KotelOff2259t19 starts on time
22:59:00 - 7 minutes ago
Heating is turned off by automation KotelOff2259t19 starts by time
22:59:00 - 7 minutes ago
Heating is switched on by automation KotelOff2259t19 starts by time
22:59:00 - 7 minutes ago

Automation Config

id: '1670957308945'
alias: KotelOff2259t19
description: ''
trigger:
  - platform: time
    at: '22:59:00'
condition:
  - type: is_temperature
    condition: device
    device_id: c3af142ada46a7078e32086ac4ac8d69
    entity_id: sensor.sonoff_1000725f1a_temperature
    domain: sensor
    above: 19
action:
  - type: turn_off
    device_id: 6107a6cb224c69cbb07751291cf3444c
    entity_id: switch.sonoff_100109343c_1
    domain: switch
mode: restart
Iteration 1
Executed: 15 December 2022 г., 22:59:00
Result:
result: true
Iteration 2
Executed: 15 December 2022 г., 22:59:00
Result:
result: true
entity_id/0
Executed: 15 December 2022 г., 22:59:00
Result:
result: true
state: 20.7
{
  "trace": {
    "last_step": "action/0",
    "run_id": "9d564e8e16d65296e6752d4ee46351b8",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2022-12-15T19:59:00.315228+00:00",
      "finish": "2022-12-15T19:59:00.534972+00:00"
    },
    "domain": "automation",
    "item_id": "1670957308945",
    "trigger": "time",
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2022-12-15T19:59:00.315369+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.koteloff2259t19",
              "state": "on",
              "attributes": {
                "last_triggered": "2022-12-13T19:59:00.426866+00:00",
                "mode": "restart",
                "current": 0,
                "id": "1670957308945",
                "friendly_name": "KotelOff2259t19"
              },
              "last_changed": "2022-12-15T19:23:10.900349+00:00",
              "last_updated": "2022-12-15T19:23:10.900349+00:00",
              "context": {
                "id": "01GMBKV65MSBVSPH77A01Y72K4",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "0",
              "idx": "0",
              "alias": null,
              "platform": "time",
              "now": "2022-12-15T22:59:00.314348+03:00",
              "description": "time",
              "entity_id": null
            }
          }
        }
      ],
      "condition/0": [
        {
          "path": "condition/0",
          "timestamp": "2022-12-15T19:59:00.315466+00:00",
          "result": {
            "result": true
          }
        },
        {
          "path": "condition/0",
          "timestamp": "2022-12-15T19:59:00.315509+00:00",
          "result": {
            "result": true
          }
        }
      ],
      "condition/0/entity_id/0": [
        {
          "path": "condition/0/entity_id/0",
          "timestamp": "2022-12-15T19:59:00.315554+00:00",
          "result": {
            "result": true,
            "state": 20.7
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2022-12-15T19:59:00.316948+00:00",
          "changed_variables": {
            "context": {
              "id": "01GMBNWS6VJZJBMC5C0J67MMVN",
              "parent_id": null,
              "user_id": null
            }
          }
        }
      ]
    },
    "config": {
      "id": "1670957308945",
      "alias": "KotelOff2259t19",
      "description": "",
      "trigger": [
        {
          "platform": "time",
          "at": "22:59:00"
        }
      ],
      "condition": [
        {
          "type": "is_temperature",
          "condition": "device",
          "device_id": "c3af142ada46a7078e32086ac4ac8d69",
          "entity_id": "sensor.sonoff_1000725f1a_temperature",
          "domain": "sensor",
          "above": 19
        }
      ],
      "action": [
        {
          "type": "turn_off",
          "device_id": "6107a6cb224c69cbb07751291cf3444c",
          "entity_id": "switch.sonoff_100109343c_1",
          "domain": "switch"
        }
      ],
      "mode": "restart"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01GMBNWS6VJZJBMC5C0J67MMVN",
      "parent_id": null,
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "KotelOff2259t19",
      "message": "triggered by time",
      "source": "time",
      "entity_id": "automation.koteloff2259t19",
      "context_id": "01GMBNWS6VJZJBMC5C0J67MMVN",
      "when": 1671134340.316046,
      "domain": "automation"
    },
    {
      "when": 1671134340.572197,
      "state": "off",
      "entity_id": "switch.sonoff_100109343c_1",
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "KotelOff2259t19",
      "context_message": "triggered by time",
      "context_source": "time",
      "context_entity_id": "automation.koteloff2259t19"
    },
    {
      "when": 1671134340.686407,
      "state": "on",
      "entity_id": "switch.sonoff_100109343c_1",
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "KotelOff2259t19",
      "context_message": "triggered by time",
      "context_source": "time",
      "context_entity_id": "automation.koteloff2259t19"
    }
  ]
}

today 12/16/2022 automation was not launched, in the launch history it is 12/15/2022.

It turns out after the change, automation starts only once.

What to do to make automation work every day?

What does the last trace say for 12/16 that didn’t run the actions?

In the log, automation did not start, or I’m looking in the wrong place.


Automation worked at the wrong time

{
  "trace": {
    "last_step": "action/0",
    "run_id": "2305fd5c0d92f2c577bd2c65af18481e",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2022-12-17T13:12:16.759532+00:00",
      "finish": "2022-12-17T13:12:16.977427+00:00"
    },
    "domain": "automation",
    "item_id": "1670957308945",
    "trigger": "time",
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2022-12-17T13:12:16.759608+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.koteloff2259t19",
              "state": "on",
              "attributes": {
                "last_triggered": "2022-12-15T19:59:00.316215+00:00",
                "mode": "restart",
                "current": 0,
                "id": "1670957308945",
                "friendly_name": "KotelOff2259t19"
              },
              "last_changed": "2022-12-15T19:23:10.900349+00:00",
              "last_updated": "2022-12-15T19:59:00.534070+00:00",
              "context": {
                "id": "01GMBNWS6VJZJBMC5C0J67MMVN",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "0",
              "idx": "0",
              "alias": null,
              "platform": "time",
              "now": "2022-12-17T16:12:16.759113+03:00",
              "description": "time",
              "entity_id": null
            }
          }
        }
      ],
      "condition/0": [
        {
          "path": "condition/0",
          "timestamp": "2022-12-17T13:12:16.759649+00:00",
          "result": {
            "result": true
          }
        },
        {
          "path": "condition/0",
          "timestamp": "2022-12-17T13:12:16.759664+00:00",
          "result": {
            "result": true
          }
        }
      ],
      "condition/0/entity_id/0": [
        {
          "path": "condition/0/entity_id/0",
          "timestamp": "2022-12-17T13:12:16.759680+00:00",
          "result": {
            "result": true,
            "state": 20.7
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2022-12-17T13:12:16.760141+00:00",
          "changed_variables": {
            "context": {
              "id": "01GMG3DFKQ40D6AEMHN3EZSKCT",
              "parent_id": null,
              "user_id": null
            }
          }
        }
      ]
    },
    "config": {
      "id": "1670957308945",
      "alias": "KotelOff2259t19",
      "description": "",
      "trigger": [
        {
          "platform": "time",
          "at": "22:59:00"
        }
      ],
      "condition": [
        {
          "type": "is_temperature",
          "condition": "device",
          "device_id": "c3af142ada46a7078e32086ac4ac8d69",
          "entity_id": "sensor.sonoff_1000725f1a_temperature",
          "domain": "sensor",
          "above": 19
        }
      ],
      "action": [
        {
          "type": "turn_off",
          "device_id": "6107a6cb224c69cbb07751291cf3444c",
          "entity_id": "switch.sonoff_100109343c_1",
          "domain": "switch"
        }
      ],
      "mode": "restart"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01GMG3DFKQ40D6AEMHN3EZSKCT",
      "parent_id": null,
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "KotelOff2259t19",
      "message": "triggered by time",
      "source": "time",
      "entity_id": "automation.koteloff2259t19",
      "context_id": "01GMG3DFKQ40D6AEMHN3EZSKCT",
      "when": 1671282736.759824,
      "domain": "automation"
    },
    {
      "when": 1671282737.011616,
      "state": "off",
      "entity_id": "switch.sonoff_100109343c_1",
      "context_event_type": "automation_triggered",
      "context_domain": "automation",
      "context_name": "KotelOff2259t19",
      "context_message": "triggered by time",
      "context_source": "time",
      "context_entity_id": "automation.koteloff2259t19"
    }
  ]
}