Closed torandreroland closed 1 year ago
That's a bug alright, thanks for reporting and for providing the dump file.
Homebridge deCONZ chokes on the Samjin multisensor, which combines a door/window sensor (ZHAOpenClose), a temperature sensors (ZHATemperature), and a vibration sensor (ZHAVibration). Homebridge deCONZ should expose it as a single accessory with Contact Sensor, Temperature Sensor, and Motion Sensor services, incl. Eve history for all three. The bug is that it adds the Last Activiation characteristic for the Motion Sensor to the primary service, instead of to the Motion Sensor service. Usually, for motion sensors, the primary service is the Motion Sensor service, but for the multi sensor, the Context Sensor is the primary.
Could you try beta v0.1.3-0?
Thanks! Can confirm it's working in beta v0.1.3-0 after removing the accessory from cache first.
Closing this.
@ebaauw: I am reopening this issue. It stills fails with the same error. It happens after the first restart after first activation of the motion sensor.
If I then go into the cachedAccessories and delete lastActivation for the motion sensor, the service is created correctly. But if I then activate the sensor and restart homebridge, the error reappears.
See #111 it looks like deCONZ changed how it exposed the sensor? Messing with cachedAccessories
is a very bad idea, and only impacts the structures maintained by Homebridge. It won’t change how Homebridge deCONZ creates the delegates from the full state reported by the deCONZ API.
Thank you for your quick reply!
An updated homebridge-deconz.json is available here. For comparison the homebridge-deconz.json from the first post is still available here.
I don't like messing around in cachedAccessories either, but it sure beats having to restore from backup using Controller for HomeKit to restore room information, scenes and automations while troubleshooting this. I believe lastActivation is just handled internally by this plugin as it doesn't look to be exposed in the deCONZ REST-API.
I'm not quite sure commit 94d5e3d1f788f699f90b799bd4e63238e1d5ca6f at any point solved this issue. It happens after first restart after I have activated the sensor (ie. opened the window), which in retrospect I didn't try before closing that issue originally.
I don't believe Contact Sensor is the primary service (or ever was). At least the json says "primary": "01-FC02" which is the ZHAVibration resource which I believe is the basis for a motion sensor service (ZHATemperature I assume is the basis for Temperature Sensor service and ZHAOpenClose should be the basis for Contact Sensor service).
Please note: I have been setting the DDF Mode of Deconz to strict lately (due to incorrect handling in legacy code for some other device I have). I haven't experiences that this has affected the Samsung multi-sensor, but I though I should mention it since you asked if deCONZ changed how it exposed the sensor.
I believe lastActivation is just handled internally by this plugin
Yes, same for Times Opened.
I'm not quite sure commit https://github.com/ebaauw/homebridge-deconz/commit/94d5e3d1f788f699f90b799bd4e63238e1d5ca6f at any point solved this issue
No, it didn't; I missed the same issue for the Contact Sensor.
I don't believe Contact Sensor is the primary service
No, the Motion Sensor is. Another bug, but with the rework of Eve history, I'm now able to create any combination (up to seven characteristics), and the notion of primary service has become irrelevant for sensors.
I haven't experiences that this has affected the Samsung multi-sensor, but I though I should mention it since you asked if deCONZ changed how it exposed the sensor.
No, it hasn't. I was under the assumption that the previous commit had solved the issue, which it only would have when the Contact Sensor was the primary service.
Could you try beta v0.1.5-0?
Works in beta v0.1.5-0. Closing this issue again. Thank you for your help.
Released v0.1.7.
I get an SyntaxError in the logs in the latest version (not present in v0.0.27). I think this is related to a motion sensor:
Ekraveien 18: error: SyntaxError: lastActivation: duplicate key at Motion.addCharacteristicDelegate (/homebridge/node_modules/homebridge-deconz/node_modules/homebridge-lib/lib/ServiceDelegate/index.js:242:13) at new Sensor (/homebridge/node_modules/homebridge-deconz/lib/DeconzAccessory/Sensor.js:73:48) at Gateway.addAccessory (/homebridge/node_modules/homebridge-deconz/lib/DeconzAccessory/Gateway.js:612:25) at Gateway.analyseFullState (/homebridge/node_modules/homebridge-deconz/lib/DeconzAccessory/Gateway.js:1068:20) at Gateway.poll (/homebridge/node_modules/homebridge-deconz/lib/DeconzAccessory/Gateway.js:903:18) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Gateway.heartbeat (/homebridge/node_modules/homebridge-deconz/lib/DeconzAccessory/Gateway.js:339:9)
When updating from v.0.0.27 to 0.1.2 I had to do a full unexposed and expose of the whole gateway to get a functional setup. This error occurred after the first restart of homebridge after that.
homebridge-deconz.json is available here.