How to set powerSouce setting when system reboots using a User driver including @bcopeland's
Tested with a Gen2 using a C4 Hub, YMMV
in metadata add
capability "Initialize"
Before refresh method (or wherever you prefer) insert:
void initialize() {
/* current state return a requested power management response. failing command issues a x'00' */
def cmds = []
cmds << zwave.notificationV3.notificationGet(notificationType: 8, v1AlarmType: 0, event: 0x03) //on mains?
cmds << zwave.notificationV3.notificationGet(notificationType: 8, v1AlarmType: 0, event: 0x02) //on battery?
sendToDevice(cmds)
}
Update :
should you be using a driver other than bcopeland's, change:
sendToDevice(cmds)
to
sendHubCommand(new hubitat.device.HubMultiAction(commands(cmds), hubitat.device.Protocol.ZWAVE))