Offline causes chaos

Hello. I have recently had two issues related to devices becoming unexpectedly offline.

My problem is: In both cases, it was not obvious that these devices went offline even though they prevented an important automation from working correctly.

In one case, I have 4 smart lights that turn on when I detect motion with a camera. One of the devices (a light) went offline. Instead of there being any kind of error or obvious sign of trouble, the automation just stopped working for all four lights.

More disturbingly, one of my cameras went offline, and so a script that includes all of my cameras no longer functions (without any obvious signs of trouble).

My question is this: Does anyone have any ideas on either:

  1. A way for me to program around this and say “only run this code if a device is online, skip it if not”

or

  1. A way to write a “device checker” that can alert me if a key entity or device is offline without invalidating the device checking script.

Any ideas?

  1. you can adde continue on error in steps of your automation

Script Syntax - Home Assistant.

  1. you an create an automation checking state, unknows/unavavailble.
1 Like

Thanks to all. I’m going to take both of the solutions above: Error handling and regularly checking the state of key devices.