How to send a notification for a no more électricaly supplied device

Fibaro is z-wave?
This script is for zigbee, but can inspire to rewrite it as z-wave device-offline-check script maybe