deamon
(Deam0n)
October 22, 2023, 10:09pm
1
I’m posting here to get some attention to my issue…
opened 04:53PM - 09 Sep 23 UTC
integration: automation
### The problem
I've some automations failing. These automations worked for yea… rs, and stop working after update to 2023.8.
I've seen several other similar reports, but in the end are related to an integration. On my case, I'm not sure how to identify the culprit therefore I'm opening a new issue.
This automation, based on some conditions, turns on or off an input_boolean.
After restarting HA, the automation runs as expected. Once it triggers itself a one or two times. I get the following on the trace:
![image](https://github.com/home-assistant/core/assets/1869650/7a284fdc-b64c-4f69-9e98-f53d07c5cbbb)
This happens with other triggers as well. it's not limited to the one in the screenshot.
Please let me know how can I further help you to help me (for instance where to get the relevant logs)
### What version of Home Assistant Core has the issue?
core-2023.9.1
### What was the last working version of Home Assistant Core?
core-2023.7
### What type of installation are you running?
Home Assistant OS
### Integration causing the issue
_No response_
### Link to integration documentation on our website
_No response_
### Diagnostics information
_No response_
### Example YAML snippet
```yaml
alias: Ricardo away checker Nothing Phone
description: >-
If Ricardo is away for 10min turns on the input_boolean...Once Ricardo arrives
home, turns it off
trigger:
- platform: state
entity_id:
- person.ricardo
to: not_home
for:
hours: 0
minutes: 5
seconds: 0
from: home
- platform: state
entity_id:
- person.ricardo
to: home
for:
hours: 0
minutes: 30
seconds: 0
id: return
- platform: state
entity_id:
- sensor.nothing_phone1_ble
- device_tracker.nothinphone1_fritz
to: not_home
for:
hours: 0
minutes: 0
seconds: 0
from: home
- platform: state
entity_id:
- person.ricardo
to: Work
condition: []
action:
- if:
- condition: not
conditions:
- condition: trigger
id: return
- condition: state
entity_id: sensor.nothing_phone1_ble
state: home
- condition: state
entity_id: device_tracker.nothinphone1_fritz
state: home
then:
- stop: BLE, BT and WIFI report Ricardo at home.
- if:
- condition: not
conditions:
- condition: trigger
id: return
- condition: state
entity_id: sensor.nothing_phone1_ble
state: not_home
- condition: not
conditions:
- condition: state
entity_id: sensor.nphone1_wifi_connection
state: 0rion
enabled: true
- condition: state
entity_id: input_boolean.ricardo_away_10_min
state: "off"
for:
hours: 0
minutes: 3
seconds: 0
- condition: state
entity_id: device_tracker.nothinphone1_fritz
state: not_home
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.withings_bed_occupancy_ricardo
state: "off"
- condition: state
entity_id: binary_sensor.withings_bed_occupancy_ricardo
state: unavailable
then:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.ricardo_away_10_min
- service: notify.ricardo
data:
message: You've been successfully set away!
title: ✅ Set away!
else:
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- if:
- condition: state
entity_id: input_boolean.ricardo_away_10_min
state: "off"
then:
- service: automation.trigger
data:
skip_condition: false
target:
entity_id: automation.ricardo_away_checker_nothing_phone
enabled: true
enabled: true
- if:
- condition: trigger
id: return
then:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.ricardo_away_10_min
mode: restart
```
### Anything in the logs that might be useful for us?
_No response_
### Additional information
_No response_
I’ve some automations failing. These automations worked for years, and stop working after update to 2023.8.
I’ve seen several other similar reports, but in the end are related to an integration. On my case, I’m not sure how to identify the culprit therefore I’m opening a new issue.
This automation, based on some conditions, turns on or off an input_boolean.
After restarting HA, the automation runs as expected. Once it triggers itself a one or two times. I get the following on the trace:
alias: Ricardo away checker Nothing Phone
description: >-
If Ricardo is away for 10min turns on the input_boolean...Once Ricardo arrives
home, turns it off
trigger:
- platform: state
entity_id:
- person.ricardo
to: not_home
for:
hours: 0
minutes: 5
seconds: 0
from: home
- platform: state
entity_id:
- person.ricardo
to: home
for:
hours: 0
minutes: 30
seconds: 0
id: return
- platform: state
entity_id:
- sensor.nothing_phone1_ble
- device_tracker.nothinphone1_fritz
to: not_home
for:
hours: 0
minutes: 0
seconds: 0
from: home
- platform: state
entity_id:
- person.ricardo
to: Work
condition: []
action:
- if:
- condition: not
conditions:
- condition: trigger
id: return
- condition: state
entity_id: sensor.nothing_phone1_ble
state: home
- condition: state
entity_id: device_tracker.nothinphone1_fritz
state: home
then:
- stop: BLE, BT and WIFI report Ricardo at home.
- if:
- condition: not
conditions:
- condition: trigger
id: return
- condition: state
entity_id: sensor.nothing_phone1_ble
state: not_home
- condition: not
conditions:
- condition: state
entity_id: sensor.nphone1_wifi_connection
state: 0rion
enabled: true
- condition: state
entity_id: input_boolean.ricardo_away_10_min
state: "off"
for:
hours: 0
minutes: 3
seconds: 0
- condition: state
entity_id: device_tracker.nothinphone1_fritz
state: not_home
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.withings_bed_occupancy_ricardo
state: "off"
- condition: state
entity_id: binary_sensor.withings_bed_occupancy_ricardo
state: unavailable
then:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.ricardo_away_10_min
- service: notify.ricardo
data:
message: You've been successfully set away!
title: ✅ Set away!
else:
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- if:
- condition: state
entity_id: input_boolean.ricardo_away_10_min
state: "off"
then:
- service: automation.trigger
data:
skip_condition: false
target:
entity_id: automation.ricardo_away_checker_nothing_phone
enabled: true
enabled: true
- if:
- condition: trigger
id: return
then:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.ricardo_away_10_min
mode: restart
If someone could help me identifying the root cause I would be very thankful.
deamon
(Deam0n)
November 30, 2023, 12:28pm
2
Can someone try to help on this? Or let me know how I can provide more meaningful information
123
(Taras)
November 30, 2023, 1:18pm
3
When an automation employs automation.trigger
on itself, it’s effectively using itself like a script (because neither the automation’s trigger
or condition
are executed, only its action
). Generally speaking, this is not a recommended design pattern; I have seen many reports of operational problems when this ill-advised pattern is employed. In all cases, I recommend redesigning the automation to avoid calling itself in this manner.
petro
(Petro)
November 30, 2023, 1:26pm
4
Change it to mode queued and it would probably work. Outside that, I agree with 123 on this. There’s no reason for recursion in an automation or even a script. Especially if you’re using restart mode.
deamon
(Deam0n)
November 30, 2023, 5:31pm
5
That’s not the point… These automation worked for years… and there’s no way to create a loop in scripts / automations…
Something has changed in August that broke this…
I’ve seen that in similar issues they troubleshoot it to the integrations on the automation itself, but I’m not sure how to do the same.
petro
(Petro)
November 30, 2023, 5:49pm
6
Yes there is, repeat
- repeat:
while:
- condition: state
entity_id: foo.bar
state: "on"
sequence:
- service: ....
data:
....
There’s a few different repeat types, see link
The change that was made was the timeouts on service calls were removed. So automations now stall when devices & services don’t respond or exit correctly. Find out what device/service is stalling the execution of the automation and report it as an issue on github.
petro
(Petro)
November 30, 2023, 6:09pm
8
Look at the automations trace, it’ll show the last run and where it stopped.