jfarmer08 / homebridge-wyze-smart-home

Wyze Smart Home plugin for Homebridge.
MIT License
94 stars 14 forks source link

Plugin Boot Looping Due To Previously Excluded Devices #145

Closed NateBlanchard closed 7 months ago

NateBlanchard commented 10 months ago

Describe The Bug: I apologize if this bug report is garbage, this will be my first one so please give me feedback so I can improve!

Two days ago, my plugin stopped working. I took a look at my config, and it looked like my API key expired so I renewed it. This didn't solve the problem, so I took a look at the logs. After looking at the logs, it looks like the plugin is attempting to exclude some previously excluded accessories, getting stuck, and ending. My theory is that there was some kind of change on the Wyze/API side that is causing the error, because I was able to fix it!

I was able to fix the issue by uninstalling the plugin and reinstalling it, and in the process I did notice one difference between the two. On the original install, my Scale, Air Purifier, and Router were all included on the Homekit side, all of these were not included on the new install. It makes sense these are excluded, since I don't think any of those accessories have any functions controlled through this plugin. I'm a bit skeptical about this though, as the log specifically states "Cannot find the bridged Accessory to remove.", but maybe it was looking to remove them from showing up on the Homekit side, but the accessories were no longer being shared by the API? I'm in way over my head, so this is the best explanation I can come up with.

While the main issue isn't a problem for me anymore, I now can't seem to exclude the 3 unsupported devices (Lock Pro, Doorbell Pro, Router) by type or MAC address, so the second log is continuously repeating every minute. Is here a way these can be added to a type called "unsupported" or excluded another way?

Another note: If I can help with implementing the Air Purifier into this plugin, I'd be more than happy to help!

To Reproduce:

  1. Have a previously installed plugin instance
  2. Let API key expire, or whatever change Wyze made on their side,
  3. Plugin will boot loop

Expected behavior: The plugin would not boot loop. Not sure if I can add more detail here.

Logs:

[21/08/2023, 22:30:46] [Wyze] Child bridge process ended
[21/08/2023, 22:30:46] [Wyze] Process Ended. Code: 1, Signal: null
[21/08/2023, 22:30:53] [Wyze] Restarting Process...
[21/08/2023, 22:30:54] [Wyze] Launched child bridge with PID -----
[21/08/2023, 22:30:54] Registering platform 'homebridge-wyze-smart-home.WyzeSmartHome'
[21/08/2023, 22:30:54] [Wyze] Loaded homebridge-wyze-smart-home v0.5.36 child bridge successfully
[21/08/2023, 22:30:54] Loaded 6 cached accessories from cachedAccessories.******.
[21/08/2023, 22:30:54] [Wyze] Common (Model: CO_AP1 (Mac: undefined (Name: undefined) not supported submit a request to https://github.com/jfarmer08/homebridge-wyze-smart-home/issues to have it added. If no issues are found
[21/08/2023, 22:30:54] [Wyze] [WyzeSwitch] Fetching status of "Living Room"
[21/08/2023, 22:30:54] [Wyze] [WyzeSwitch] Retrieving previous service for "Living Room"
[21/08/2023, 22:30:54] [Wyze] Common (Model: LO_MESH6 (Mac: undefined (Name: undefined) not supported submit a request to https://github.com/jfarmer08/homebridge-wyze-smart-home/issues to have it added. If no issues are found
[21/08/2023, 22:30:54] [Wyze] [WyzeSwitch] Fetching status of "Living Room Router"
[21/08/2023, 22:30:54] [Wyze] [WyzeSwitch] Retrieving previous service for "Living Room Router"
[21/08/2023, 22:30:54] [Wyze] [WyzePlug] Fetching status of "Printer Lamp"
[21/08/2023, 22:30:54] [Wyze] [WyzePlug] Retrieving previous service for "Printer Lamp"
Error: Cannot find the bridged Accessory to remove.
    at Bridge.Accessory.removeBridgedAccessory (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:717:13)
    at Bridge.Accessory.removeBridgedAccessories (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:733:12)
    at BridgeService.handleUnregisterPlatformAccessories (/var/lib/homebridge/node_modules/homebridge/src/bridgeService.ts:404:17)
    at HomebridgeAPI.emit (node:events:514:28)
    at HomebridgeAPI.unregisterPlatformAccessories (/var/lib/homebridge/node_modules/homebridge/src/api.ts:355:10)
    at WyzeSmartHome.configureAccessory (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:245:16)
    at /var/lib/homebridge/node_modules/homebridge/src/bridgeService.ts:328:25
    at Array.filter (<anonymous>)
    at BridgeService.restoreCachedPlatformAccessories (/var/lib/homebridge/node_modules/homebridge/src/bridgeService.ts:288:69)
    at ChildBridgeFork.startBridge (/var/lib/homebridge/node_modules/homebridge/src/childBridgeFork.ts:186:24)
[21/08/2023, 22:30:54] [Wyze] Child bridge process ended

Logs after reinstallation: (no longer crashing! But errors repeat every minute)

[21/08/2023, 23:30:30] [Wyze] Common (Model: CO_AP1 (Mac: CO_AP1_7*Air Purifier*3 (Name: Living Room) not supported submit a request to https://github.com/jfarmer08/homebridge-wyze-smart-home/issues to have it added. If no issues are found
[21/08/2023, 23:30:30] [Wyze] Common (Model: LO_MESH6 (Mac: LO_MESH6_7*Mesh Router*8 (Name: Living Room Router) not supported submit a request to https://github.com/jfarmer08/homebridge-wyze-smart-home/issues to have it added. If no issues are found
[21/08/2023, 23:30:30] [Wyze] Lock (Model: YD_BT1 (Mac: YD_BT1.9*Wyze Lock Pro*d (Name: Front Door) not supported submit a request to https://github.com/jfarmer08/homebridge-wyze-smart-home/issues to have it added. If no issues are found
[21/08/2023, 23:30:30] [Wyze] Camera (Model: GW_BE1 (Mac: GW_BE1_7**Video Doorbell Pro**A (Name: Front door) not supported submit a request to https://github.com/jfarmer08/homebridge-wyze-smart-home/issues to have it added. If no issues are found

Plugin Config:

    "name": "Wyze",
    "username": "***",
    "password": "***",
    "keyId": "***",
    "apiKey": "***",
    "mfaCode": "***",
    "refreshInterval": 60000,
    "entryExitDelay": 30,
    "showAdvancedOptions": true,
    "logging": "debug",
    "excludeMacAddress": true,
    "filterByMacAddressList": [
        "7***3",
        "7***8",
        "BT***d",
        "7***A"
    ],
    "excludedeviceType": true, (NOTE: I turned out type filtering after it wasn't working)
    "_bridge": {
        "username": "***",
        "port": ***
    },
    "platform": "WyzeSmartHome"
}

Environment:

github-actions[bot] commented 10 months ago

Message that will be displayed on users' first issue

gleep52 commented 9 months ago

I am having a similar boot loop issue if i enable my wyze plugin. I didn't have any restrictions on my plugin originally and only have a few select wyze devices - 5 cameras and 4 color changing bulbs. I didn't originally tinker in the advanced section of the plugin, but did recreate my API to see if that was the issue on why it stopped working. Now I cannot get it to enable at all without boot looping my homebridge instance unless I assign it as a child bridge - then just the wyze plugin loops over and over. I'm only interested in getting the mesh lights to work if that matters... it's nice to tell my watch to change the colors and include it in scenes in the home.app.

jfarmer08 commented 9 months ago

Clear any cache and then make sure you have logging set to debug.

On Mon, Sep 11, 2023 at 11:00 AM gleep52 @.***> wrote:

I am having a similar boot loop issue if i enable my wyze plugin. I didn't have any restrictions on my plugin originally and only have a few select wyze devices - 5 cameras and 4 color changing bulbs. I didn't originally tinker in the advanced section of the plugin, but did recreate my API to see if that was the issue on why it stopped working. Now I cannot get it to enable at all without boot looping my homebridge instance unless I assign it as a child bridge - then just the wyze plugin loops over and over. I'm only interested in getting the mesh lights to work if that matters... it's nice to tell my watch to change the colors and include it in scenes in the home.app.

— Reply to this email directly, view it on GitHub https://github.com/jfarmer08/homebridge-wyze-smart-home/issues/145#issuecomment-1714172465, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKHFB24ZWUO725QZQAV5VLXZ4YQ7ANCNFSM6AAAAAA327QZXU . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

gleep52 commented 9 months ago

I deleted the cached accessories - even though they get deleted each time I remove and re-add the plugin. Same looping of the child bridge functions. Debug logging enabled now.

New added debug text appears like this for each BR30 bulb:

 Error: 
    at Brightness.Characteristic.characteristicWarning (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
    at Brightness.Characteristic.validateUserInput (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2903:14)
    at Brightness.Characteristic.updateValue (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2328:20)
    at WyzeMeshLight.updateBrightness (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:63:55)
    at WyzeMeshLight.updateCharacteristics (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:46:18)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeMeshLight.update (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:326:7)

Full looping text:


[9/12/2023, 9:06:45 AM] [WyzeBridge] Restarting Process...
[9/12/2023, 9:06:46 AM] [WyzeBridge] Launched child bridge with PID 11958
[9/12/2023, 9:06:46 AM] Registering platform 'homebridge-wyze-smart-home.WyzeSmartHome'
[9/12/2023, 9:06:47 AM] [WyzeBridge] Loaded homebridge-wyze-smart-home v0.5.36 child bridge successfully
[9/12/2023, 9:06:47 AM] Loaded 9 cached accessories from cachedAccessories.0EF145E386D6.
[9/12/2023, 9:06:47 AM] Publishing bridge accessory (name: WyzeBridge, publishInfo: {
  username: '0E:F1:45:E3:86:D6',
  port: 44485,
  pincode: '***-**-***',
  category: 2,
  bind: [ 'eth0', [length]: 1 ],
  mdns: { interface: '192.168.1.18' },
  addIdentifyingMaterial: true,
  advertiser: 'bonjour-hap'
}).
[9/12/2023, 9:06:47 AM] [WyzeBridge] Refreshing devices...
[9/12/2023, 9:06:47 AM] Homebridge v1.6.1 (HAP v0.11.1) (WyzeBridge) is running on port 44485.
[9/12/2023, 9:06:47 AM] [WyzeBridge] Performing request: app/v2/home_page/get_object_list
[9/12/2023, 9:06:47 AM] [WyzeBridge] Request config: {"method":"POST","url":"app/v2/home_page/get_object_list","data":{<redacted>","app_name":"com.hualai.WyzeCam","app_ver":"wyze_developer_api","app_version":"wyze_developer_api","phone_id":"wyze_developer_api","phone_system_type":"1","sc":"wyze_developer_api","sv":"wyze_developer_api","ts":1694527607175},"baseURL":"https://api.wyzecam.com"}
[9/12/2023, 9:06:48 AM] [WyzeBridge] API response PerformRequest: {"ts":1694527607861,"code":"1","msg":"","data":{"device_group_list":[],"device_list":[<redacted>}
[9/12/2023, 9:06:48 AM] [WyzeBridge] Found 9 device(s)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Loading accessory from cache Wyze5 (MAC: D03F27438640)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Loading accessory from cache Kitchen Color 1 (MAC: D03F27940A53)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Performing request: app/v2/device/get_property_list
[9/12/2023, 9:06:48 AM] [WyzeBridge] Request config: {"method":"POST","url":"app/v2/device/get_property_list","data":{"access_token":"<redacted>","app_name":"com.hualai.WyzeCam","app_ver":"wyze_developer_api","app_version":"wyze_developer_api","phone_id":"wyze_developer_api","phone_system_type":"1","sc":"wyze_developer_api","sv":"wyze_developer_api","ts":1694527608070,"device_mac":"D03F27940A53","device_model":"HL_BR30C"},"baseURL":"https://api.wyzecam.com"}
[9/12/2023, 9:06:48 AM] [WyzeBridge] Loading accessory from cache Broken (MAC: D03F27940517)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Performing request: app/v2/device/get_property_list
[9/12/2023, 9:06:48 AM] [WyzeBridge] Request config: {"method":"POST","url":"app/v2/device/get_property_list","data":{"access_token":"<redacted>","app_name":"com.hualai.WyzeCam","app_ver":"wyze_developer_api","app_version":"wyze_developer_api","phone_id":"wyze_developer_api","phone_system_type":"1","sc":"wyze_developer_api","sv":"wyze_developer_api","ts":1694527608088,"device_mac":"D03F27940517","device_model":"HL_BR30C"},"baseURL":"https://api.wyzecam.com"}
[9/12/2023, 9:06:48 AM] [WyzeBridge] Loading accessory from cache Kitchen Color 3 (MAC: D03F27940AED)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Performing request: app/v2/device/get_property_list
[9/12/2023, 9:06:48 AM] [WyzeBridge] Request config: {"method":"POST","url":"app/v2/device/get_property_list","data":{"access_token":"<redacted>","app_name":"com.hualai.WyzeCam","app_ver":"wyze_developer_api","app_version":"wyze_developer_api","phone_id":"wyze_developer_api","phone_system_type":"1","sc":"wyze_developer_api","sv":"wyze_developer_api","ts":1694527608101,"device_mac":"D03F27940AED","device_model":"HL_BR30C"},"baseURL":"https://api.wyzecam.com"}
[9/12/2023, 9:06:48 AM] [WyzeBridge] Loading accessory from cache Kitchen Color 2 (MAC: D03F2793DF57)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Performing request: app/v2/device/get_property_list
[9/12/2023, 9:06:48 AM] [WyzeBridge] Request config: {"method":"POST","url":"app/v2/device/get_property_list","data":{"access_token":"<redacted>","app_name":"com.hualai.WyzeCam","app_ver":"wyze_developer_api","app_version":"wyze_developer_api","phone_id":"wyze_developer_api","phone_system_type":"1","sc":"wyze_developer_api","sv":"wyze_developer_api","ts":1694527608113,"device_mac":"D03F2793DF57","device_model":"HL_BR30C"},"baseURL":"https://api.wyzecam.com"}
[9/12/2023, 9:06:48 AM] [WyzeBridge] Loading accessory from cache Ravine (MAC: 7C78B286B5E0)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Loading accessory from cache Pool (MAC: 7C78B286B64B)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Loading accessory from cache Garage 2 (MAC: 7C78B286AD27)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Loading accessory from cache Back Garage (MAC: 7C78B286B604)
[9/12/2023, 9:06:48 AM] [WyzeBridge] API response PerformRequest: {"ts":1694527608438,"code":"1","msg":"","data":{"property_list":[{"pid":"P1501","value":"","ts":0},{"pid":"P1502","value":"","ts":0},{"pid":"P1503","value":"","ts":0},{"pid":"P1504","value":"","ts":0},{"pid":"P1505","value":"0","ts":0},{"pid":"P1506","value":"0","ts":0},{"pid":"P1507","value":"0","ts":0},{"pid":"P1508","value":"2","ts":0},{"pid":"P1509","value":"0","ts":0},{"pid":"P1510","value":"1","ts":0},{"pid":"P1511","value":"6918ab128e15486d","ts":1669954269621},{"pid":"P1512","value":"0","ts":0},{"pid":"P1513","value":"0","ts":0},{"pid":"P1514","value":"0","ts":0},{"pid":"P1516","value":"","ts":0},{"pid":"P1522","value":"","ts":0},{"pid":"P1523","value":"","ts":0},{"pid":"P1524","value":"","ts":0},{"pid":"P1525","value":"","ts":0},{"pid":"P1526","value":"","ts":0},{"pid":"P1527","value":"","ts":0},{"pid":"P1528","value":"0","ts":0},{"pid":"P1529","value":"0","ts":0},{"pid":"P1530","value":"0","ts":0},{"pid":"P1531","value":"0","ts":0},{"pid":"P1532","value":"0","ts":0},{"pid":"P1533","value":"","ts":0},{"pid":"P1534","value":"","ts":0},{"pid":"P16","value":"1","ts":0},{"pid":"P3","value":"1","ts":0},{"pid":"P5","value":"1","ts":0}]}}
[9/12/2023, 9:06:48 AM] [WyzeBridge] Updating brightness record for D03F27940517 (Broken) to : ""
[9/12/2023, 9:06:48 AM] [homebridge-wyze-smart-home] This plugin generated a warning from the characteristic 'Brightness': characteristic value expected valid finite number and received "NaN" (number). See https://homebridge.io/w/JtMGR for more info.
[9/12/2023, 9:06:48 AM] [homebridge-wyze-smart-home] Error: 
    at Brightness.Characteristic.characteristicWarning (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
    at Brightness.Characteristic.validateUserInput (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2903:14)
    at Brightness.Characteristic.updateValue (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2328:20)
    at WyzeMeshLight.updateBrightness (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:63:55)
    at WyzeMeshLight.updateCharacteristics (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:46:18)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeMeshLight.update (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:326:7)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Updating color Temp record for D03F27940517 (Broken) to : null
[9/12/2023, 9:06:48 AM] [homebridge-wyze-smart-home] This plugin generated a warning from the characteristic 'Color Temperature': characteristic value expected valid finite number and received "Infinity" (number). See https://homebridge.io/w/JtMGR for more info.
[9/12/2023, 9:06:48 AM] [homebridge-wyze-smart-home] Error: 
    at ColorTemperature.Characteristic.characteristicWarning (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
    at ColorTemperature.Characteristic.validateUserInput (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2903:14)
    at ColorTemperature.Characteristic.updateValue (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2328:20)
    at WyzeMeshLight.updateColorTemp (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:68:61)
    at WyzeMeshLight.updateCharacteristics (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:50:18)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeMeshLight.update (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:326:7)

/usr/lib/node_modules/homebridge-wyze-smart-home/node_modules/colorsys/colorsys.js:197
  return colorsys.rgb2Hsv(rgb.r, rgb.g, rgb.b)
                              ^
TypeError: Cannot read properties of null (reading 'r')
    at Object.colorsys.hex2Hsv (/usr/lib/node_modules/homebridge-wyze-smart-home/node_modules/colorsys/colorsys.js:197:31)
    at WyzeMeshLight.updateColor (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:73:31)
    at WyzeMeshLight.updateCharacteristics (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:54:18)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeMeshLight.update (/usr/lib/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:326:7)
[9/12/2023, 9:06:48 AM] [WyzeBridge] Child bridge process ended
[9/12/2023, 9:06:48 AM] [WyzeBridge] Process Ended. Code: 1, Signal: null

Repeating.

ibyrd1 commented 9 months ago

having this same issue as well...

jfarmer08 commented 8 months ago

https://github.com/jfarmer08/homebridge-wyze-smart-home/releases/tag/v0.5.37-alpha.4

jfarmer08 commented 8 months ago

https://github.com/jfarmer08/homebridge-wyze-smart-home/releases/tag/v0.5.37-alpha.5

jfarmer08 commented 8 months ago

This Thread should help https://github.com/jfarmer08/homebridge-wyze-smart-home/issues/190