jfarmer08 / homebridge-wyze-smart-home

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

Offline cameras showing as "On" in Home app #159

Closed danfratamico closed 8 months ago

danfratamico commented 9 months ago

Describe The Bug: On v0.5.37-alpha.1, my offline Wyzw cameras are showing as "On" in the Home app. On v0.5.36, my cameras would appear as "No Response" which is the expected behavior.

To Reproduce: Upgrade to v0.5.37-alpha.1 and experience the issue. Downgrade and the issue is no longer present.

Expected behavior: Inactive cameras should be listed as "No Response".

Logs:

N/A

Plugin Config:

            "name": "Wyze",
            "username": "XXX",
            "password": "XXX",
            "keyId": "XXX",
            "apiKey": "XXX",
            "mfaCode": "215739",
            "refreshInterval": 60000,
            "entryExitDelay": 30,
            "showAdvancedOptions": false,
            "logging": "none",
            "excludeMacAddress": false,
            "excludedeviceType": false,
            "platform": "WyzeSmartHome"

Screenshots: N/A

Environment:

github-actions[bot] commented 9 months ago

Message that will be displayed on users' first issue

jfarmer08 commented 9 months ago

Good call. I will add this back.

danfratamico commented 9 months ago

Good call. I will add this back.

Thanks, please let me know once an update has been published.

jfarmer08 commented 9 months ago

Update has been published, but could break something else.

danfratamico commented 9 months ago

Just updated to alpha3 and it still does not behave as it's supposed to. Turning the cameras off via the Home app force a Homebridge restart. After Homebridge restarts, the offline cameras show as "On". Here are my logs:

[10/6/2023, 6:40:03 PM] [Wyze] Error: DeviceIsOffline
    at WyzeAPI._performRequest (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:130:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeAPI.request (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:79:14)
    at WyzeAPI.runAction (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:274:20)
    at WyzeAPI.cameraPrivacy (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:783:56)
[10/6/2023, 6:40:03 PM] [Wyze] Error, refreshing access token and trying again
[10/6/2023, 6:40:03 PM] [Wyze] /var/lib/homebridge/persist/wyze-bcaf8973-0f75-5341-abfd-8ea75d25cd96.json
[10/6/2023, 6:40:04 PM] [Wyze] Error, logLevel in and trying again
[10/6/2023, 6:40:04 PM] [Wyze] /var/lib/homebridge/persist/wyze-bcaf8973-0f75-5341-abfd-8ea75d25cd96.json
[10/6/2023, 6:40:04 PM] Error: DeviceIsOffline
    at WyzeAPI._performRequest (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:130:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeAPI.runAction (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:274:20)
    at WyzeAPI.cameraPrivacy (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:783:56)
[10/6/2023, 6:40:04 PM] Got SIGTERM, shutting down Homebridge...
jfarmer08 commented 8 months ago

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

jfarmer08 commented 8 months ago

I will look at this again.

jfarmer08 commented 8 months ago

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

danfratamico commented 8 months ago

Alpha.4 still has the issue.

danfratamico commented 8 months ago

Just updated to alpha.5 and the statuses are now correct, although when I try to activate an "Off" camera from the Home app, it still reboots Homebridge.

jfarmer08 commented 8 months ago

So odd, I dont have that issue, but i will keep looking. A lot has changed in the last few releases.

danfratamico commented 8 months ago

Here are my Homebridge logs when I try and turn on a camera which is offline:

[10/28/2023, 8:42:12 AM] [Wyze] Error: DeviceIsOffline
    at WyzeAPI._performRequest (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:131:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeAPI.request (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:80:14)
    at WyzeAPI.runAction (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:275:20)
    at WyzeAPI.cameraPrivacy (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:787:56)
[10/28/2023, 8:42:12 AM] [Wyze] Error, refreshing access token and trying again
[10/28/2023, 8:42:13 AM] [Wyze] Error, logLevel in and trying again
[10/28/2023, 8:42:13 AM] Error: DeviceIsOffline
    at WyzeAPI._performRequest (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:131:13)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at WyzeAPI.runAction (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:275:20)
    at WyzeAPI.cameraPrivacy (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/wyze-api/src/index.js:787:56)
[10/28/2023, 8:42:13 AM] Got SIGTERM, shutting down Homebridge...
jfarmer08 commented 8 months ago

@danfratamico Can you check to make sure your camera is online before you try to turn it on?

danfratamico commented 8 months ago

@danfratamico Can you check to make sure your camera is online before you try to turn it on?

This is the reason for this submission. The cameras that are causing Homebridge to restart are Offline in the Wyze app. Matter of fact, they are in a box in my storage unit. Turning them On in the Home app should not cause Homebridge to restart. Maybe there is a way you can code the plugin to do nothing if the you receive a device offline reply from the Wyze API?

jfarmer08 commented 8 months ago

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

danfratamico commented 8 months ago

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

This update did the trick. No more Homebridge restarts, thanks!