mrjackyliang / homebridge-adt-pulse

Homebridge security system platform for ADT Pulse
Apache License 2.0
35 stars 7 forks source link

[Bug]: HOOBS: options value keeps getting deleted in the JSON config preventing the plugin from initializing #141

Closed cyberpower678 closed 3 months ago

cyberpower678 commented 3 months ago

Pre-check confirmation

Your email address

cybernet678@yahoo.com

Tell me exactly what happened

I upgraded from v2 to v3, and followed the docs to reconfigure the plugin directly via the JSON editor. All values are accepted but the logs keep complaining that it can't start due to missing options. When I add an empty list of options, it gets deleted by the plugin immediately. I added a "dummy" option to the list to keep it there, and that seems to keep the value there and the plugin happy, at least up until v3.0.6. Anything higher will complain about a bad option being present, so now it's either erased when it's empty, or it complains about a "dummy" option being present.

Plugin version

3.0.0+

Homebridge version

1.7.0

Node.js® version

16.20.2

Output of the "test-api" command

complained about test-api missing

Captured logs relevant to this report

3/16/2024, 6:47:02 PM Adt Pulse Bridge Configuration change
3/16/2024, 6:47:02 PM Adt Pulse Bridge adtpulsebridge stopping
3/16/2024, 6:47:31 PM Adt Pulse Bridge Adt Pulse Bridge starting
3/16/2024, 6:47:51 PM Adt Pulse Bridge Loaded plugin 'homebridge-adt-pulse'
3/16/2024, 6:47:51 PM Adt Pulse Bridge Loading 1 platforms...
3/16/2024, 6:47:51 PM Adt Pulse Bridge [ DEBUG ] Registering platform 'homebridge-adt-pulse.ADTPulse'
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse [ ERROR ] Plugin is unable to initialize due to an invalid platform configuration.
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse [ WARNING ] If you just upgraded from "v2 to v3" or from "v3 to v3.1", please update your configuration.
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse [ WARNING ] Carefully observe the error below. The answer you are looking for is there.
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: system-1, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-11, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-14, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-17, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-13, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-18, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-9, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-10, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-15, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-12, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-16, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-19, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-0, uuid: undefined) ...
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] [
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] {
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] "code": "invalid_type",
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] "expected": "array",
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] "received": "undefined",
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] "path": [
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] "options"
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] ],
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] "message": "Required"
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] }
3/16/2024, 6:47:52 PM Adt Pulse Bridge [ ERROR ] ]
3/16/2024, 6:47:52 PM Adt Pulse Bridge Bridge is running on port 51836.

3/17/2024, 10:16:03 AM Nest Cam Bridge Adt Pulse Bridge starting
3/17/2024, 10:16:21 AM Adt Pulse Bridge Loaded plugin 'homebridge-adt-pulse'
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ DEBUG ] Registering platform 'homebridge-adt-pulse.ADTPulse'
3/17/2024, 10:16:21 AM Adt Pulse Bridge Loading 1 platforms...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse [ ERROR ] Plugin is unable to initialize due to an invalid platform configuration.
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse [ WARNING ] If you just upgraded from "v2 to v3" or from "v3 to v3.1", please update your configuration.
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse [ WARNING ] Carefully observe the error below. The answer you are looking for is there.
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: system-1, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-11, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-14, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-17, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-13, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-18, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-9, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-10, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-15, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-12, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for undefined (id: sensor-16, uuid: undefined) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for ADT Pulse Gateway (id: adt-device-0, uuid: f0a67cd8-a143-4992-ba09-e39b8c3955d4) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Security Panel (id: adt-device-1, uuid: af79de8a-2216-49c1-aafa-606251d39c3e) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Alarm Ringing (id: adt-device-1-switch, uuid: e664d49d-7c11-4368-9403-d4d632c6a97e) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Back Door (id: adt-device-4, uuid: 83ed1be0-578b-43e2-99a9-cfc82d3c7342) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Fron Door (id: adt-device-2, uuid: 2d9c413a-63da-4e7b-8c4d-3ed2684a6b2e) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Garage Door (id: adt-device-3, uuid: c9ddfc3e-f512-43d5-9456-bf1ea91b4452) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] [
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] {
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "code": "invalid_union",
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "unionErrors": [
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] {
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "issues": [
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] {
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "received": "dummy",
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "code": "invalid_literal",
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "expected": "disableAlarmRingingSwitch",
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "path": [
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "options",
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] 0
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] ],
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "message": "Invalid literal value, expected 'disableAlarmRingingSwitch'"
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] }
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] ],
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "name": "ZodError"
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] },
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] {
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "issues": [
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] {
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "received": "dummy",
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "code": "invalid_literal",
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "expected": "ignoreSensorProblemStatus",
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "path": [
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "options",
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] 0
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] ],
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "message": "Invalid literal value, expected 'ignoreSensorProblemStatus'"
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] }
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] ],
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "name": "ZodError"
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] }
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] ],
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "path": [
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "options",
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] 0
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] ],
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] "message": "Invalid input"
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] }
3/17/2024, 10:16:21 AM Adt Pulse Bridge [ ERROR ] ]
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Master Bedroom Door (id: adt-device-15, uuid: 3d1bd248-358c-4ef9-8ae8-f3564643fab0) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Den Glass Break Detector (id: adt-device-17, uuid: 116226cc-9a90-4dc8-876e-304447cdfaf6) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Dining Room Glass Break Detector (id: adt-device-16, uuid: f598ec0c-4e65-4137-bae1-b065cd06c0f6) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Kitchen Glass Break Detector (id: adt-device-18, uuid: 57746a72-6564-4d25-b6cd-384480cb98e7) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Master Bedroom Glass Break Detector (id: adt-device-19, uuid: 99d97104-8b01-4066-8878-13fb1b529345) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Den Motion (id: adt-device-20, uuid: 08207e03-a25d-41d8-8151-5e67a0a4a9e5) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Downstairs Smoke Detector (id: adt-device-11, uuid: f3b519a4-4663-4985-a011-e49d203243bd) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge ADT Pulse Configuring cached accessory for Upstairs Smoke Detector (id: adt-device-12, uuid: 5caed0b0-8b41-48c6-b5e7-ecf561b2500f) ...
3/17/2024, 10:16:21 AM Adt Pulse Bridge Bridge is running on port 51836.

Post-check confirmation

Legal Agreements

mrjackyliang commented 3 months ago

This issue is related to HOOBS caching the older configurations and cannot be fixed. Please re-flash your system using Homebridge.

cyberpower678 commented 3 months ago

This is a HOOBs hub, not a custom pi. I don't think it can be reflashed, and I've got 7 other bridges on there as well. Reflashing is not an option here. I think the simpler solution is to code in a catch where options is missing and just replace it with an empty list when initializing. Should be a 1-2 line fix?

cyberpower678 commented 3 months ago

I'm also adding the fact that the older configuration is not asserting itself here. It's literally deleting an empty list from the JSON entirely. Everything else in the new configuration remains untouched. This does not seem like a caching issue. This tells me HOOBs is just cleaning up empty options and removing them. So the solution here would be to catch if "options" is missing and just default it to [].

cyberpower678 commented 3 months ago

https://github.com/mrjackyliang/homebridge-adt-pulse/pull/142

mrjackyliang commented 3 months ago

Will try to find an alternative pattern in the meantime.

cyberpower678 commented 3 months ago

I don't fully understand your design pattern as that seems like a great simple and non-hacky way to fix it, but I look forward to see the solution getting implemented. :-)

mrjackyliang commented 3 months ago

Because there is a difference between [] vs null vs undefined in JS. I simply choose a path that would be more visual, if it's empty, it's empty.

mrjackyliang commented 3 months ago

I have reviewed your pull request, and made some more additional changes. The release v3.3.0 has been released and partially credited to you. Thanks!

github-actions[bot] commented 2 months ago

Due to inactivity, this issue will be locked and marked as resolved. If you have any further questions or inquiries, please feel free to open a new issue.