ebaauw / homebridge-hue

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

CLIPSwitch Not Supported #1149

Closed Marfre888 closed 1 year ago

Marfre888 commented 1 year ago

Issue

Hi,

I saw on the Wiki that CLIPswitches aren’t supported by this plugin. May I ask why that is and if it can be supported!

I have an Aqara wired switch and would like to expose a stateless switch in Homekit that triggers based on ‘buttonevent’ using rules in Deconz. This way I am able to more easily set automations.

A second CLIPstatus then defines the state of the switch in Homekit, so On/Off is possible

Would be much appreciated if this feature could be implemented.

ebaauw commented 1 year ago

There's no way to specify what buttons and which corresponding button events the CLIPSwitch supports.

Doesn't the Aqara switch already expose a ZHASwitch resource?

Marfre888 commented 1 year ago

There's no way to specify what buttons and which corresponding button events the CLIPSwitch supports.

Doesn't the Aqara switch already expose a ZHASwitch resource?

What do you mean? Then what is the purpose of the CLIPSwitch?

Can you not specify within Homebridge Hue that eg: buttonevent 1002 is a Single press. So once the rule is created it inputs those values.

In my case I have an Aqara H1 (WS-EUK04) dual rocker with neutral. Homebridge Hue ignores the switches and doesn’t expose anything apart from the lights

ebaauw commented 1 year ago

What do you mean? Then what is the purpose of the CLIPSwitch?

To expose a virtual wireless switch device in deCONZ. It was copied from the Hue API. I’m hoping once we extend ZHASwitch with capabilities, exposing the buttons and button events, we can also do that for CLIPSwitch. Currently I’m whitelisting these for ZHASwitch, based on manufacturer and model, but these are free format for CLIPSwitch.

In my case I have an Aqara H1 (WS-EUK04) dual rocker with neutral. Homebridge Hue ignores the switches and doesn’t expose anything apart from the lights

Then we better fix that. Please list the warning messages for the ZHASwitch resource(s) and tell what buttons and button events the H1 supports.

Marfre888 commented 1 year ago

What do you mean? Then what is the purpose of the CLIPSwitch?

To expose a virtual wireless switch device in deCONZ. It was copied from the Hue API. I’m hoping once we extend ZHASwitch with capabilities, exposing the buttons and button events, we can also do that for CLIPSwitch. Currently I’m whitelisting these for ZHASwitch, based on manufacturer and model, but these are free format for CLIPSwitch.

In my case I have an Aqara H1 (WS-EUK04) dual rocker with neutral. Homebridge Hue ignores the switches and doesn’t expose anything apart from the lights

Then we better fix that. Please list the warning messages for the ZHASwitch resource(s) and tell what buttons and button events the H1 supports.

Ok, assuming we can fix the H1 Switches I wouldn’t need a CLIPSwitch so that would be a better solution.

I get home in a couple hours and will have access to the switches and homebridge.

Will post a screenshot shot of the error inside of Homebridge.

In the meantime:

Sensor Buttonevents

B3BBBABE-0984-4359-95EC-042F135A1E11

ebaauw commented 1 year ago

That doesn't make sense.

If they're anything like other Xiaomi switches, I assume:

Marfre888 commented 1 year ago

'lumi.switch.l1aeu1' (WS-EUK01) - Single Rocker with No Neutral 'lumi.switch.l2aeu1' (WS-EUK02) - Double Rocker with No Neutral 'lumi.switch.n1aeu1' (WS-EUK03) - Single Rocker with Neutral 'lumi.switch.n2aeu1' (WS-EUK04 - Double Rocker with Neutral

I own 1x WS-EUK02 and 5x WS-EUK04. Homebridge hue did not add a switch, but in both Deconz and the Phoscon App, I can see a switch is exposed.

I imagine button 3 is when you press both buttons at once, but will confirm for you.

Edit: Can confirm that pressing both left and right buttons at the same time triggers '3002'

Marfre888 commented 1 year ago

`[05/03/2023, 15:30:21] [Hue] homebridge-hue v0.13.56, node v18.14.2, homebridge v1.6.0

[05/03/2023, 15:30:21] [Hue] warning: planned changes, see https://github.com/ebaauw/homebridge-hue/issues/1070

[05/03/2023, 15:30:21] [Hue] Conbee-II: dresden elektronik deCONZ gateway v2.20.1, api v1.16.0

[05/03/2023, 15:30:21] [Hue] Conbee-II: warning: support for deCONZ will be deprecated in favour of Homebridge deCONZ

[05/03/2023, 15:30:21] [Hue] Conbee-II: warning: not using recommended deCONZ gateway version 2.19.1

[05/03/2023, 15:30:21] [Hue] Conbee-II: /sensors/9: warning: ignoring unknown ZHASwitch sensor {"config":{"devicemode":"compatibility","ledindication":true,"on":true,"reachable":true},"ep":41,"etag":"9f548ca6aeb27e934be52d036220ca96","lastannounced":null,"lastseen":"2023-03-05T14:30Z","manufacturername":"LUMI","mode":1,"modelid":"lumi.switch.n2aeu1","name":"Bathroom Switch","state":{"buttonevent":1002,"lastupdated":"2023-03-05T14:20:48.775"},"swversion":"0.0.0_0023","type":"ZHASwitch","uniqueid":"54:ef:44:10:00:3b:62:df-29-0012"}

[05/03/2023, 15:30:21] [Hue] Conbee-II: /sensors/5: warning: ignoring unknown ZHASwitch sensor {"config":{"devicemode":"compatibility","ledindication":true,"on":true,"reachable":true},"ep":41,"etag":"57769e86640d0e50ec6ba10ab168bdb7","lastannounced":"2023-03-04T17:27:28Z","lastseen":"2023-03-05T14:29Z","manufacturername":"LUMI","mode":1,"modelid":"lumi.switch.n2aeu1","name":"Living Room Switch 2","state":{"buttonevent":1002,"lastupdated":"2023-03-05T14:17:43.372"},"swversion":"0.0.0_0023","type":"ZHASwitch","uniqueid":"54:ef:44:10:00:3b:68:7c-29-0012"}

[05/03/2023, 15:30:21] [Hue] Conbee-II: /sensors/8: warning: ignoring unknown ZHASwitch sensor {"config":{"devicemode":"compatibility","ledindication":true,"on":true,"reachable":true},"ep":41,"etag":"e87c35876e07c9c3710c6261b580ed59","lastannounced":"2023-03-04T17:27:27Z","lastseen":"2023-03-05T14:30Z","manufacturername":"LUMI","mode":1,"modelid":"lumi.switch.l2aeu1","name":"Kitchen Switch","state":{"buttonevent":2002,"lastupdated":"2023-03-04T18:09:38.257"},"swversion":"0.0.0_0011","type":"ZHASwitch","uniqueid":"54:ef:44:10:00:1c:52:7f-29-0012"} [05/03/2023, 15:30:21] [Hue] Conbee-II: /sensors/12: warning: ignoring unknown ZHASwitch sensor {"config":{"devicemode":"compatibility","ledindication":true,"on":true,"reachable":true},"ep":41,"etag":"a4b5a5263fb125fc96f9a166b3ed1cbe","lastannounced":null,"lastseen":"2023-03-05T14:29Z","manufacturername":"LUMI","mode":1,"modelid":"lumi.switch.n2aeu1","name":"Bedroom Switch","state":{"buttonevent":1002,"lastupdated":"2023-03-05T14:13:55.608"},"swversion":"0.0.0_0023","type":"ZHASwitch","uniqueid":"54:ef:44:10:00:3b:69:80-29-0012"}

[05/03/2023, 15:30:21] [Hue] Conbee-II: /sensors/15: warning: ignoring unknown ZHASwitch sensor {"config":{"devicemode":"compatibility","ledindication":true,"on":true,"reachable":true},"ep":41,"etag":"f98f63a954bfd42d5e75da17985cf9d3","lastannounced":null,"lastseen":"2023-03-05T14:29Z","manufacturername":"LUMI","mode":1,"modelid":"lumi.switch.n2aeu1","name":"Light Room Switch 1","state":{"buttonevent":2002,"lastupdated":"2023-03-05T14:20:47.457"},"swversion":"0.0.0_0023","type":"ZHASwitch","uniqueid":"54:ef:44:10:00:3b:6a:1f-29-0012"}

[05/03/2023, 15:30:21] [Hue] Conbee-II: /sensors/18: warning: ignoring unknown ZHASwitch sensor {"config":{"devicemode":"compatibility","ledindication":true,"on":true,"reachable":true},"ep":41,"etag":"01c54e2008b360b0229286d476bb8849","lastannounced":null,"lastseen":"2023-03-05T14:29Z","manufacturername":"LUMI","mode":1,"modelid":"lumi.switch.n2aeu1","name":"Study Switch","state":{"buttonevent":2002,"lastupdated":"2023-03-05T14:09:48.866"},"swversion":"0.0.0_0023","type":"ZHASwitch","uniqueid":"54:ef:44:10:00:3b:60:cf-29-0012"}

[05/03/2023, 15:30:21] [Hue] Conbee-II: /sensors/23: warning: unknown ZHAPresence sensor {"config":{"battery":100,"duration":30,"ledindication":false,"on":true,"reachable":true,"sensitivity":3},"ep":1,"etag":"325f434478e871bffa5dcf535908a848","lastannounced":null,"lastseen":"2023-03-05T14:26Z","manufacturername":"LUMI","modelid":"lumi.motion.ac02","name":"Bathroom Motion Sensor","state":{"lastupdated":"2023-03-05T14:18:10.461","presence":false},"swversion":"0.0.0_0010","type":"ZHAPresence","uniqueid":"54:ef:44:10:00:53:cb:43-01-0406"}

[05/03/2023, 15:30:21] [Hue] Conbee-II: /sensors/24: warning: unknown ZHALightLevel sensor {"config":{"battery":100,"ledindication":false,"on":true,"reachable":true,"tholddark":12000,"tholdoffset":7000},"ep":1,"etag":"2e90f3658200e124e7912fbedcc31589","lastannounced":null,"lastseen":"2023-03-05T14:26Z","manufacturername":"LUMI","modelid":"lumi.motion.ac02","name":"Bathroom Motion Sensor","state":{"dark":false,"daylight":false,"lastupdated":"2023-03-05T14:17:40.192","lightlevel":13803,"lux":24},"swversion":"0.0.0_0010","type":"ZHALightLevel","uniqueid":"54:ef:44:10:00:53:cb:43-01-0400"}

[05/03/2023, 15:30:21] [Hue] Conbee-II: 8 accessories`

Marfre888 commented 1 year ago

@ebaauw Have you had a chance to look at this by any chance?

ebaauw commented 1 year ago

Not yet. Probably gonna be next weekend.

Marfre888 commented 1 year ago

Not yet. Probably gonna be next weekend.

No problem, no rush, but would you say it is possible to get them exposed?

Why am I also getting an error from Aqara P1 Motion Sensor in Homebridge log, this sensor exposes fine!

ebaauw commented 1 year ago

Sure, as I mentioned above, I need to whitelist the buttons and possible actions. I really want deCONZ to expose this over the API, but that’s gonna take me some more time.

Why am I also getting an error from Aqara P1 Motion Sensor in Homebridge log, this sensor exposes fine!

Those are left over from when I thought I might need to whitelist all devices, but, except for switches, most are self-explanatory enough.

Marfre888 commented 1 year ago

Sure, as I mentioned above, I need to whitelist the buttons and possible actions. I really want deCONZ to expose this over the API, but that’s gonna take me some more time.

Why am I also getting an error from Aqara P1 Motion Sensor in Homebridge log, this sensor exposes fine!

Those are left over from when I thought I might need to whitelist all devices, but, except for switches, most are self-explanatory enough.

Ahh right! Sounds great!

ebaauw commented 1 year ago

In v0.13.57.

Marfre888 commented 1 year ago

In v0.13.57.

Thank you, the switches expose properly. Will test them better later today to make sure they trigger correctly, however, I noticed some graphical anomalies in the Home app UI which I'm unsure if a bug with homekit or the plugin.

  1. Renaming the stateless switch also renames the main switch tile.
  2. If you separate the tiles, the stateless switch disappears in Home app. However, I have some switches which have the second rocker decoupled, so I have disabled them from homekit using a 'resourcelink'. These work correctly, so when you separate the tiles. Both stateless switch and light show up.

Let me know if you think this is only a bug with Homekit because the stateless switch was exposed to Homekit after the switches were already added. I can try repairinng the bridge and see if that fixes the issue.

Lastly, somewhat unrelated to this post.

I'm still getting these ignore errors inside of homebridge, however, the sensor seems to be exposed correctly

Screenshot 2023-03-11 at 8 21 50 am
ebaauw commented 1 year ago

Renaming the stateless switch also renames the main switch tile.

How and where do you rename the switch. Tiles are a thing of the Home app. It’s the typical “it just works” Apple magic. Until it doesn’t…

If you separate the tiles, the stateless switch disappears in Home app.

I’ve never seen that before. Make sure to check the room view; the separated switch might not be marked to appear in the home view. You might also want to check another, more decent HomeKit app.

Note that HomeKit uses a Stateless Programmable Switch service per button. Home typically shows a tile per service, but it combines the Stateless Programmable Switch services into one title. Since the makeover in iOS 16, sensors are no longer shown as tiles in the home nor room views, but as categories at the top of the screen. If you open these, the tiles still show (when there are multiple sensors in that category).

deCONZ typically combines all buttons in a single ZHASwitch resource, so you cannot blacklist a single button. However, some of the first supported devices might still be exposed using multiple ZHASwitch resources (when different buttons send Zigbee commands from different Zigbee endpoints).

Note that you need to restart Homebridge Hue for changes to deCONZ (incl blacklists) to be reflected in HomeKit. Also note that HomeKit doesn’t like configuration changes, and might take a while before it shows these.

I'm still getting these ignore errors inside of homebridge, however, the sensor seems to be exposed correctly

I already explained these.

Marfre888 commented 1 year ago

Renaming the stateless switch also renames the main switch tile.

How and where do you rename the switch. Tiles are a thing of the Home app. It’s the typical “it just works” Apple magic. Until it doesn’t…

That's fine, my intention is to separate the lights anyway, so it doesn't matter.

If you separate the tiles, the stateless switch disappears in Home app.

I’ve never seen that before. Make sure to check the room view; the separated switch might not be marked to appear in the home view. You might also want to check another, more decent HomeKit app.

Note that HomeKit uses a Stateless Programmable Switch service per button. Home typically shows a tile per service, but it combines the Stateless Programmable Switch services into one title. Since the makeover in iOS 16, sensors are no longer shown as tiles in the home nor room views, but as categories at the top of the screen. If you open these, the tiles still show (when there are multiple sensors in that category).

No, I'm 100% sure that the Stateless Programmable Switch tile disappears. This isn't something I can check inside of another app, as other apps don't offer this option. However inside of the Home app, the combined tile says there is 2 accessories when there is actually 3. This is probably why the Stateless Programmable Switch tile is disappearing. Possibly will need to remove and add the bridge back into Homekit to sort this issue. Will try and let you know.

deCONZ typically combines all buttons in a single ZHASwitch resource, so you cannot blacklist a single button. However, some of the first supported devices might still be exposed using multiple ZHASwitch resources (when different buttons send Zigbee commands from different Zigbee endpoints).

Note that you need to restart Homebridge Hue for changes to deCONZ (incl blacklists) to be reflected in HomeKit. Also note that HomeKit doesn’t like configuration changes, and might take a while before it shows these.

This Aqara Switch exposes the buttons as separate lights. Disabling one gave me intended outcome. So won't complain.

I'm still getting these ignore errors inside of homebridge, however, the sensor seems to be exposed correctly

I already explained these.

Ok so ignoring these!

ebaauw commented 1 year ago

This Aqara Switch exposes the buttons as separate lights.

No, it doesn't. The /lights resources are for output wires. Homebridge Hue exposes these as Lightbulb (or optionally as Outlet or Switch). The buttons are exposed through the ZHASwitch /sensors resource. Homebridge Hue exposes these as Stateless Programmable Switch services.

In (default) couples mode, the switch connects the input button to an output wire. Consequently, a button action is reflected in both the /lights and /sensors resource. In decoupled mode (which, I think can only be configured on some Aqara switches), the output wire is no longer controlled by the input button. Only the /sensors resource reacts on a button action.

You can suppress an unused output wire from being exposed, by blacklisting the corrrspinding /lights resource. You can suppress all input buttons from being exposed, by blacklisting the ZHASwitch /sensors resource. You cannot suppress a single input button / Stateless Programable Switch, as these are combined on a single ZHASwitch resource.

This isn't something I can check inside of another app, as other apps don't offer this option.

I strongly suggest you check another HomeKit app, to understand how Homebridge Hue exposes these switches.

However inside of the Home app, the combined tile says there is 2 accessories when there is actually 3.

The Home app lies. There is only one accessory, with multiple services. Again, check out a decent HomeKit app, like Eve, to understand this.

Marfre888 commented 1 year ago

@ebaauw Thank you for the quick integration.

Just want to say it is working perfectly.

However, I did have to split the lights using a resourcelink to clear the accessories bug I mentioned above. I understand you don't like the Home app, and while I agree that it doesn't present enough info, I do like the way it presents data.

This Aqara Switch exposes the buttons as separate lights.

No, it doesn't. The /lights resources are for output wires. Homebridge Hue exposes these as Lightbulb (or optionally as Outlet or Switch). The buttons are exposed through the ZHASwitch /sensors resource. Homebridge Hue exposes these as Stateless Programmable Switch services.

Yes this is what I meant