jfarmer08 / homebridge-wyze-smart-home

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

Wyze Bulb Color and Light Strip Pro not changing colors as part of a scene #234

Closed escharhon closed 2 months ago

escharhon commented 3 months ago

Describe The Bug: When adding a Wyze Bulb Color or a Light Strip Pro to a scene and choosing a color and then activating the scene, the bulb does not change to the chosen color.

It does work if you choose a "temperature" (shades of white), but not a color (Red, green, blue etc)

To Reproduce: Add Wyze Bulb Color and\or Light Strip Pro to a scene and choose a color. Run the scene.

Expected behavior: The Wyze Bulb Color and\or Light Strip Pro should change to the color that is chosen in the scene.

Logs:

[3/9/2024, 5:00:52 PM] [Wyze] Initializing WyzeSmartHome platform...
[3/9/2024, 5:00:52 PM] [Wyze] Initializing child bridge XXXX
[3/9/2024, 5:00:52 PM] Loading 1 accessories...
[3/9/2024, 5:00:53 PM] [Wyze] Launched child bridge with PID 10943
[3/9/2024, 5:00:53 PM] [Wyze] Loaded homebridge-wyze-smart-home v0.5.46 child bridge successfully
[3/9/2024, 5:00:53 PM] Loaded 9 cached accessories from cachedAccessories.XXXX.
[3/9/2024, 5:00:53 PM] Homebridge v1.7.0 (HAP v0.11.1) (Wyze) is running on port XXXX.
[3/9/2024, 5:00:53 PM] Registering accessory 'homebridge-roomba2.Roomba2'
[3/9/2024, 11:00:26 PM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710054026162,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"e9badc9b968c9dd46948d1d9a6864e3d"},"headers":{"date":"Sun, 10 Mar 2024 07:00:26 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"297","x-ratelimit-reset-by":"Sun Mar 10 07:02:19 GMT 2024"}}
[3/9/2024, 11:00:26 PM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500
[3/9/2024, 11:02:26 PM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710054146880,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"6dcc110762894751471d195eb73925de"},"headers":{"date":"Sun, 10 Mar 2024 07:02:26 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"300","x-ratelimit-reset-by":"Sun Mar 10 07:07:26 GMT 2024"}}
[3/9/2024, 11:02:26 PM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500
[3/9/2024, 11:04:27 PM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710054267627,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"c13d9348ebd2dca5ad2acad3afcd95b2"},"headers":{"date":"Sun, 10 Mar 2024 07:04:27 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"298","x-ratelimit-reset-by":"Sun Mar 10 07:07:26 GMT 2024"}}
[3/9/2024, 11:04:27 PM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500
[3/9/2024, 11:05:27 PM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710054327908,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"cb9d19c43b78a5871305edb32c562505"},"headers":{"date":"Sun, 10 Mar 2024 07:05:27 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"297","x-ratelimit-reset-by":"Sun Mar 10 07:07:26 GMT 2024"}}
[3/9/2024, 11:05:27 PM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500
[3/10/2024, 12:00:55 AM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710057655162,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"2800a63cfec90cb11ce3528a09e8de80"},"headers":{"date":"Sun, 10 Mar 2024 08:00:55 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"297","x-ratelimit-reset-by":"Sun Mar 10 08:02:49 GMT 2024"}}
[3/10/2024, 12:00:55 AM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500
[3/10/2024, 12:02:55 AM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710057775918,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"514ee5c14e7b2b7e078f98588dbef014"},"headers":{"date":"Sun, 10 Mar 2024 08:02:55 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"299","x-ratelimit-reset-by":"Sun Mar 10 08:07:53 GMT 2024"}}
[3/10/2024, 12:02:55 AM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500
[3/10/2024, 6:17:07 AM] [Wyze] Wyze API Error (1000): 'internal error'
/homebridge/node_modules/homebridge-wyze-smart-home/node_modules/wyze-api/src/index.js:289
      throw new Error(`Wyze API Error (${code}) - ${errorMessage}`);
            ^
Error: Wyze API Error (1000) - internal error
    at WyzeAPI._performRequest (/homebridge/node_modules/homebridge-wyze-smart-home/node_modules/wyze-api/src/index.js:289:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeAPI.request (/homebridge/node_modules/homebridge-wyze-smart-home/node_modules/wyze-api/src/index.js:82:20)
    at WyzeAPI.getPropertyList (/homebridge/node_modules/homebridge-wyze-smart-home/node_modules/wyze-api/src/index.js:465:20)
    at WyzeAPI.getDevicePID (/homebridge/node_modules/homebridge-wyze-smart-home/node_modules/wyze-api/src/index.js:1148:12)
    at WyzeMeshLight.updateCharacteristics (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:56:28)
[3/10/2024, 6:17:07 AM] [Wyze] Child bridge process ended
[3/10/2024, 6:17:07 AM] [Wyze] Process Ended. Code: 1, Signal: null
[3/10/2024, 6:17:14 AM] [Wyze] Restarting Process...
[3/10/2024, 6:17:14 AM] [Wyze] Launched child bridge with PID 8132
[3/10/2024, 6:17:15 AM] Registering platform 'homebridge-wyze-smart-home.WyzeSmartHome'
[3/10/2024, 6:17:15 AM] [Wyze] Loaded homebridge-wyze-smart-home v0.5.46 child bridge successfully
[3/10/2024, 6:17:15 AM] Loaded 9 cached accessories from cachedAccessories.XXXX.
[3/10/2024, 6:17:15 AM] Homebridge v1.7.0 (HAP v0.11.1) (Wyze) is running on port XXXX.
[3/10/2024, 6:17:20 AM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710076640385,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"ceb916c2e715d620c03d3b1d5eb10859"},"headers":{"date":"Sun, 10 Mar 2024 13:17:20 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"297","x-ratelimit-reset-by":"Sun Mar 10 13:20:01 GMT 2024"}}
[3/10/2024, 6:17:20 AM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500
[3/10/2024, 6:19:26 AM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710076766114,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"75f789af05d3e98ca8b45e679c2ead6f"},"headers":{"date":"Sun, 10 Mar 2024 13:19:26 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"295","x-ratelimit-reset-by":"Sun Mar 10 13:20:01 GMT 2024"}}
[3/10/2024, 6:19:26 AM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500
[3/10/2024, 6:21:31 AM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710076891743,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"327169892a61d483442b417be25686fc"},"headers":{"date":"Sun, 10 Mar 2024 13:21:31 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"299","x-ratelimit-reset-by":"Sun Mar 10 13:25:26 GMT 2024"}}
[3/10/2024, 6:21:31 AM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500
[3/10/2024, 6:24:32 AM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710077072821,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"da3842cd2f92171afd8e4f27fff6051c"},"headers":{"date":"Sun, 10 Mar 2024 13:24:32 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"296","x-ratelimit-reset-by":"Sun Mar 10 13:25:26 GMT 2024"}}
[3/10/2024, 6:24:32 AM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500
[3/10/2024, 6:25:33 AM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","status":500,"data":{"code":"1000","ts":1710077133150,"msg":"INTERNAL_SERVICE_ERROR","data":{},"traceId":"2deafce119da350d9395daf4340b0d8e"},"headers":{"date":"Sun, 10 Mar 2024 13:25:33 GMT","content-type":"application/json","content-length":"120","connection":"close","x-ratelimit-remaining":"300","x-ratelimit-reset-by":"Sun Mar 10 13:30:32 GMT 2024"}}
[3/10/2024, 6:25:33 AM] [Wyze] Error getting devices: AxiosError: Request failed with status code 500

Plugin Config:

{
    "name": "Wyze",
    "username": "XXX@email.com",
    "password": "XXXX",
    "keyId": "XXXX",
    "apiKey": "XXXX",
    "refreshInterval": 60000,
    "hms": false,
    "showAdvancedOptions": true,
    "apiLogEnabled": false,
    "pluginLoggingEnabled": false,
    "lowBatteryPercentage": 30,
    "notificationAccessory": [
        "XXXX",
        "XXXX"
    ],
    "excludeMacAddress": false,
    "excludedeviceType": true,
    "filterDeviceTypeList": [
        "Camera"
    ],
    "_bridge": {
        "username": "XXXX",
        "port": 51881
    },
    "platform": "WyzeSmartHome"
}

Screenshots:

Environment:

Hochen97 commented 3 months ago

I am experiencing this same issue but haven’t had the time to detail it. Please let me know if I can provide any additional logs or configuration information to assist in triage/troubleshooting/RCA.

Hochen97 commented 2 months ago

Bumping this. :)

escharhon commented 2 months ago

After much fiddling I have determined that the issue here isn't with the Wyze homebridge plugin, but with Homekit scenes themselves. I used the Eve App to modify the scenes and set them to only change color (instead of powering on, setting brightness AND color all at the same time) and now when I run the scenes via the Apple Home app them they change properly. From googling around this seems to be a known issue about how Homekit scenes work, and the only fix at the moment is to use a third party app (like Eve), to modify the scene.

Hochen97 commented 1 month ago

So I found in the debug logs an issue where when changing multiple properties of lights as part of a scene (as @escharhon above mentioned) the P1507 (WYZE_API_COLOR_PROPERTY) value returns undefined. See below

[5/4/2024, 2:01:21 AM] [Wyze] run_action_list Data Body: {"action_list":[{"instance_id":"7C78B2214B0B","action_params":{"list":[{"mac":"7C78B2214B0B","plist":[{"pid":"P1507","pvalue":"undefined"},{"pid":"P3","pvalue":"1"}]}]},"provider_key":"WLPA19C","action_key":"set_mesh_property"}]}
[5/4/2024, 2:01:21 AM] [Wyze] run_action_list Data Body: {"action_list":[{"instance_id":"7C78B2214B0B","action_params":{"list":[{"mac":"7C78B2214B0B","plist":[{"pid":"P3","pvalue":"1"}]}]},"provider_key":"WLPA19C","action_key":"set_mesh_property"}]}

Now, interestingly, when setting ONLY the color value, as described above, for some reason the value is NOT undefined, but indeed contains a value.

[5/4/2024, 2:23:48 AM] [Wyze] run_action_list Data Body: {"action_list":[{"instance_id":"7C78B2214B0B","action_params":{"list":[{"mac":"7C78B2214B0B","plist":[{"pid":"P1507","pvalue":"ff6100"},{"pid":"P3","pvalue":"1"}]}]},"provider_key":"WLPA19C","action_key":"set_mesh_property"}]}

I'm not sure that this issue originates specifically from how HomeKit handles scenes, but instead how this plugin is handling that input.

And after investigating further (finding the plugin log setting) I was able to rip a log of exactly that happening.

[5/4/2024, 2:35:19 AM] [Wyze] [MeshLight] Setting brightness for "Office Light Center (7C78B2214B0B) to 1"
[5/4/2024, 2:35:19 AM] [Wyze] run_action_list Data Body: {"action_list":[{"instance_id":"7C78B2214B0B","action_params":{"list":[{"mac":"7C78B2214B0B","plist":[{"pid":"P1501","pvalue":"1"},{"pid":"P3","pvalue":"1"}]}]},"provider_key":"WLPA19C","action_key":"set_mesh_property"}]}
[5/4/2024, 2:35:19 AM] [Wyze] [MeshLight] Setting saturation (color) for "Office Light Center (7C78B2214B0B) to 100"
[5/4/2024, 2:35:19 AM] [Wyze] [MeshLight] H(S) Values: 100, 100
[5/4/2024, 2:35:19 AM] [Wyze] [MeshLight] Setting hue (color) for "Office Light Center (7C78B2214B0B) to 23 : (H)S Values: 23, 100"
[5/4/2024, 2:35:19 AM] [Wyze] ff6100
[5/4/2024, 2:35:19 AM] [Wyze] run_action_list Data Body: {"action_list":[{"instance_id":"7C78B2214B0B","action_params":{"list":[{"mac":"7C78B2214B0B","plist":[{"pid":"P1507","pvalue":"undefined"},{"pid":"P3","pvalue":"1"}]}]},"provider_key":"WLPA19C","action_key":"set_mesh_property"}]}
[5/4/2024, 2:35:19 AM] [Wyze] [MeshLight] Setting power for "Office Light Center (7C78B2214B0B)" to true"
[5/4/2024, 2:35:19 AM] [Wyze] run_action_list Data Body: {"action_list":[{"instance_id":"7C78B2214B0B","action_params":{"list":[{"mac":"7C78B2214B0B","plist":[{"pid":"P3","pvalue":"1"}]}]},"provider_key":"WLPA19C","action_key":"set_mesh_property"}]}

Here's the plugin log equivalent of the hue changes working:

[5/4/2024, 2:43:52 AM] [Wyze] [MeshLight] Setting hue (color) for "Office Light Center (7C78B2214B0B) to 23 : (H)S Values: 23, 100"
[5/4/2024, 2:43:52 AM] [Wyze] [MeshLight] Setting saturation (color) for "Office Light Center (7C78B2214B0B) to 100"
[5/4/2024, 2:43:52 AM] [Wyze] [MeshLight] H(S) Values: 100, 100
[5/4/2024, 2:43:52 AM] [Wyze] run_action_list Data Body: {"action_list":[{"instance_id":"7C78B2214B0B","action_params":{"list":[{"mac":"7C78B2214B0B","plist":[{"pid":"P1507","pvalue":"ff6100"},{"pid":"P3","pvalue":"1"}]}]},"provider_key":"WLPA19C","action_key":"set_mesh_property"}]}

Interestingly the hexValue is NOT logged in this scenario, which leads me to believe this is using a different function.

I'm not intimately familiar with the codebase, so I don't quite know where to go from here. I've traced the issue to—I think—the code in setHue() on line 209 in /accessories/WyzeMeshLight.js. It's obvious in the above logs that the application successfully produces a hexadecimal hue value (ff6100) for the API to consume, however it doesn't seem to make it there.