Add continue_on_error to the UI for Scripts and Automations

Well, I just lost the contents of my entire deep freezer. My alert automation failed in step 2 of my actions block because my phone got a new name and it didn’t continue on to the other 5 alerts that it should have done.

NOW, I see that there is a flag I could have set in EACH automation action step to have it continue on failure. BUT it seems like you have to do it in YAML, it’s not available in the GUI.

This has cost me over a thousand dollars in lost expensive frozen meats.

@frenck Could we prioritize fixing this? The default really should be continue on failure, not for the entire action block to just die.

Where I learned about WHY my freezer alarm failed.

Please do not tag developers to get involvement on Feature Requests. Any developer can add this functionality, not just frenck.

Thanks.

1 Like

As unfortunate as this is for you, blaming HA for it seems a bit of a stretch. :wink:

I just wanted to say, I find the behaviour as it is much better. In my opinion an automation (or whatever) should fail, if something’s wrong! It shouldn’t simply move on.

If this is something one wants, as you correctly stated, there already are ways to let an automation move on, but it should always be “by choice” and not “by default”.

Sorry to say, and I can totally understand your anger, but I’d not vote for such a change.

1 Like

I’m not here to get in an argument, I’m warning others that their automations will fail when an Action step fails. For those that use the GUI, there’s no warning of that possibility.

Further, I can’t seem to get it to actually “continue on error”. I set the flag in the yaml, but it still fails and stops.

Anyone know how to fix that?

I think I’m going to instead just run the alerts in the newish “parallel” block to see if that works better. I’m hoping if one fails (whether or not it has the continue flag), the others running in parallel won’t be affected.

I’m guessing anything following the block will still fail though, so one should be careful not to have actions below other actions that may fail… since my continue_on_error was ignored.

Second PSA: Install and monitor Spook :ghost: Your homie

Had I done so, I’d have known about the bad Action step at least.

(Apparently I have a LOT of automations that refer to things that no longer exist…)

OK, but then I’ve to ask, why did you make it a feature request? Instead of a “normal” thread where you’d ask a question or “warn” other users? But if you want a FR, I’m still not sure, what you’re requesting: a warning to other users (that would be a FR for the documentation) or the change of behaviour in automations (that would be a FR for core).

Anyway, to help you with your automation problems, please post the automation and the trace of said automation. You know how to get them? If not, please ask!

So your phone got a new “Name” ( Or you got a “new” Phone ) , which the Automation should send a Notification to , And it fails ! ) because you didn’t change the “Name” in the Automation.

So you want the Automation to “Continue on Failure” , Thou you Never Got this “Message” ( About your Freezer is “Melting” )(For obvious reasons)

Fine, So How on earth would that help you getting the “Notification” about your “Failing Freezer” ?
You Wont get that Notification, because You Want The Automation, to Continue, to it’s other Tasks, which might Fail , for same reasons ( You Change Phone-Name, But Not your “Essential” Automations )

Sounds like a User/Maintenance Issue

PS: As i assume You have a Temperature-Sensor “involved” , A simple “RED-ALLERT” on Your Dashboard, would be more appropriate for you, or A simple Notification

I’ve seen many people “complicate” their life, trying to Simplify/Automate it , And Yes a few blaming others when they fail, due to lack of "fantasy "

When you created that Automation, You were aware of the facts , Why Did You ignore it ?
Or are you just falsely trowing accusations , trying to be heard ?

Have You really been running HA since 2015 ?

I’m not sure I actually selected Feature Request. Maybe it prefilled it because I was looking on that channel when I hit post. Mea Culpa - for this glaring mistake, I am truly sorry. Apparently I can move it still - but not sure where this should go. It’s not Social, well, maybe it is to warn everyone of something that they’re expected to know? Or maybe Configuration (that’s where I just moved it)? I guess I need to find the Official Rules of Behavior.

If you have any hints as to why it ignored the “continue_on_error: true” flag, I’d be very glad to hear it. I do want to learn and make my automations more reliable.

My automation:

alias: Fridge/Freezer Alarm
description: Alert if they get too warm
trigger:
  - platform: numeric_state
    entity_id: binary_sensor.deepfreezer_high_and_rising
    for:
      hours: 0
      minutes: 5
      seconds: 0
    above: 25
    id: Garage Deep Freezer
  - platform: numeric_state
    entity_id: binary_sensor.fridgefreezer_high_and_rising
    for:
      hours: 0
      minutes: 5
      seconds: 0
    above: 25
    id: Garage FridgeFreezer
  - platform: state
    entity_id:
      - binary_sensor.garage_fridge_freezer_esp8266_status
    to: "off"
    for:
      hours: 0
      minutes: 4
      seconds: 0
    id: disconnected
  - platform: state
    entity_id:
      - binary_sensor.garage_fridge_freezer_esp8266_status
    to: unavailable
    for:
      hours: 0
      minutes: 4
      seconds: 0
    id: disconnected
  - platform: state
    entity_id:
      - binary_sensor.fridgefreezer_high_and_rising
    to: "on"
    for:
      hours: 0
      minutes: 5
      seconds: 0
  - platform: state
    entity_id:
      - binary_sensor.deepfreezer_high_and_rising
    to: "on"
    for:
      hours: 0
      minutes: 5
      seconds: 0
condition: []
action:
  - if:
      - condition: trigger
        id: disconnected
    then:
      - service: notify.mobile_app_ingo_s_pixel_6_pro
        continue_on_error: true
        data:
          message: Garage Freezer sensor disconnected!
      - service: notify.notify
        continue_on_error: true
        data:
          message: Garage Freezer sensor disconnected!
    alias: ESP32 Disconnected
  - service: notify.mobile_app_ingo_s_pixel_6_pro
    continue_on_error: true
    data:
      message: >-
        {{ trigger.to_state.name }} {{ trigger.to_state.state }}F temperature
        alert! {{now().strftime("%H:%M:%S on %m/%d/%y")}}
  - service: notify.events
    continue_on_error: true
    data:
      message: >-
        {{ trigger.to_state.name }} {{ trigger.to_state.state }}F temperature
        alert! - {{now().strftime("%H:%M:%S on %m/%d/%y")}}
      data:
        title: Freezer Alert!
        priority: highest
  - service: media_player.play_media
    continue_on_error: true
    target:
      entity_id: media_player.kitchen_display
    data:
      media_content_id: >-
        media-source://tts/cloud?message=++++Temperature+alert+on+%7B%7B+trigger.to_state.name+%7D%7D%2C+it%27s+only+%7B%7B+trigger.to_state.state+%7D%7D+degrees%21++&language=en-US&gender=female
      media_content_type: provider
    metadata:
      title: "    Temperature alert on {{ trigger.to_state.name }}, it's only {{ trigger.to_state.state }} degrees!  "
      thumbnail: https://brands.home-assistant.io/_/cloud/logo.png
      media_class: app
      children_media_class: null
      navigateIds:
        - {}
        - media_content_type: app
          media_content_id: media-source://tts
        - media_content_type: provider
          media_content_id: >-
            media-source://tts/cloud?message=++++Temperature+alert+on+%7B%7B+trigger.to_state.name+%7D%7D%2C+it%27s+only+%7B%7B+trigger.to_state.state+%7D%7D+degrees%21++&language=en-US&gender=female
    enabled: false
  - service: tts.cloud_say
    continue_on_error: true
    data:
      message: >-
        Temperature alert on {{ trigger.to_state.name }}, it's only {{
        trigger.to_state.state }} degrees!  
      entity_id: media_player.nesthub8135
mode: single

My trace:

{
  "trace": {
    "last_step": "action/1",
    "run_id": "100e9861a5c8e7d1e4c1f44148f5e724",
    "state": "stopped",
    "script_execution": "error",
    "timestamp": {
      "start": "2024-06-27T15:27:58.831741+00:00",
      "finish": "2024-06-27T15:27:58.842290+00:00"
    },
    "domain": "automation",
    "item_id": "1663449037294",
    "error": "Service notify.mobile_app_ingo_s_pixel_6_pro not found",
    "trigger": "state of binary_sensor.deepfreezer_high_and_rising",
    "trace": {
      "trigger/5": [
        {
          "path": "trigger/5",
          "timestamp": "2024-06-27T15:27:58.831855+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.watch_the_freezers",
              "state": "on",
              "attributes": {
                "id": "1663449037294",
                "last_triggered": "2024-06-27T13:43:55.120837+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Fridge/Freezer Alarm"
              },
              "last_changed": "2024-06-27T13:43:35.526046+00:00",
              "last_reported": "2024-06-27T13:43:55.134883+00:00",
              "last_updated": "2024-06-27T13:43:55.134883+00:00",
              "context": {
                "id": "01J1CZ0FFG1MDHSSYP5WV6GX33",
                "parent_id": "01J1CZ0FFFE3VBMGN9X4TW6DVE",
                "user_id": null
              }
            },
            "trigger": {
              "id": "5",
              "idx": "5",
              "alias": null,
              "platform": "state",
              "entity_id": "binary_sensor.deepfreezer_high_and_rising",
              "from_state": {
                "entity_id": "binary_sensor.deepfreezer_high_and_rising",
                "state": "off",
                "attributes": {
                  "friendly_name": "DeepFreezer High and Rising"
                },
                "last_changed": "2024-06-27T15:11:58.829321+00:00",
                "last_reported": "2024-06-27T15:11:58.829321+00:00",
                "last_updated": "2024-06-27T15:11:58.829321+00:00",
                "context": {
                  "id": "01J1D41QBCTYDYN304WYX3PBNR",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "to_state": {
                "entity_id": "binary_sensor.deepfreezer_high_and_rising",
                "state": "on",
                "attributes": {
                  "friendly_name": "DeepFreezer High and Rising"
                },
                "last_changed": "2024-06-27T15:22:58.828563+00:00",
                "last_reported": "2024-06-27T15:22:58.828563+00:00",
                "last_updated": "2024-06-27T15:22:58.828563+00:00",
                "context": {
                  "id": "01J1D4NVWC5EKMFGE08CXY5MV3",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "for": {
                "__type": "<class 'datetime.timedelta'>",
                "total_seconds": 300
              },
              "attribute": null,
              "description": "state of binary_sensor.deepfreezer_high_and_rising"
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2024-06-27T15:27:58.834319+00:00",
          "changed_variables": {
            "context": {
              "id": "01J1D4Z0VF1V4A3CE95MYABNSQ",
              "parent_id": "01J1D4NVWC5EKMFGE08CXY5MV3",
              "user_id": null
            }
          }
        }
      ],
      "action/0/if": [
        {
          "path": "action/0/if",
          "timestamp": "2024-06-27T15:27:58.834508+00:00",
          "result": {
            "result": false
          }
        }
      ],
      "action/0/if/condition/0": [
        {
          "path": "action/0/if/condition/0",
          "timestamp": "2024-06-27T15:27:58.834593+00:00",
          "result": {
            "result": false
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2024-06-27T15:27:58.834768+00:00",
          "error": "Service notify.mobile_app_ingo_s_pixel_6_pro not found",
          "result": {
            "params": {
              "domain": "notify",
              "service": "mobile_app_ingo_s_pixel_6_pro",
              "service_data": {
                "message": "DeepFreezer High and Rising onF temperature alert! 11:27:58 on 06/27/24"
              },
              "target": {}
            },
            "running_script": false
          }
        }
      ]
    },
    "config": {
      "id": "1663449037294",
      "alias": "Fridge/Freezer Alarm",
      "description": "Alert if they get too warm",
      "trigger": [
        {
          "platform": "numeric_state",
          "entity_id": "binary_sensor.deepfreezer_high_and_rising",
          "for": {
            "hours": 0,
            "minutes": 5,
            "seconds": 0
          },
          "above": 25,
          "id": "Garage Deep Freezer"
        },
        {
          "platform": "numeric_state",
          "entity_id": "binary_sensor.fridgefreezer_high_and_rising",
          "for": {
            "hours": 0,
            "minutes": 5,
            "seconds": 0
          },
          "above": 25,
          "id": "Garage FridgeFreezer"
        },
        {
          "platform": "state",
          "entity_id": [
            "binary_sensor.garage_fridge_freezer_esp8266_status"
          ],
          "to": "off",
          "for": {
            "hours": 0,
            "minutes": 4,
            "seconds": 0
          },
          "id": "disconnected"
        },
        {
          "platform": "state",
          "entity_id": [
            "binary_sensor.garage_fridge_freezer_esp8266_status"
          ],
          "to": "unavailable",
          "for": {
            "hours": 0,
            "minutes": 4,
            "seconds": 0
          },
          "id": "disconnected"
        },
        {
          "platform": "state",
          "entity_id": [
            "binary_sensor.fridgefreezer_high_and_rising"
          ],
          "to": "on",
          "for": {
            "hours": 0,
            "minutes": 5,
            "seconds": 0
          }
        },
        {
          "platform": "state",
          "entity_id": [
            "binary_sensor.deepfreezer_high_and_rising"
          ],
          "to": "on",
          "for": {
            "hours": 0,
            "minutes": 5,
            "seconds": 0
          }
        }
      ],
      "condition": [],
      "action": [
        {
          "if": [
            {
              "condition": "trigger",
              "id": "disconnected"
            }
          ],
          "then": [
            {
              "service": "notify.mobile_app_ingo_s_pixel_6_pro",
              "continue_on_error": true,
              "data": {
                "message": "Garage Freezer sensor disconnected!"
              }
            },
            {
              "service": "notify.notify",
              "continue_on_error": true,
              "data": {
                "message": "Garage Freezer sensor disconnected!"
              }
            }
          ],
          "alias": "ESP32 Disconnected"
        },
        {
          "service": "notify.mobile_app_ingo_s_pixel_6_pro",
          "continue_on_error": true,
          "data": {
            "message": "{{ trigger.to_state.name }} {{ trigger.to_state.state }}F temperature alert! {{now().strftime(\"%H:%M:%S on %m/%d/%y\")}}"
          }
        },
        {
          "service": "notify.events",
          "continue_on_error": true,
          "data": {
            "message": "{{ trigger.to_state.name }} {{ trigger.to_state.state }}F temperature alert! - {{now().strftime(\"%H:%M:%S on %m/%d/%y\")}}",
            "data": {
              "title": "Freezer Alert!",
              "priority": "highest"
            }
          }
        },
        {
          "service": "media_player.play_media",
          "continue_on_error": true,
          "target": {
            "entity_id": "media_player.kitchen_display"
          },
          "data": {
            "media_content_id": "media-source://tts/cloud?message=++++Temperature+alert+on+%7B%7B+trigger.to_state.name+%7D%7D%2C+it%27s+only+%7B%7B+trigger.to_state.state+%7D%7D+degrees%21++&language=en-US&gender=female",
            "media_content_type": "provider"
          },
          "metadata": {
            "title": "    Temperature alert on {{ trigger.to_state.name }}, it's only {{ trigger.to_state.state }} degrees!  ",
            "thumbnail": "https://brands.home-assistant.io/_/cloud/logo.png",
            "media_class": "app",
            "children_media_class": null,
            "navigateIds": [
              {},
              {
                "media_content_type": "app",
                "media_content_id": "media-source://tts"
              },
              {
                "media_content_type": "provider",
                "media_content_id": "media-source://tts/cloud?message=++++Temperature+alert+on+%7B%7B+trigger.to_state.name+%7D%7D%2C+it%27s+only+%7B%7B+trigger.to_state.state+%7D%7D+degrees%21++&language=en-US&gender=female"
              }
            ]
          },
          "enabled": false
        },
        {
          "service": "tts.cloud_say",
          "continue_on_error": true,
          "data": {
            "message": "Temperature alert on {{ trigger.to_state.name }}, it's only {{ trigger.to_state.state }} degrees!  ",
            "entity_id": "media_player.nesthub8135"
          }
        }
      ],
      "mode": "single"
    },
    "blueprint_inputs": null,
    "context": {
      "id": "01J1D4Z0VF1V4A3CE95MYABNSQ",
      "parent_id": "01J1D4NVWC5EKMFGE08CXY5MV3",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Fridge/Freezer Alarm",
      "message": "triggered by state of binary_sensor.deepfreezer_high_and_rising",
      "source": "state of binary_sensor.deepfreezer_high_and_rising",
      "entity_id": "automation.watch_the_freezers",
      "context_id": "01J1D4Z0VF1V4A3CE95MYABNSQ",
      "when": 1719502078.8320167,
      "domain": "automation"
    }
  ]
}

Either way, now that I know bad Action steps kill the entire automation, and I know that Spook Your Homie can warn me where that will happen, I can clean these up…

continue_on_error only works for the service call itself (if the service returns an error). Your error is saying the service call doesn’t exist, so it doesn’t even get to the point where it could continue_on_error because it’s erroring prior to the service call execution.

Just out of curiosity, from which " binary_sensor " do you get the “Temperature Value” you “attach” in your responses to tts, media-player , notify.events ?

Oh, no need to apologize! :slight_smile: I was just trying to sort things a little. It’s a situation, that should be taken into account, if one writes an automation. So a small warning message in the documentation could help others to avoid such a loss. :slight_smile: And even if it’s only the bulb that shines for no use, it is something we (as in people) should be able to avoid. :slight_smile:

As @petro already said, in your case it’s kinda tricky, as the error doesn’t really come from the automation, so no chance on continuing on error. I’ll have to admit, Spook comes in very handy here. :slight_smile:

I assume, you’re now changing your automation, so let us know, if any problems come up.

If I may make a reading suggestion: take a look at alerts! They’re a very versatile and powerful tool to handle notifications and alarms. Anyway, it looks like you need to think about some kind of error management… :slight_smile: I’m thinking about something like that for years, but have I done one…? :laughing:

What Errors, or error-managements ? :grin:

No idea what you’re talking about??? :rofl: :rofl: :rofl: I don’t have errors in HA, it’s just my home isn’t changed enough to fit HA… :rofl: :joy:

:grin: Right , i was also “reminded” bout that few weeks ago. :joy:

I haven’t actually not looked into Alerts , but as this is the second suggestion i see in few days, i might take a look at that “route” as an “extra” precaution.
im already not a fan of complex/nested automations, involving to many various integrations/Devices…
The simpler the better, in specific from a troubleshooting perspective

Do that! Alerts are really underrated and can do so many cool things! :slight_smile:

1 Like

:bulb: AH!! That explains it!
OK, so basically, I need to pay close attention to Spook, simplify things, and:

Thank you for the tip, it’s hard to keep up, I’ll definitely look at this because so many of my automations are for temperature and water sensors where the main purpose is to alert me of things not working well, so I can fix it before it becomes a real problem!

:cloud_with_lightning: Crap. It seems I have more technical debt in here than I saw. Good point!

Initially, this would alert me when a temperature was above a setpoint. Then somewhere along the way, the automatic defrost cycle gave me alerts I didn’t want, so I added this to lower the noise, but apparently forgot to update the alerts. At least here the trigger value trigger.to_state.state being nonsensical doesn’t crash the rule.

  - binary_sensor:
      - name: "FridgeFreezer High and Rising"
        unique_id: fridgefreezHighAndRising
        delay_on:
          minutes: 5
        state: >
          {{ states('sensor.fridgefreezer_temp')|float > 25 
          and states('sensor.fridgefreezerderivative_temp')|float >= 0 }}

So much technical debt… I need to basically rewrite all my automations with this new knowledge gained over time.

1 Like

Well that doesn’t make your FR less valuable :wink:, and yes the Automation UI have “evolved”, as alot of other changes(regularly) also made people to rewrites scripts, templates, automations, etc.
Your initial Header, and your “claim of loss story” was just not the right way to get attention, in my opinion.

The fact that lots still can go wrong in the UI, as well as in YAML, without “notifications” , still puts a “burden” upon all to check if things work as intended, and not wait until the house burns down :joy:

You could open a “bug-report” for the ( failure due to “missing-service: notify” ) if there’s not already one opened
But maybe it’s “visible” in the logs, which i.e Alerts , or as you found Homie , can Warn about.

Thou i also found it “peculiar” that the “Trigger” don’t react upon the “binary_sensor … above 25”

Don’t ask, this whole home automation thingy should support me, in doing less, but turns out, it’s quite the opposite… :joy: :rofl:

But basically yes, the idea is to know (=calculate) what happens, before it happens. And afterwards have a security net, where you still get notified, when things really break. :slight_smile:

You might want to take a look in this thread as well, it’s a really good implementation of a notification system. It gives a little structure, where you can base your version on.

1 Like