ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
902 stars 91 forks source link

Realtime state of Hue controlled by TRADFRI remote #359

Closed aryelevin closed 6 years ago

aryelevin commented 6 years ago

Issue

When using TRADFRI remote to control Hue (E14 color), their state is not updated on Homekit. Am I missing something?

Log Messages

Debug Files

ebaauw commented 6 years ago

Is the light state updated in the Phoscon app or in the old web app? Do you update the lights through gateway rules, or did you add them to the remote’s group? What version of deCONZ are you on? When you change the light through the API or Phoscon app or old web app, is that reflected in HomeKit?

aryelevin commented 6 years ago

Hi @ebaauw ,

Thanks for your quick reply first of all. OK, so, my light is in the group of the remote, so this is how I manage the light to work with the remote. I don't know exactly how to make the rules on the gateway. I'm using Phoscon app, and once I'm updating the light from there, it is reflected on Homekit. I'm on deCONZ v2.05.31 (Latest).

Anything you might think about this issue?

Again, thank you so much

aryelevin commented 6 years ago

In addition, when using the remote, then in the Phoscon app it is not updated.

ebaauw commented 6 years ago

It would seem that deCONZ doesn’t update its cache of the light states when the remote controls the lights in the group. As Hue lights don’t do attribute reporting, you’ll have to wait for deCONZ to poll the lights before it will reflect the actual light state. Depending on the number of lights in your network, this might take anywhere from 1 second to 1 minute.

deCONZ should eavesdrop on the communication between the remote and the group. Could you please double-check the the lastupdated attribute of the remote’s ZHASwitch sensor resource is indeed updated when pressing a button? The remote sends a Toggle command, I’m not sure if deCONZ actually uses that to invert the light states.

If you were to use gateway rules instead of/in addition to the group, deCONZ would send out a group command to control the lights itself, for which it does update the light states. These rules are created through the REST API, see http://dresden-elektronik.github.io/deconz-rest-doc/rules/. I use the phcommand from homebridge-hue-utils to interact with the API. I’ve scripted most of my rules, see https://github.com/ebaauw/ph.sh.

aryelevin commented 6 years ago

When I press remote's buttons I see the it jumps on the home app, so it being reported to Homekit. If it is OK, I'm more than happy to use rules instead group. Would it behave as it is when using group? in terms of response speed, and functionality (brightness/colour)?

Do you know if this is gonna fixed on the deCONZ side anytime? Will this issue will be happened with other ZB bulbs?

Another question, how can I solve the issue which cause my lights to turn on after power failure? I can code it, but where is the trigger which tells me the light is powered back?

Another question (Sorry if I'm making this too long, and thanks!!!), Can you provide me an example on how would I set my lights to not get lost from Homekit after power cycle of the deconz SW? It wasn't clear to mean how should I do this...

Again, thank you so much.

aryelevin commented 6 years ago

BTW, for your records, here's what I get with your ph: { "config": { "UTC": "2018-07-11T18:37:41", "apiversion": "1.0.9", "backup": { "errorcode": 0, "status": "idle" }, "bridgeid": "00212EFFFF0178F2", "datastoreversion": "60", "devicename": "RaspBee", "dhcp": true, "factorynew": false, "fwversion": "0x261f0500", "gateway": "192.168.1.1", "internetservices": { "remoteaccess": "disconnected" }, "ipaddress": "192.168.1.39", "linkbutton": false, "localtime": "2018-07-11T21:37:41", "mac": "b8:27:eb:3c:a3:88", "modelid": "deCONZ", "name": "Phoscon-GW", "netmask": "255.255.255.0", "networkopenduration": 60, "panid": 11055, "portalconnection": "disconnected", "portalservices": false, "portalstate": { "communication": "disconnected", "incoming": false, "outgoing": false, "signedon": false }, "proxyaddress": "none", "proxyport": 0, "replacesbridgeid": null, "rfconnected": true, "starterkitid": "", "swupdate": { "checkforupdate": false, "devicetypes": { "bridge": false, "lights": [], "sensors": [] }, "notify": false, "text": "", "updatestate": 0, "url": "" }, "swupdate2": { "autoinstall": { "on": false, "updatetime": "" }, "bridge": { "lastinstall": "", "state": "allreadytoinstall" }, "checkforupdate": false, "install": false, "lastchange": "", "lastinstall": "", "state": "allreadytoinstall" }, "swversion": "2.5.31", "timeformat": "12h", "timezone": "Etc/GMT-3", "uuid": "9afe6e50-8aa4-495b-b380-8382e9590201", "websocketnotifyall": true, "websocketport": 443, "whitelist": { "0D86929499": { "create date": "2018-06-29T15:06:53", "last use date": "2018-07-11T18:37:37", "name": "homebridge-hue#raspberrypi" }, "3578ACBA1E": { "create date": "2018-07-11T18:35:47", "last use date": "2018-07-11T18:37:41", "name": "ph#raspberrypi" }, "570DAC2806": { "create date": "2018-07-01T01:01:38", "last use date": "2018-07-03T18:25:33", "name": "Phoscon#B1024x653" }, "99D2ADF803": { "create date": "2018-06-29T14:59:44", "last use date": "2018-07-11T18:37:24", "name": "Phoscon#B1324x885" } }, "zigbeechannel": 25 }, "groups": { "1": { "action": { "bri": 127, "colormode": "hs", "ct": 0, "effect": "none", "hue": 0, "on": false, "sat": 127, "scene": null, "xy": [ 0, 0 ] }, "class": "Other", "devicemembership": [], "etag": "888dcc13bc8b82dd21a25632c1a198b3", "hidden": false, "id": "1", "lights": [ "1" ], "lightsequence": [], "multideviceids": [], "name": "Group 1", "scenes": [], "state": { "all_on": false, "any_on": false }, "type": "LightGroup" }, "2": { "action": { "bri": 127, "colormode": "hs", "ct": 0, "effect": "none", "hue": 0, "on": false, "sat": 127, "scene": null, "xy": [ 0, 0 ] }, "class": "Other", "devicemembership": [], "etag": "779c414645f4be4200e772650d1b33d6", "hidden": false, "id": "2", "lights": [ "2", "3", "4" ], "lightsequence": [], "multideviceids": [], "name": "House Entry Candelabra", "scenes": [], "state": { "all_on": true, "any_on": true }, "type": "LightGroup" }, "3": { "action": { "bri": 127, "colormode": "hs", "ct": 0, "effect": "none", "hue": 0, "on": false, "sat": 127, "scene": null, "xy": [ 0, 0 ] }, "class": "Other", "devicemembership": [], "etag": "ab6432cb8d47f408dd93a86e70fb7d3f", "hidden": false, "id": "3", "lights": [ "5" ], "lightsequence": [], "multideviceids": [], "name": "Test Group", "scenes": [], "state": { "all_on": true, "any_on": true }, "type": "LightGroup" }, "12884": { "action": { "bri": 127, "colormode": "ct", "ct": 0, "effect": "none", "hue": 0, "on": false, "sat": 127, "scene": null, "xy": [ 0, 0 ] }, "class": "Other", "devicemembership": [ "8" ], "etag": "f49fa65b821d67468f1a4a3eb5015f25", "hidden": false, "id": "12884", "lights": [ "5" ], "lightsequence": [], "multideviceids": [], "name": "TRADFRI remote control 8", "scenes": [], "state": { "all_on": true, "any_on": true }, "type": "LightGroup" }, "27265": { "action": { "bri": 127, "colormode": "hs", "ct": 0, "effect": "none", "hue": 0, "on": false, "sat": 127, "scene": null, "xy": [ 0, 0 ] }, "class": "Other", "devicemembership": [ "5" ], "etag": "779c414645f4be4200e772650d1b33d6", "hidden": false, "id": "27265", "lights": [ "2", "3", "4" ], "lightsequence": [], "multideviceids": [], "name": "TRADFRI remote control 5", "scenes": [], "state": { "all_on": true, "any_on": true }, "type": "LightGroup" }, "46483": { "action": { "bri": 127, "colormode": "hs", "ct": 0, "effect": "none", "hue": 0, "on": false, "sat": 127, "scene": null, "xy": [ 0, 0 ] }, "class": "Other", "devicemembership": [ "7" ], "etag": "888dcc13bc8b82dd21a25632c1a198b3", "hidden": false, "id": "46483", "lights": [], "lightsequence": [], "multideviceids": [], "name": "TRADFRI remote control 7", "scenes": [], "state": { "all_on": false, "any_on": false }, "type": "LightGroup" }, "58307": { "action": { "bri": 127, "colormode": "hs", "ct": 0, "effect": "none", "hue": 0, "on": false, "sat": 127, "scene": null, "xy": [ 0, 0 ] }, "class": "Other", "devicemembership": [ "6" ], "etag": "888dcc13bc8b82dd21a25632c1a198b3", "hidden": false, "id": "58307", "lights": [], "lightsequence": [], "multideviceids": [], "name": "TRADFRI remote control 6", "scenes": [], "state": { "all_on": false, "any_on": false }, "type": "LightGroup" } }, "lights": { "1": { "etag": "7aac1f05f6118f99dd1aba9ee7f56a5d", "hascolor": false, "manufacturername": "ubisys", "modelid": "D1 (5503)", "name": "Light 1", "state": { "alert": "none", "bri": 254, "on": false, "reachable": true }, "swversion": null, "type": "Dimmable light", "uniqueid": "00:1f:ee:00:00:00:2b:d7-01" }, "2": { "ctmax": 500, "ctmin": 153, "etag": "84d680909cba2cd39fcbbf8b991fa9d6", "hascolor": true, "manufacturername": "Philips", "modelid": "LCT012", "name": "Light 2", "state": { "alert": "none", "bri": 254, "colormode": "ct", "ct": 410, "effect": "none", "hue": 8023, "on": true, "reachable": true, "sat": 176, "xy": [ 0.484597, 0.416014 ] }, "swversion": "1.15.2_r19181", "type": "Extended color light", "uniqueid": "00:17:88:01:03:b8:35:2b-0b" }, "3": { "ctmax": 500, "ctmin": 153, "etag": "84d680909cba2cd39fcbbf8b991fa9d6", "hascolor": true, "manufacturername": "Philips", "modelid": "LCT012", "name": "Light 3", "state": { "alert": "none", "bri": 254, "colormode": "ct", "ct": 410, "effect": "none", "hue": 8023, "on": true, "reachable": true, "sat": 176, "xy": [ 0.484597, 0.416014 ] }, "swversion": "1.15.2_r19181", "type": "Extended color light", "uniqueid": "00:17:88:01:03:b8:35:30-0b" }, "4": { "ctmax": 500, "ctmin": 153, "etag": "279a7a8f95d3f17702e3b6a9cc364b65", "hascolor": true, "manufacturername": "Philips", "modelid": "LCT012", "name": "Light 4", "state": { "alert": "none", "bri": 254, "colormode": "ct", "ct": 410, "effect": "none", "hue": 8023, "on": true, "reachable": true, "sat": 176, "xy": [ 0.484597, 0.416014 ] }, "swversion": "1.15.2_r19181", "type": "Extended color light", "uniqueid": "00:17:88:01:03:ba:12:b3-0b" }, "5": { "ctmax": 500, "ctmin": 153, "etag": "59ebff1391bab293208958c46e953e6a", "hascolor": true, "manufacturername": "Philips", "modelid": "LCT012", "name": "Light 5", "state": { "alert": "none", "bri": 250, "colormode": "ct", "ct": 334, "effect": "none", "hue": 8418, "on": true, "reachable": true, "sat": 140, "xy": [ 0.459137, 0.411633 ] }, "swversion": "1.15.2_r19181", "type": "Extended color light", "uniqueid": "00:17:88:01:03:ba:13:0c-0b" } }, "resourcelinks": {}, "rules": { "1": { "actions": [ { "address": "/groups/27265/action", "body": { "ct_inc": -32, "transitiontime": 4 }, "method": "PUT" } ], "conditions": [ { "address": "/sensors/5/state/buttonevent", "operator": "eq", "value": "4002" }, { "address": "/sensors/5/state/lastupdated", "operator": "dx" } ], "created": "2018-07-10T15:09:59", "etag": "888dcc13bc8b82dd21a25632c1a198b3", "lasttriggered": "none", "name": "default-ct-cw-5", "owner": "deCONZ", "periodic": 0, "status": "enabled", "timestriggered": 0 }, "2": { "actions": [ { "address": "/groups/27265/action", "body": { "ct_inc": 32, "transitiontime": 4 }, "method": "PUT" } ], "conditions": [ { "address": "/sensors/5/state/buttonevent", "operator": "eq", "value": "5002" }, { "address": "/sensors/5/state/lastupdated", "operator": "dx" } ], "created": "2018-07-10T15:09:59", "etag": "888dcc13bc8b82dd21a25632c1a198b3", "lasttriggered": "none", "name": "default-ct-ww-5", "owner": "deCONZ", "periodic": 0, "status": "enabled", "timestriggered": 0 }, "5": { "actions": [ { "address": "/groups/46483/action", "body": { "ct_inc": -32, "transitiontime": 4 }, "method": "PUT" } ], "conditions": [ { "address": "/sensors/7/state/buttonevent", "operator": "eq", "value": "4002" }, { "address": "/sensors/7/state/lastupdated", "operator": "dx" } ], "created": "2018-07-10T21:20:14", "etag": "888dcc13bc8b82dd21a25632c1a198b3", "lasttriggered": "none", "name": "default-ct-cw-7", "owner": "deCONZ", "periodic": 0, "status": "enabled", "timestriggered": 0 }, "6": { "actions": [ { "address": "/groups/46483/action", "body": { "ct_inc": 32, "transitiontime": 4 }, "method": "PUT" } ], "conditions": [ { "address": "/sensors/7/state/buttonevent", "operator": "eq", "value": "5002" }, { "address": "/sensors/7/state/lastupdated", "operator": "dx" } ], "created": "2018-07-10T21:20:14", "etag": "888dcc13bc8b82dd21a25632c1a198b3", "lasttriggered": "none", "name": "default-ct-ww-7", "owner": "deCONZ", "periodic": 0, "status": "enabled", "timestriggered": 0 }, "7": { "actions": [ { "address": "/groups/12884/action", "body": { "ct_inc": -32, "transitiontime": 4 }, "method": "PUT" } ], "conditions": [ { "address": "/sensors/8/state/buttonevent", "operator": "eq", "value": "4002" }, { "address": "/sensors/8/state/lastupdated", "operator": "dx" } ], "created": "2018-07-10T21:21:39", "etag": "f3c55d7f8aa3e7c6f530f2512488afc8", "lasttriggered": "2018-07-11T18:24:35", "name": "default-ct-cw-8", "owner": "deCONZ", "periodic": 0, "status": "enabled", "timestriggered": 8 }, "8": { "actions": [ { "address": "/groups/12884/action", "body": { "ct_inc": 32, "transitiontime": 4 }, "method": "PUT" } ], "conditions": [ { "address": "/sensors/8/state/buttonevent", "operator": "eq", "value": "5002" }, { "address": "/sensors/8/state/lastupdated", "operator": "dx" } ], "created": "2018-07-10T21:21:39", "etag": "59ebff1391bab293208958c46e953e6a", "lasttriggered": "2018-07-11T18:24:40", "name": "default-ct-ww-8", "owner": "deCONZ", "periodic": 0, "status": "enabled", "timestriggered": 7 }, "9": { "actions": [ { "address": "/groups/58307/action", "body": { "ct_inc": -32, "transitiontime": 4 }, "method": "PUT" } ], "conditions": [ { "address": "/sensors/6/state/buttonevent", "operator": "eq", "value": "4002" }, { "address": "/sensors/6/state/lastupdated", "operator": "dx" } ], "created": "2018-07-11T14:51:40", "etag": "888dcc13bc8b82dd21a25632c1a198b3", "lasttriggered": "none", "name": "default-ct-cw-6", "owner": "deCONZ", "periodic": 0, "status": "enabled", "timestriggered": 0 }, "10": { "actions": [ { "address": "/groups/58307/action", "body": { "ct_inc": 32, "transitiontime": 4 }, "method": "PUT" } ], "conditions": [ { "address": "/sensors/6/state/buttonevent", "operator": "eq", "value": "5002" }, { "address": "/sensors/6/state/lastupdated", "operator": "dx" } ], "created": "2018-07-11T14:51:40", "etag": "888dcc13bc8b82dd21a25632c1a198b3", "lasttriggered": "none", "name": "default-ct-ww-6", "owner": "deCONZ", "periodic": 0, "status": "enabled", "timestriggered": 0 } }, "schedules": {}, "sensors": { "1": { "config": { "configured": true, "on": true, "sunriseoffset": 30, "sunsetoffset": -30 }, "etag": "888dcc13bc8b82dd21a25632c1a198b3", "manufacturername": "Philips", "modelid": "PHDL00", "name": "Daylight", "state": { "dark": true, "daylight": false, "lastupdated": "2018-07-11T18:29:14", "status": 230 }, "swversion": "1.0", "type": "Daylight", "uniqueid": "00:21:2e:ff:ff:01:78:f2-01" }, "2": { "config": { "group": null, "mode": "momentary", "on": true, "reachable": true }, "ep": 2, "etag": "7aac1f05f6118f99dd1aba9ee7f56a5d", "manufacturername": "ubisys", "mode": 1, "modelid": "D1 (5503)", "name": "Switch 2", "state": { "buttonevent": null, "lastupdated": "none" }, "type": "ZHASwitch", "uniqueid": "00:1f:ee:00:00:00:2b:d7-02-0006" }, "3": { "config": { "on": true, "reachable": true }, "ep": 4, "etag": "d99c8f648b2b01080a7486b324fb3470", "manufacturername": "ubisys", "modelid": "D1 (5503)", "name": "Consumption 3", "state": { "consumption": 10995, "lastupdated": "2018-07-11T18:37:14", "power": 0 }, "type": "ZHAConsumption", "uniqueid": "00:1f:ee:00:00:00:2b:d7-04-0702" }, "4": { "config": { "on": true, "reachable": true }, "ep": 4, "etag": "6a3ab93e5b694f400cc900674d0a66f7", "manufacturername": "ubisys", "modelid": "D1 (5503)", "name": "Power 4", "state": { "current": 40, "lastupdated": "2018-07-11T18:37:24", "power": 0, "voltage": 230 }, "type": "ZHAPower", "uniqueid": "00:1f:ee:00:00:00:2b:d7-04-0b04" }, "5": { "config": { "alert": "none", "battery": 87, "group": "27265", "on": true, "reachable": true }, "ep": 1, "etag": "05a1880bd9b7ff2cca434cf1fff0c259", "manufacturername": "IKEA of Sweden", "mode": 3, "modelid": "TRADFRI remote control", "name": "TRÅDFRI remote control", "state": { "buttonevent": 1002, "lastupdated": "2018-07-11T16:32:56" }, "swversion": "1.1.1.1-5.7.2.0", "type": "ZHASwitch", "uniqueid": "00:0b:57:ff:fe:bb:15:62-01-1000" }, "6": { "config": { "alert": "none", "battery": 100, "group": "58307", "on": true, "reachable": true }, "ep": 1, "etag": "a4cbe8d803912c6762a498462121087a", "manufacturername": "IKEA of Sweden", "mode": 3, "modelid": "TRADFRI remote control", "name": "TRÅDFRI remote control (2)", "state": { "buttonevent": 1001, "lastupdated": "2018-07-11T14:51:40" }, "swversion": "1.1.1.1-5.7.2.0", "type": "ZHASwitch", "uniqueid": "00:0b:57:ff:fe:bd:d5:dc-01-1000" }, "7": { "config": { "alert": "none", "battery": 100, "group": "46483", "on": true, "reachable": true }, "ep": 1, "etag": "1dc11ffcebc742af602ef2848db2a96c", "manufacturername": "IKEA of Sweden", "mode": 3, "modelid": "TRADFRI remote control", "name": "TRÅDFRI remote control (3)", "state": { "buttonevent": 1002, "lastupdated": "2018-07-11T14:51:36" }, "swversion": "1.1.1.1-5.7.2.0", "type": "ZHASwitch", "uniqueid": "00:0b:57:ff:fe:b1:fc:95-01-1000" }, "8": { "config": { "alert": "none", "battery": 100, "group": "12884", "on": true, "reachable": true }, "ep": 1, "etag": "5c6ad0505fc235d528bf9fb098987800", "manufacturername": "IKEA of Sweden", "mode": 3, "modelid": "TRADFRI remote control", "name": "TRÅDFRI remote control (4)", "state": { "buttonevent": 1002, "lastupdated": "2018-07-11T18:24:47" }, "swversion": "1.1.1.1-5.7.2.0", "type": "ZHASwitch", "uniqueid": "00:0b:57:ff:fe:bd:e3:16-01-1000" } } }

aryelevin commented 6 years ago

For me it seems that deCONZ are automatically setup the rules, since it seems to be configured already. Is that possible? Am I missing something? If the rules are set, then why Homekit is not updated?

ebaauw commented 6 years ago

Would it behave as it is when using group? in terms of response speed, and functionality (brightness/colour)?

In theory there's a bit of a delay (10s-100s of ms), because now the sensor command is sent to the RaspBee, and the RaspBee sends a new command to the light. In practice, you'll hardly notice. Functionally, rules are far more flexible. I'm actually using both groups and gateway rules for my Hue dimmer switches, so I can still control my lights when deCONZ is down. Alternatively, you can use HomeKit automations, but be careful when controlling a larger number of lights from a single HomeKit scene: this might cause delays in response times. I'm actually using my Trådfri remotes to control my Sonos speakers through HomeKit automations.

Do you know if this is gonna fixed on the deCONZ side anytime?

Best open an issue with deCONZ. @manup started implementing a fast-poll of the lights in a group, when receiving a group or scene command, but that's not yet working. Currently, light states are updated only for On and Off commands and on recalling scenes (I checked the code - not on Toggle, nor on Level commands).

Will this issue will be happened with other ZB bulbs?

Depends on the bulb: if it reports attribute reporting (IKEA, OSRAM), the state will be updated immediately when the light reports its new state. If it doesn't (Philips, innr), you'll have to wait for the next polling cycle (which in my test even longer than a minute - there's still something rotten in the poll manager).

how can I solve the issue which cause my lights to turn on after power failure? I can code it, but where is the trigger which tells me the light is powered back?

Effectively, there's no trigger to tell you when a light is powered back. You cannot set rules on state.reachable, and even if you could, it would take quite some time before deCONZ reports it as false, so you wouldn't even register a brief power cycle. See #41.

However, when you have a power failure, deCONZ restarts: that's recognised easily, see https://github.com/ebaauw/ph.sh/blob/9ee46f9a3fde586c8306941e4f6a36f748024fdb/ph_rules.sh#L306. Alternatively, you could implement an el-cheapo UPS for your Raspberry using a pass-through USB power bank, see https://github.com/ebaauw/homebridge-hue/issues/41#issuecomment-387698046.

Can you provide me an example on how would I set my lights to not get lost from Homekit after power cycle of the deconz SW? It wasn't clear to mean how should I do this...

Run ph lightlist once all your lights have been discovered, and homebridge-hue will delay starting up homebridge, until all lights are available. See #246.

For me it seems that deCONZ are automatically setup the rules, since it seems to be configured already. If the rules are set, then why Homekit is not updated?

Only for the change in colour temperature (Next and Previous buttons or buttonevents 5002 and 4002). You need to setup rules for the other buttons. For the On/Off button you'll need two rules, each with an additional condition on the light or group state (not very reliable) or on a CLIPGenericFlag to turn the lights on when they're off or off when they're on. The REST API doesn't have a toggle command.

aryelevin commented 6 years ago

Aha, I see the point. deCONZ create rules for the color temp actions, since it is a kind of custom to the TRADFRI remote, and after checking in the Phoscon app, it gets updated when im changing the ct using the remote. OK, so I've got the idea.

aryelevin commented 6 years ago

If the bulb was off by ZB, and a power outage happened, and then returns, isn't the bulb report its new power on state to the ZB network?

ebaauw commented 6 years ago

BTW, for your records, here's what I get with your ph

Only five lights - polling should be relatively fast. The ubisys D1 does support attribute reporting - if you'd control that from the remote, you should see its state updated in HomeKit.

aryelevin commented 6 years ago

I'm using my ubisys only for testing now, since they have an issue with some led bulbs that even on power off, the bulbs are glowing, which is annoying.

aryelevin commented 6 years ago

Is the double action of using rules and group together makes issues? such as increasing the brightness twice? And for my previous question, If the bulb was powered off by ZB, and a power outage happened, and then returns, isn't the bulb report its new power on state to the ZB network?

ebaauw commented 6 years ago

Is the double action of using rules and group together makes issues? such as increasing the brightness twice?

You're right. You need idempotent commands. I only implemented On and Off in rules, and use only the group for brightness increase/decrease. For Toggle and On or Off, you'd really need a CLIPGenericFlag to keep track of the current state.

If the bulb was powered off by ZB, and a power outage happened, and then returns, isn't the bulb report its new power on state to the ZB network?

Again, this depends on whether the bulb supports attribute reporting. Philips lights will only announce their presence on the network (which only sets state.reachable to true, which cannot be used in rules). If lucky, deCONZ fast polls the light on receiving the announcement, but that will probably take too long for comfort. Try with your traditional wall switch to see how Phoscon reacts to power cycles. Even then, you cannot recognise in the API whether the light was turned on by a traditional wall switch, by a power restore, or by another app.

aryelevin commented 6 years ago

First I want to thank you again for your support.

Now to the point. I don't really know what CLIPGenericFlag is, can you explain me a bit more?

As for the power outage stuff, if I will use Homekit to control the lights (or even customise your Homebridge plugin to do it regardless Homekit itself), then once I see "power on" state from outside of my loop, I will be able to know it is a outage restore. Do you think about some other issues which might occur this way?

(I used to do it with my lifx bulbs, so after a few seconds which wifi connection completed, they go off to their last state. In addition, I built my flic plugin which toggled the bulbs power regardless Homekit loop.)

Do you know about a good ZigBee (tunable whites, but I prefer full color) bulbs with lumen output above 1000 lm? (I know the Ikea tradfri 980lm)

aryelevin commented 6 years ago

I see now another issue. When I change the color from Homekit, it Is not applied until is toggle the power of the bulb.

ebaauw commented 6 years ago

I don't really know what CLIPGenericFlag is, can you explain me a bit more?

See https://github.com/ebaauw/homebridge-hue/wiki/Getting-Started#24-clip-sensors. I still need to re-organise the Wiki...

As for the power outage stuff, if I will use Homekit to control the lights (or even customise your Homebridge plugin to do it regardless Homekit itself), then once I see "power on" state from outside of my loop, I will be able to know it is a outage restore. Do you think about some other issues which might occur this way?

If you only control your lights from HomeKit it'll work. Once you'll be using motion sensors, schedules, remotes, other apps to control your lights it won't. See the scenarios in #41.

Do you know about a good ZigBee (tunable whites, but I prefer full color) bulbs with lumen output above 1000 lm? (I know the Ikea tradfri 980lm)

No, sorry.

When I change the color from Homekit, it Is not applied until is toggle the power of the bulb.

What HomeKit app? What does the homebridge-hue log say? You cannot change colour (or brightness or colour temperature) while the light is off (this is a ZigBee limitation).

aryelevin commented 6 years ago

I'm using the Home app from the App Store and Apple's home app. I'm trying to set the color while the light is powered on. This is the log from the Homebridge-hue: [2018-7-11 23:20:53] [Phillips Hue] Light 5: homekit color temperature changed from 468 mired to 342 mired [2018-7-11 23:20:53] [Phillips Hue] Light 5: homekit color temperature changed from 342 mired to 184 mired [2018-7-11 23:20:54] [Phillips Hue] Light 5: homekit color temperature changed from 184 mired to 153 mired [2018-7-11 23:20:59] [Phillips Hue] Light 5: homekit color temperature changed from 153 mired to 192 mired [2018-7-11 23:21:01] [Phillips Hue] Light 5: homekit color temperature changed from 192 mired to 266 mired [2018-7-11 23:21:01] [Phillips Hue] Light 5: homekit color temperature changed from 266 mired to 348 mired [2018-7-11 23:21:03] [Phillips Hue] Light 5: homekit color temperature changed from 348 mired to 496 mired [2018-7-11 23:21:03] [Phillips Hue] Light 5: homekit color temperature changed from 496 mired to 464 mired [2018-7-11 23:21:06] [Phillips Hue] Light 5: homekit saturation changed from 75% to 29% [2018-7-11 23:21:06] [Phillips Hue] Light 5: homekit hue changed from 0˚ to 281˚ [2018-7-11 23:21:06] [Phillips Hue] Light 5: homekit saturation changed from 29% to 69% [2018-7-11 23:21:06] [Phillips Hue] Light 5: homekit hue changed from 281˚ to 249˚ [2018-7-11 23:21:10] [Phillips Hue] Light 5: homekit saturation changed from 69% to 2% [2018-7-11 23:21:10] [Phillips Hue] Light 5: homekit hue changed from 249˚ to 205˚ [2018-7-11 23:21:10] [Phillips Hue] Light 5: homekit saturation changed from 2% to 8% [2018-7-11 23:21:10] [Phillips Hue] Light 5: homekit hue changed from 205˚ to 139˚ [2018-7-11 23:21:10] [Phillips Hue] Light 5: homekit saturation changed from 8% to 9% [2018-7-11 23:21:11] [Phillips Hue] Light 5: homekit saturation changed from 9% to 16% [2018-7-11 23:21:11] [Phillips Hue] Light 5: homekit hue changed from 139˚ to 111˚ [2018-7-11 23:21:11] [Phillips Hue] Light 5: homekit saturation changed from 16% to 17% [2018-7-11 23:21:11] [Phillips Hue] Light 5: homekit hue changed from 111˚ to 73˚ [2018-7-11 23:21:12] [Phillips Hue] Light 5: homekit saturation changed from 17% to 22% [2018-7-11 23:21:12] [Phillips Hue] Light 5: homekit hue changed from 73˚ to 46˚ [2018-7-11 23:21:12] [Phillips Hue] Light 5: homekit saturation changed from 22% to 12% [2018-7-11 23:21:12] [Phillips Hue] Light 5: homekit hue changed from 46˚ to 18˚ [2018-7-11 23:21:12] [Phillips Hue] Light 5: homekit saturation changed from 12% to 15% [2018-7-11 23:21:12] [Phillips Hue] Light 5: homekit hue changed from 18˚ to 359˚ [2018-7-11 23:21:12] [Phillips Hue] Light 5: homekit saturation changed from 15% to 16% [2018-7-11 23:21:12] [Phillips Hue] Light 5: homekit hue changed from 359˚ to 354˚ [2018-7-11 23:21:14] [Phillips Hue] Light 5: homekit saturation changed from 16% to 0% [2018-7-11 23:21:14] [Phillips Hue] Light 5: homekit hue changed from 354˚ to 0˚ [2018-7-11 23:21:14] [Phillips Hue] Light 5: set homekit hue from 0˚ to 222˚ [2018-7-11 23:21:15] [Phillips Hue] Light 5: set homekit hue from 222˚ to 226˚ [2018-7-11 23:21:21] [Phillips Hue] Light 5: homekit saturation changed from 0% to 40% [2018-7-11 23:21:21] [Phillips Hue] Light 5: homekit hue changed from 226˚ to 346˚ [2018-7-11 23:21:22] [Phillips Hue] Light 5: homekit saturation changed from 40% to 70% [2018-7-11 23:21:22] [Phillips Hue] Light 5: homekit hue changed from 346˚ to 8˚ [2018-7-11 23:21:22] [Phillips Hue] Light 5: homekit saturation changed from 70% to 96% [2018-7-11 23:21:22] [Phillips Hue] Light 5: homekit hue changed from 8˚ to 13˚

On all this, the light didn't applied any effect. Only after power toggle it show the new light color (toggle even using the remote). weird.

ebaauw commented 6 years ago

Very odd, I don’t know what’s happening. From the log, Home does send the updates to homebridge / homebridge-hue. I don’t see the toggle, though.

Does this also happen for your other lights? If no, what happens after you power cycle the light. If yes, just to humour me, could you please stop deCONZ, remove and re-insert the ConBee, power cycle all lights and the D1, start deCONZ, restart homebridge, and check whether this still occurs.

If so, could you please attach the debug log file (see https://github.com/ebaauw/homebridge-hue#debug-log-file) and debug dump file (see https://github.com/ebaauw/homebridge-hue#debug-dump-file)?

Not sure if related, but there’s newer firmware available for your lights. Unfortunately, you can only update this through the Hue bridge and Hue app.