iobroker-community-adapters / ioBroker.device-watcher

Watchdog for adapter/instances and devices/services.
MIT License
19 stars 12 forks source link

Zigbee lights state #12

Closed Headhunter70 closed 2 years ago

Headhunter70 commented 2 years ago

Hi there,

Nice work on that adapter.

I was thinking if it was possible to add states from certain devices like zigbee lights. (on/off). In a second step this states could be written into an array in case of power grid failure. (My iob is connected to an USV). When power is back those states are written back to each zigbee light. Currently my house is shinning like a xmas tree after power failure. :-) Cheers

ciddi89 commented 2 years ago

I will think about it. But one small tip: You can send the zigbee devices like hue a payload. It means you send your lights/smartplugs a message with a setting. Like the recover state after they loosed the electricity. It is some work but you can try it with this javascript. Maybe it will work for you if you have hue lights in your zigbee adapter. Add the id in the script, start the script and turn on/off the lamp or power plug. That's all. After that the device will remember the state before it loosed the power.

const device = ''; //Hier die IEEE ID des Devices eingeben (ohne 0x)

on ({id: 'zigbee.0.' + device + '.state', change: "ne"}, function (obj) {
    sendTo("zigbee.0", "SendToDevice", {
     "device": device,
     "payload": {"hue_power_on_behavior": "recover"}
    }, function(result) {
    if (result.success) {console.log("success")} 
        else console.log("Error " + console.error);
});  
})
Headhunter70 commented 2 years ago

very true, what you saying. I used that for some Ikea bulbs and put the "power on behaviour" to previous, so my expectation was that the bulb itself will know the latest setiings, however that is not really working all the time hence the idea with your adapter :-)