been trying to figure out for a couple of vacations now, why I see my HA instance go to 100% memory_use_pecent, run 80 degrees C and finally reboot… It seems to coincide with morning routines, and I scrutinized all scripts/automations, as thorough as I believed was thorough.
And yet, my last vacation was trouble again. Ive grown accustomed to wake up before my alarmclock, and check, and then quickly restart the core, to prevent it from happening. Even created an automation now to do that automatically.
Still, I had no real lead. Until just now, I found a really huge file in the .storage, which I opened in a text editor, to reveal traces… and the date and time made me think of the final reboot the system did before I took measures in my own hands.
scrolling a long way down in the file, but still nowhere near the end, I find a last script being called, and after that, all repeating entries…
"script.espresso_on_when_home": [
{
"extended_dict": {
"last_step": "sequence/0/repeat/until/0/entity_id/0",
"run_id": "5920077e24aece6168896a6ceb6ef90a",
"state": "stopped",
"script_execution": "cancelled",
"timestamp": {
"start": "2022-08-30T04:27:06.787435+00:00",
"finish": "2022-08-30T04:32:42.243826+00:00"
},
"domain": "script",
"item_id": "espresso_on_when_home",
"trace": {
"sequence/0": [
{
"path": "sequence/0",
"timestamp": "2022-08-30T04:27:06.790977+00:00",
"changed_variables": {
"this": {
"entity_id": "script.espresso_on_when_home",
"state": "off",
"attributes": {
"last_triggered": "2022-08-29T03:48:22.201167+00:00",
"mode": "restart",
"current": 0,
"friendly_name": "Espresso on when home"
},
"last_changed": "2022-08-29T05:56:04.823784+00:00",
"last_updated": "2022-08-29T05:56:04.823784+00:00",
"context": {
"id": "01GBM2QQ2QC5AFPFRZ8ZEWX47M",
"parent_id": null,
"user_id": null
}
},
"context": {
"id": "01GBPG1H4PPVSZYZMRFH9NRCWG",
"parent_id": null,
"user_id": "5802703abd9546fa96451cd52068c446"
}
}
}
],
"sequence/0/repeat/sequence/0": [
{
"path": "sequence/0/repeat/sequence/0",
"timestamp": "2022-08-30T04:32:42.100940+00:00",
"changed_variables": {
"repeat": {
"first": false,
"index": 457656
}
},
"result": {
"result": true
}
},
{
"path": "sequence/0/repeat/sequence/0",
"timestamp": "2022-08-30T04:32:42.101609+00:00",
"changed_variables": {
"repeat": {
"first": false,
"index": 457657
}
},
"result": {
"result": true
}
},
{
"path": "sequence/0/repeat/sequence/0",
"timestamp": "2022-08-30T04:32:42.102294+00:00",
"changed_variables": {
"repeat": {
"first": false,
"index": 457658
}
},
"result": {
"result": true
}
},
{
"path": "sequence/0/repeat/sequence/0",
"timestamp": "2022-08-30T04:32:42.102961+00:00",
"changed_variables": {
"repeat": {
"first": false,
"index": 457659
}
},
as this is line 75968, and the file goes to 17470073, this might give you an idea…
now the script is:
script:
# Only turn on Espresso if Wijke or Marijn is home
espresso_on_when_home:
alias: Espresso on when home
mode: restart
sequence:
- repeat:
sequence:
- condition: state
entity_id: switch.espresso_keuken
state: 'off'
- condition: >
{{is_state('person.marijn','home') or is_state('person.wijke','home')}}
- service: switch.turn_on
entity_id: switch.espresso_keuken
- delay:
minutes: 1
until:
- condition: state
entity_id: switch.espresso_keuken
state: 'on'
- condition: state
entity_id: input_boolean.notify_developing
state: 'on'
- service: notify.system
data:
title: Espresso
message: >
{{now().timestamp()|timestamp_custom('%X')}}: Espresso switched on
which I hoped would check if the espresso machine is ‘off’, either me or my spouse are at home, and then turn on, and wait a minute. It needs to repeat that, because the switch doesnt always report its on.
if its on, stop and continue.
How on earth would this be able to run into an endless loop, and a very quick one at that?
these huge memory spikes are like:
or worse:
As far as I can see, this script would not even pass the second condition and halt there?
as the trace says:
"state": "stopped",
"script_execution": "cancelled",
so that would seem ok?
its part of a larger script
"config": {
"alias": "Opstaan",
"mode": "restart",
"sequence": [
{
"service": "script.turn_on",
"entity_id": [
"script.opstaan_select",
"script.alarm_disarm",
"script.turn_on_quooker_keuken",
"script.scene_opstaan",
"script.espresso_on_when_home",
"script.netwerk_dorm_on_when_daughters_home",
"script.dorm_marte_on_when_marte_home",
"script.turn_on_netwerk_auditorium",
"script.switch_dorm_studenten_on"
]
},
please have a look?