Notifications if devices go offline

Hi all,

I’d like to setup an automation that sends out a notification if a device goes offline, like a WeMo Insight switch, for example. I see that error entries show up in the log if I unplug the switch so HA knows it can’t communicate with the device but I’m not sure what the best strategy is for surfacing that information.

My first instinct was to use a RESTful sensor but before diving down that rabbit hole I wanted to see if anyone in the community has come up with a simpler solution.

I am doing this with my setup by checking if the state changes to unavailable I have never had problems with my wemo so I am not sure if that is setup, but it is for wink, aREST, and many others. If your wemo doesnt change its state to unavailable when this happens, sound like it should be fixed in code so that it does. Maybe open an issue?

I’m using device trackers, TP-Link and NMAP. Plus the telegram bot for notifications.

- alias: Electricity Detection
  hide_entity: false
    platform: state
    entity_id: device_tracker.macAddress
    state: 'not_home'
    - service: notify.hassnotifier
        message: No electricity at home!

Is it against the rules to mention a non-Home Assistant solution? :wink: I’m using a simple bash script to monitor devices or server-type apps based on port usage. If the specific port is in use, then the assumption is that the app or device is up. If the port isn’t being used, then it’s assumed to be down.

Then if the device is considered down, the script will try to reboot it and send me a growl notification about what specifically is down and if it was rebooted correctly. This way I get more real-time notifications (as I’ve never gotten the hass notifications to work). Hope that helps!

I like this and may be using it for a troublesome camera that seems to need re-booting occasionally. Is there a way to have it not trigger unless the device is offline/not home for a specified period of time? say 1 minute? Sometimes HASS is slow to update and I do not want it to get stuck in a loop .

I’ll be using this to turn off and then back on a z-wave switch of which the camera is plugged into.

I think what you need is the state condition with “for x time”