jfarmer08 / homebridge-wyze-smart-home

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

The plugin constantly reboots itself #228

Open pughpypants opened 4 months ago

pughpypants commented 4 months ago

This is incredible. Thank you for adding the thermostat! I've been waiting a long time for this. I'm new to Github. Apologies in advance if I'm not providing enough context.

I don't see the Wyze thermostat on the Accessories page in HB or in Homekit. FYI, I only have a Wyze Theremostat. No other Wyze products.

Describe The Bug:

The Wyze plugin launches and ends over and over. I updated to v0.5.45 today hoping the newest version would fix the problem, but it's still in a constant loop. Restarting and ending...

To Reproduce:

Happens every time I enable the plugin.

Expected behavior:

Enable the plugin. It runs for a moment and then shuts down. Restarts and runs for a moment and shuts down, repeatedly.

Logs:

[2/25/2024, 2:34:20 PM] [Wyze] Launched child bridge with PID 18701
[2/25/2024, 2:34:21 PM] Registering platform 'homebridge-wyze-smart-home.WyzeSmartHome'
[2/25/2024, 2:34:21 PM] [Wyze] Loaded homebridge-wyze-smart-home v0.5.45 child bridge successfully
[2/25/2024, 2:34:21 PM] Loaded 1 cached accessories from cachedAccessories.0E69E1C06C3C.
[2/25/2024, 2:34:21 PM] Homebridge v1.7.0 (HAP v0.11.1) (Wyze) is running on port 54002.

/volume1/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:34
    this.homeKitAccessory.context.device_params.temperature = value;
                                                            ^
TypeError: Cannot set properties of undefined (setting 'temperature')
    at WyzeThermostat.set thermostatTemperature [as thermostatTemperature] (/volume1/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:34:61)
    at WyzeThermostat.thermostatGetIotProp (/volume1/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeAccessory.js:158:32)
    at WyzeThermostat.updateCharacteristics (/volume1/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeThermostat.js:231:10)
    at new WyzeThermostat (/volume1/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeThermostat.js:60:10)
    at WyzeSmartHome.configureAccessory (/volume1/homebridge/node_modules/homebridge-wyze-smart-home/src/WyzeSmartHome.js:221:19)
    at /volume1/homebridge/node_modules/homebridge/src/bridgeService.ts:328:25
    at Array.filter (<anonymous>)
    at BridgeService.restoreCachedPlatformAccessories (/volume1/homebridge/node_modules/homebridge/src/bridgeService.ts:288:69)
    at ChildBridgeFork.startBridge (/volume1/homebridge/node_modules/homebridge/src/childBridgeFork.ts:186:24)
[2/25/2024, 2:34:21 PM] [Wyze] Child bridge process ended
[2/25/2024, 2:34:21 PM] [Wyze] Process Ended. Code: 1, Signal: null
[2/25/2024, 2:34:28 PM] [Wyze] Restarting Process...

Plugin Config:

{
    "name": "Wyze",
    "username": "----",
    "password": "----",
    "keyId": "----",
    "apiKey": "----",
    "refreshInterval": 60000,
    "hms": false,
    "showAdvancedOptions": false,
    "apiLogEnabled": false,
    "logLevel": "none",
    "lowBatteryPercentage": 30,
    "excludeMacAddress": false,
    "excludedeviceType": false,
    "platform": "WyzeSmartHome",
    "_bridge": {
        "username": "----",
        "port": 54002
    }
}

Screenshots:

Wyze-Homebridge-error

Environment:

Plugin Version: v0.5.45 Homebridge Version: V4.55.1 Node.js Version: 20.9 NPM Version: I don't know how to find this. Operating System: DSM 7.2.1-69057 Update 4

github-actions[bot] commented 4 months ago

Message that will be displayed on users' first issue

jfarmer08 commented 4 months ago

@carTloyal123 Any idea what would cause this?

carTloyal123 commented 4 months ago

@carTloyal123 Any idea what would cause this?

Hmm since I haven't merged any changes from my dev branches nothing should have changed. It looks like something to do with the refactors that have been happening with the WyzeAccessory class. I will take a look at this.

@pughpypants what happens if you have no accessories in the plugin? You can do this by setting your exclude device list in your config. I would like to narrow this down to the thermostat rather than a bigger issue if possible.

carTloyal123 commented 4 months ago

Related to #203

carTloyal123 commented 4 months ago

The changes have been merged, when a new release comes out should be able to test the fixes.

jfarmer08 commented 4 months ago

New release is out.

pughpypants commented 4 months ago

Apologies for the lack of communication. @carTloyal123 @jfarmer08 I just got home from a work trip. I updated the plugin two min ago and it appears to be functioning. The thermostat is in our bedroom so I'll need to do some tests when my wife isn't sleeping to confirm.

Thank you!

jfarmer08 commented 3 months ago

How is it going?

pughpypants commented 3 months ago

Hi @jfarmer08 The plugin is now showing up in the Home app. The only functionality that seems to work is turning the thermostat on/off and the it is able to read the correct temp of the room. However, I'm unable to change the target temp. If I change the target temp with the plugin it is not reflected on the thermostat and vice versa.

Here are the recent logs in case it's useful.

[3/6/2024, 7:22:1

4 AM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","message":"getaddrinfo EAI_AGAIN api.wyzecam.com"} [3/6/2024, 7:22:14 AM] [Wyze] Error getting devices: Error: getaddrinfo EAI_AGAIN api.wyzecam.com [3/6/2024, 7:25:23 AM] [Wyze] Request Failed: {"url":"app/v2/home_page/get_object_list","message":""} [3/6/2024, 7:25:23 AM] [Wyze] Error getting devices: AggregateError

pughpypants commented 3 months ago

Hang on. I just noticed a firmware update for the thermostat. 1.2.7 > 1.2.8 Gonna update to see if that has any effect.

orenschor commented 3 months ago

Hi, I'm new to to homebridge. This plug in has been working fine for 2 days and then today started rebooting itself (and the entire server). Attaching logs:

[3/7/2024, 11:46:47 AM] TypeError: Cannot read properties of null (reading 'r') at Object.colorsys.hex2Hsv (/homebridge/node_modules/homebridge-wyze-smart-home/node_modules/colorsys/colorsys.js:197:31) at WyzeMeshLight.updateColor (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:104:31) at WyzeMeshLight.updateCharacteristics (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:69:46) at processTicksAndRejections (node:internal/process/task_queues:95:5) [3/7/2024, 11:46:47 AM] Got SIGTERM, shutting down Homebridge... [3/7/2024, 11:46:47 AM] TypeError: Cannot read properties of null (reading 'r') at Object.colorsys.hex2Hsv (/homebridge/node_modules/homebridge-wyze-smart-home/node_modules/colorsys/colorsys.js:197:31) at WyzeMeshLight.updateColor (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:104:31) at WyzeMeshLight.updateCharacteristics (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:69:46) at processTicksAndRejections (node:internal/process/task_queues:95:5)

orenschor commented 3 months ago

I tried refreshing the API key and problem persists with similar error:

[3/7/2024, 11:55:41 AM] TypeError: Cannot read properties of null (reading 'r') at Object.colorsys.hex2Hsv (/homebridge/node_modules/homebridge-wyze-smart-home/node_modules/colorsys/colorsys.js:197:31) at WyzeMeshLight.updateColor (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:104:31) at WyzeMeshLight.updateCharacteristics (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:69:46) at processTicksAndRejections (node:internal/process/task_queues:95:5) [3/7/2024, 11:55:41 AM] Got SIGTERM, shutting down Homebridge...

orenschor commented 3 months ago

@jfarmer08 @carTloyal123 I have managed to narrowed it down by device type. The type that causes the plugin to crash and reboot the server is MeshLight. image Using the config above works, though obviously lights do not appear.

Let me know if this can be fixed.

pughpypants commented 3 months ago

Hang on. I just noticed a firmware update for the thermostat. 1.2.7 > 1.2.8 Gonna update to see if that has any effect.

@jfarmer08 @carTloyal123

Adjusting the target temp remotely is now working after the firmware update. The only thing I'm noticing is that it takes a couple of minutes for the thermostat to register the change and vice versa. Other than that, it's working!

Thanks again.

carTloyal123 commented 3 months ago

@jfarmer08 @carTloyal123

I have managed to narrowed it down by device type. The type that causes the plugin to crash and reboot the server is MeshLight.

image

Using the config above works, though obviously lights do not appear.

Let me know if this can be fixed.

@orenschor Please open a new issue for this since it is mesh light related and not thermostat related. I realize this thread is for the plugin rebooting but the issues are separate, thanks!

carTloyal123 commented 3 months ago

Hang on. I just noticed a firmware update for the thermostat. 1.2.7 > 1.2.8 Gonna update to see if that has any effect.

@jfarmer08 @carTloyal123

Adjusting the target temp remotely is now working after the firmware update. The only thing I'm noticing is that it takes a couple of minutes for the thermostat to register the change and vice versa. Other than that, it's working!

Thanks again. @pughpypants A few minutes? That seems pretty odd. Feel free to open a new issue to address this as it seems pretty difficult to use at that level of responsiveness. :/