So I have a few somewhat critical smart plugs which should be monitored.
Real time alert = both app HA notification and e-mail
context: my main router, 4G backup modem and cable modem are on a UPS so in 99% of the time I should have working internet.
What I’d like to achieve:
to get a real time (or near real time) notification if a Zigbee device, in this case an Ikea smart plug, has not responded to a (on/off) command. I can see HA complaining if this happens (I unplugged the plug before sending a command to verify) so I assume this is actionable?
To get a notification if the devices goes offline irregardless of a command having been sent. I see state changes after about 3 minutes (I changed a timer somewhere) so again I assume this is actionable.
But I don’t know where to start and I’d appreciate your help.
I assume you have an automation that is changing the state of the plug ?
If so, let the automation change the state, then add a wait, then check the state of the plug with a condition. If its not changed, get the automation to send you a notification.
But then I found Generic Thermostat - Home Assistant as the plug controls an electric heater which keeps certain pipes and liquids from freezing over in winter. This does not seem to be an automation but something special so I’m not sure how to get it to “retry” and “notify”
I use the generic thermostat as well. You can write an automation that triggers on the change of the switch, but I guess if the switch is the thing that might fail, thats no good. So you might have to instead look at the parameters that make the switch toggle, and write an automation that triggers based on that. But at this point, its getting messy, and I wonder whether your time might be better served working out why you have the issue on your network (mine almost never suffers from this).
@Rofo I’m learning somewhat quickly (I think haha). I choose a less busy channel for zigbee and located the coordinator more favourably. However, I strongly err on the side of caution and created the monitor check:
alias: Check availibility smart plug tuinhuisje
description: Warn if smart plug offline for more than 10 minutes
triggers:
- trigger: state
entity_id:
- switch.ikea_of_sweden_tretakt_smart_plug_switch_tuinhuis
from: null
to: unavailable
for:
hours: 0
minutes: 10
seconds: 0
conditions: []
actions:
- action: notify.mobile_app_smartphone
data:
title: Warning
message: Smart plug tuinhuisje offline for 10 minutes
mode: single
However, there is another threat. If generic thermostat is unable to turn on the smart plug at the moment in time when the temperature drops below the threshold for it to switch on the smart plug, it sits idle. I’m now trying to get HA do a periodic check to correct this condition but it would need to run periodic like a cron job.
The cron job should read the temp sensor temperature, the plug state (on/off) and the temperature generic thermostat is must switch the heating( so smart plug) on. If the sensor temp is below that AND the plug is still off, we have an invalid state and generic thermostat must be forced on and subsequently it will turn on the plug/heating.