How to check if a device is powered in ZHA?

I have my Hot Water Cylinder connected to a Zigbee power module (a PDL/Schneider Wiser module, 356PB10MBT-VW) so that I can turn it off during peak hours and have it come back on during off peak.

This is working well, except for one scenario. In New Zealand, it’s pretty common for hot water circuits to be on Ripple Control, so that the power company can shed load during high usage periods (like during winter). Essentially, this turns off power to the HWC at the breaker board and in my case, the zigbee module.

When this happens, I’ve noticed that the zigbee module does not report itself as unavailable but if you try send a command to it while it’s powered off, it eventually errors with “Failed to deliver message: <EmberStatus.DELIVERY_FAILED: 102>”. The last few nights, my HWC has been powered off by ripple control as the offpeak automation I have wants to turn it on. I did try Retry which seems to skip straight to the failure step when it first encounters this issue, despite adding a 300 second grace period between failures - it does at least notify me so I can manually monitor and turn it on so I don’t have a cold shower later :slight_smile:

Is there a way with ZHA that I can check that the device is currently online and powered so I can use that as a trigger?