ebaauw / homebridge-hue

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

Switch showing correctly in Phoscon but multiple bulbs in Homebridge #1118

Closed tmcmccann closed 1 year ago

tmcmccann commented 1 year ago

Issue

I have a battery powered zigbee, 4 button switch. It gets discovered in Phoscon as a Switch but also 4 lightbulbs!! In Phoscon, the events are captured in the logs too under the Switches filter. But Homebridge picks up the devices as lightbulbs. In the Home App I see a group of 4 bulbs. I've checked other questions and can't find the same issue, but I've looked at the FAQ and see that in the Eve app, the Resource is showing as /Lights/ where I'm guessing it should be Switch or Group? Finally, the Homebridge logs do not log a button press on the switch either, it just seems to ping an update of the status every few minutes

How can I make this switch show as a switch? The other Zigbee switch in Phoscon (different make) works perfectly! I'm stumped

Thanks

Debug Files

homebridge-hue.json.gz

Switch showing correctly Screen Shot 2022-10-17 at 2 28 57 PM

...but also as 4 bulbs! Screen Shot 2022-10-17 at 2 29 52 PM

Events of button press Screen Shot 2022-10-17 at 2 31 42 PM

As bulbs in Homekit Screen Shot 2022-10-17 at 2 33 04 PM

As lights in Eve app Screen Shot 2022-10-17 at 2 37 08 PM

Homebridge Debug Screen Shot 2022-10-17 at 2 38 11 PM

ebaauw commented 1 year ago

I have a battery powered zigbee, 4 button switch. It gets discovered in Phoscon as a Switch but also 4 lightbulbs!!

Please attach the debug dump file. I don't know that type of switch, but apparently deCONZ exposes it using four lights resources (for the four wired outputs) and a ZHASwitch sensors resource for the input buttons. Make sure to set sensors in config.json, and don't exclude ZHASwitch. If you scroll down in Eve, you should see the service for the buttons as well. Is this switch really battery-powered with four output wires? If not, it seems that deCONZ is exposing it wrongly.

In the Home App I see a group of 4 bulbs.

That's not a group; it's a single accessory with four Lightbulb services. Select Show as separate tiles to show each service as separate tile. Hopefully, you get to see a tile for the input buttons then as well, but I'm not sure about iOS 16.

Finally, the Homebridge logs do not log a button press on the switch either, it just seems to ping an update of the status every few minutes

Probably because Homebridge Hue doesn't know what button actions this switch supports. Unfortunately the deCONZ API doesn't expose this, so each wireless switch needs to be whitelisted separately. There should be a warning in the Homebridge log, shortly after startup. If you run Homebridge in DEBUG mode, you should see debug messages for the web socket notifications.

How can I make this switch show as a switch?

Do you mean four stateful, wired switches for the output wires corresponding to the lights resources? Create a switch resourcelink listing the lights resources, see Wiki.

Do you mean a stateless, wireless switch for the input buttons corresponding to the sensors resource? Please tell me what buttonevent values this device supports, and I'll whitelist it.

[17/10/2022, 14:35:39] (Hue) On/Off light 24: set homekit on from false to null
[17/10/2022, 14:35:39] (homebridge-hue] This plugin generated a warning from the characteristic On: characteristic was supplied illegal value: null! Home App will reject null for Apple defined characteristics. See https://ho
mebridge.io/w/JtMGR for more info.

I suspect a deCONZ API bug, where it doesn't report a valid value for state.on (on the lights resource). If the switch is just a wireless switch with four buttons, deCONZ shouldn't expose the lights resources. As a workaround, you could use a blacklist resourcelink to have Homebridge Hue ignore these, but this really should be fixed in deCONZ.

tmcmccann commented 1 year ago

Is this the log dump you need? Struggling to follow the instructions and get to the file - running the Homebridge image on a RPi homebridge.log.txt

Yep - I've set sensors and have not excluded ZHASwitch in the config and there is nothing else at the bottom of that page in the Eve app IMG_5BD5AB963186-1

Is this switch really battery-powered with four output wires?

Yes, here's the switch

Screen Shot 2022-10-17 at 4 14 10 PM Screen Shot 2022-10-17 at 4 14 21 PM

Select Show as separate tiles to show each service as separate tile.

Yes, I can show as 4 separate tiles, but they are still lightbulbs so I'm not sure if that really helps? Does that help debug the issue?

Do you mean four stateful, wired switches for the output wires corresponding to the lights resources?

This is what one of my other Zigbee switches behaves like - buttons with options/triggers for single/double/long press. This is the exact same behaviour I'd like? working_switch

Please tell me what buttonevent values this device supports, and I'll whitelist it.

Do you mean support for Single/Double/Long etc? Here's the actual link to the switch I bought - Ajax Online Zignito 4 Gang Wireless Multifunction Wall Scene Switch

I suspect a deCONZ API bug, where it doesn't report a valid value for state.on (on the lights resource). If the switch is just a wireless switch with four buttons, deCONZ shouldn't expose the lights resources. As a workaround, you could use a blacklist resourcelink to have Homebridge Hue ignore these, but this really should be fixed in deCONZ.

I'm a bit confused on what you mean here? Is there a solution to this problem do you think?

Thanks so much for the help, this one has be totally lost - please let me know if there is anything else I can provide to help solve it

tmcmccann commented 1 year ago

Config for reference Screen Shot 2022-10-17 at 5 20 48 PM

ebaauw commented 1 year ago

Is this the log dump you need?

That is the log file. Also useful, but I was looking for the dump file that Homebridge Hue creates on startup. You should be able to download it through the UI settings.

there is nothing else at the bottom of that page in the Eve app

Weird, it does show the battery, so Homebridge Hue did consider the sensors resource. It didn't expose the buttons, since it doesn't know how (see also the warning below). Double-checked my code (it's been a long time) it does indeed expose the battery from the sensors resource, even if it doesn't expose the buttons.

[17/10/2022, 16:49:04] [Hue] Phoscon-GW: CC86ECFFFE5CDC7B: _TZ3000_wkai4ga5 TS0044 "On/Off light 21"
[17/10/2022, 16:49:04] [Hue] Phoscon-GW: /lights/21: On/Off light "On/Off light 21"
[17/10/2022, 16:49:04] [Hue] Phoscon-GW: /lights/21: config: {"on":true,"bri":false,"ct":false,"xy":false,"alert":true,"speed":false,"colorLoop":false,"colorLoopSpeed":false,"lastSeen":true,"resetTimeout":500,"waitTimeUpdate":20,"unknown":true}
[17/10/2022, 16:49:04] [Hue] Phoscon-GW: /lights/22: On/Off light "On/Off light 22"
[17/10/2022, 16:49:04] [Hue] Phoscon-GW: /lights/22: config: {"on":true,"bri":false,"ct":false,"xy":false,"alert":true,"speed":false,"colorLoop":false,"colorLoopSpeed":false,"lastSeen":true,"resetTimeout":500,"waitTimeUpdate":20,"unknown":true}
[17/10/2022, 16:49:04] [Hue] Phoscon-GW: /lights/23: On/Off light "On/Off light 23"
[17/10/2022, 16:49:04] [Hue] Phoscon-GW: /lights/23: config: {"on":true,"bri":false,"ct":false,"xy":false,"alert":true,"speed":false,"colorLoop":false,"colorLoopSpeed":false,"lastSeen":true,"resetTimeout":500,"waitTimeUpdate":20,"unknown":true}
[17/10/2022, 16:49:04] [Hue] Phoscon-GW: /lights/24: On/Off light "On/Off light 24"
[17/10/2022, 16:49:04] [Hue] Phoscon-GW: /lights/24: config: {"on":true,"bri":false,"ct":false,"xy":false,"alert":true,"speed":false,"colorLoop":false,"colorLoopSpeed":false,"lastSeen":true,"resetTimeout":500,"waitTimeUpdate":20,"unknown":true}
[17/10/2022, 16:49:04] [Hue] Phoscon-GW: /sensors/23: ZHASwitch "Twin Room Switch"
[17/10/2022, 16:49:04] [Hue] Phoscon-GW: /sensors/23: warning: ignoring unknown ZHASwitch sensor {"config":{"battery":null,"on":true,"reachable":true},"ep":1,"etag":"f691f33e970f6e0f54833975b4147c49","lastannounced":"2022-10-17T15:48:19Z","lastseen":"2022-10-17T15:48Z","manufacturername":"_TZ3000_wkai4ga5","mode":1,"modelid":"TS0044","name":"Twin Room Switch","state":{"buttonevent":2002,"lastupdated":"2022-10-17T15:27:24.725"},"type":"ZHASwitch","uniqueid":"cc:86:ec:ff:fe:5c:dc:7b-01-0006"}

This also confirms four lights resources and one sensors resource.

Is this switch really battery-powered with four output wires?

Yes, here's the switch

Doesn't look like it has any output wires (to cut power to wired devices).

Do you mean support for Single/Double/Long etc?

Yes, but I need to know what they implemented when adding support for this switch to deCONZ. Doesn't look like they did a good job, as the lights resources don't make sense, without any output wires.

tmcmccann commented 1 year ago

Is this the file - it’s included in my original post, I downloaded it from the UI? https://github.com/ebaauw/homebridge-hue/files/9801113/homebridge-hue.json.gz

Yes, but I need to know what they implemented when adding support for this switch to deCONZ.

is there anything I can with that? Is there anything else you’d recommend or is this switch pretty useless?

thanks

ebaauw commented 1 year ago

Is this the file - it’s included in my original post, I downloaded it from the UI?

Sorry, I missed that.

is there anything I can with that?

You could try each of the buttons, single press, double press, long press, and note down what buttonevent value is reported through the web socket.

tmcmccann commented 1 year ago

Single Press "19:19:46:757": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 1002, "lastupdated": "2022-10-17T18:19:46.884" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" } Double Press "19:20:18:303": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 1004, "lastupdated": "2022-10-17T18:20:18.432" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }

Long Press "19:21:36:738": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 1003, "lastupdated": "2022-10-17T18:21:36.869" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }

This helpful? That's for one of the 4 buttons - I can post them all if needed

tmcmccann commented 1 year ago

Response sometimes has more info

"19:23:26:444": { "attr": { "id": "24", "lastannounced": null, "lastseen": "2022-10-17T18:23Z", "manufacturername": "_TZ3000_wkai4ga5", "modelid": "TS0044", "name": "Switch", "swversion": null, "type": "ZHASwitch", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "e": "changed", "id": "24", "r": "sensors", "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" },

ebaauw commented 1 year ago

That's for one of the 4 buttons - I can post them all if needed

Which one? The upper left one with one dot? Yes please provide the info for the other buttons as well.

tmcmccann commented 1 year ago

Yep that was the button with one dot - I'll post the rest below in the same format of single press, then double press, then long press...

Two dots; { "22:31:56:468": { "attr": { "id": "24", "lastannounced": null, "lastseen": "2022-10-17T21:31Z", "manufacturername": "_TZ3000_wkai4ga5", "modelid": "TS0044", "name": "Switch", "swversion": null, "type": "ZHASwitch", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "e": "changed", "id": "24", "r": "sensors", "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "22:31:56:469": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 2002, "lastupdated": "2022-10-17T21:31:56.479" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "22:32:03:385": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 2004, "lastupdated": "2022-10-17T21:32:03.395" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "22:32:08:571": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 2003, "lastupdated": "2022-10-17T21:32:08.582" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" } }

Three dots; { "22:33:32:410": { "attr": { "id": "24", "lastannounced": null, "lastseen": "2022-10-17T21:33Z", "manufacturername": "_TZ3000_wkai4ga5", "modelid": "TS0044", "name": "Switch", "swversion": null, "type": "ZHASwitch", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "e": "changed", "id": "24", "r": "sensors", "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "22:33:32:435": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 3002, "lastupdated": "2022-10-17T21:33:32.446" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "22:33:34:593": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 3004, "lastupdated": "2022-10-17T21:33:34.604" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "22:33:41:199": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 3003, "lastupdated": "2022-10-17T21:33:41.211" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" } }

Four dots; { "22:34:04:919": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 4002, "lastupdated": "2022-10-17T21:34:04.930" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "22:34:08:8": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 4004, "lastupdated": "2022-10-17T21:34:08.021" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" }, "22:34:13:168": { "e": "changed", "id": "24", "r": "sensors", "state": { "buttonevent": 4003, "lastupdated": "2022-10-17T21:34:13.181" }, "t": "event", "uniqueid": "cc:86:ec:ff:fe:5c:dc:7b-01-0006" } }

Anything else you need? Thanks 🙏

tmcmccann commented 1 year ago

Hey @ebaauw I notice a new commit above...is there anything I can try to see if it works now? Thanks

ebaauw commented 1 year ago

Yeah, the switch should work with that commit. I’ll cut a new version this weekend or so.

tmcmccann commented 1 year ago

Fantastic - you are a hero! How could I update my instance or is the process to wait for your update in Homebridge? Thanks

ebaauw commented 1 year ago

Probably easiest to wait for the new release. Alternatively, you can close the repo or manually patch the updated file.

tmcmccann commented 1 year ago

Hey @ebaauw any update on when you expect to cut a new version? 😊

ebaauw commented 1 year ago

Later this week, after NodeJS has switched LTS to v18, which should happen today (US time). See https://github.com/nodejs/release#release-schedule.

ebaauw commented 1 year ago

Published v0.13.47.