jfarmer08 / homebridge-wyze-smart-home

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

Thermostat temperature does not get set #111

Closed xenonaxel closed 11 months ago

xenonaxel commented 1 year ago

Followed documentation to setup plugin in Homebridge. When I go to set the temperature for the Wyze thermostat it does not get set on the device itself. I reload the home app and my change gets reverted. I am able to change the state just not the temperature

I have installed different versions and tried to modify the code with my limited knowledge. It has always been reproduceable on my instance

When I set the temperature in the Home app the device will reflect the change

There is nothing in the logs as far as I can tell.

    {
        "name": "Wyze",
        "username": "email@domain.com",
        "password": "password",
        "refreshInterval": 60000,
        "entryExitDelay": 30,
        "mfaCode": "502640",
        "showAdvancedOptions": true,
        "excludeMacAddress": false,
        "excludedeviceType": true,
        "filterDeviceTypeList": [
            "Camera"
        ],
        "platform": "WyzeSmartHome"
    }

Plugin Version: 0.5.28 Homebridge Version: v1.6.1 Node.js Version: v18.16.0 NPM Version: 9.5.1 Operating System: Debian 10

github-actions[bot] commented 1 year ago

Message that will be displayed on users' first issue

jfarmer08 commented 1 year ago

@carTloyal123 Have you seen anything like this with the Thermostat?

xenonaxel commented 12 months ago

@jfarmer08 Any I can grab from my end to help?

jfarmer08 commented 12 months ago

Can you turn on debug and send me the full log?

carTloyal123 commented 12 months ago

I have not seen this be an issue before as far as I remember. Some logs would be great! I suppose it’s possible something has changed recently on theWyze side but I haven’t seen any device updates to suggest that.

xenonaxel commented 12 months ago

I turned debug on and got the logs. You can see around line 60 I set the temperature in the home app. I closed it and reopened it and it reverted to the original status. homebridge.log.txt

xenonaxel commented 12 months ago

More weird behavior. When I change it in the Home app it just immediately reverts the change now. [7/9/2023, 9:55:11 AM] [Wyze] [Thermostat] Getting targetTemperature status of "Wyze Thermostat" to 75 [7/9/2023, 9:55:11 AM] [Wyze] Thermostat Target Temp: 76 [7/9/2023, 9:55:11 AM] [Wyze] Thermostat Cool Setpoint: 76 [7/9/2023, 9:55:11 AM] [Wyze] Thermostat Heat Setpoint: 68

jfarmer08 commented 12 months ago

@xenonaxel So it is working or its not working?

carTloyal123 commented 12 months ago

I have actually seen this rebounding behavior and seen it quite often. Definitely happens if you update the temperature but don’t actually save that value correctly to the Homebridge plugin. This is why it appears to revert immediately. As far as why this is happening for you, it is hard to say just from the logs. My thermostat is down at the moment but I can set up my test device this week and double check. Do you have anything automating your thermostat besides using Homebridge? Also, what mode are you trying to use on your AC? Just heat, just cool or auto?

xenonaxel commented 12 months ago

@jfarmer08 it is not working. The temperature still resets. It seems to switch between not ever taking the change or saying it changed but after I reopen the app it doesn't. as @carTloyal123 mentioned I don't think it's been set in the plugin. From my understanding of the logs it just queries the device again to get the current temperature instead of updating it.

Another thing I noticed in the logs is it keeps saying pulling cached device for the wyze thermostat but does not happen for any other device.

carTloyal123 commented 12 months ago

And what about other automations and the mode you are trying to use for your system? @xenonaxel

xenonaxel commented 12 months ago

@carTloyal123 Sorry forgot to add that to the reply. I am not using anything in addition to homebridge to automate my Wyze Thermostat. It doesn't seem to matter the mode. AC, Heat or Auto the temperature will not change. I can change the mode in HomeKit and it changes on the device. So part of it works just not setting the temp.

carTloyal123 commented 12 months ago

Gotcha thank you. As far as I can tell, the auto mode should work just fine. To be clear, this is the mode in HomeKit where you can set both the high and low temp on the same screen. This is the mode I built the plugin specifically for since all three modes (heat, cool and auto) are implemented separately. Do me a favor and set the system to auto, wait until a new set of log messages come up with the thermostat status, then set the heat or cool temp. If you will post that log for me that would be fantastic. Pretty much all of my testing and debugging revolved around auto mode so let’s nail that down first, thanks!

xenonaxel commented 12 months ago

homebridge.log (1).txt Sure thing. Logs attached. Also I apologize. Auto mode does work. It changes on the device.

xenonaxel commented 12 months ago

@carTloyal123 homebridge.log (2).txt Additional logs. I set it back to cool after setting the auto temp.

carTloyal123 commented 12 months ago

Thank you for the extra logs, that will be helpful. So to confirm, your system on AUTO mode works totally correctly OR it only sets the system to auto but changing the temperature is still broken once in AUTO mode?

xenonaxel commented 12 months ago

@carTloyal123 auto mode works correctly. The temperature change does get set.

carTloyal123 commented 12 months ago

@xenonaxel awesome thanks for confirming that. I will check this out this week and maybe even today if I have time later. @jfarmer08 you can assign it to me if you like and I’ll follow up with updates

jfarmer08 commented 11 months ago

@carTloyal123 Any Update on this?

carTloyal123 commented 11 months ago

I have a fix I think. Haven’t been home this week to test it but I will today.

carTloyal123 commented 11 months ago

So, I have an update on my own fork of the repo and I will submit a PR to finalize it. As far as I can tell, the behavior should be more appropriate now for heat/cool single modes. I would definitely like for @xenonaxel to test it on his system so we can confirm everyone has the same experience. My device is currently not being used in my home but I have been testing as best I can. I will link the PR here shortly

carTloyal123 commented 11 months ago

119

xenonaxel commented 11 months ago

@carTloyal123 Looks to be working! The only oddity I noticed is if I switch from cool to heat or vice versa the temperature doesn't update until I reopen the app but that's more user experience. It doesn't break functionality. Thank you so much for your work on this. I will continue to do testing on my end and update if anything changes.

carTloyal123 commented 11 months ago

Great to hear it is behaving better now. If you want to demonstrate the issue of changing from heat to cool or vice versa and send a log and/or a screen capture of your iOS device that would be great. Now that I have my development environment set back up it is much easier to make updates.

carTloyal123 commented 11 months ago

Also, it looks like @jfarmer08 has not merged my changes yet so did you get a version of the plugin from my development PR? How did you get the new version to test? @xenonaxel

carTloyal123 commented 11 months ago

@xenonaxel what exactly do you mean the temp doesn't update until you restart the app? What are you expecting to happen? Could you give me an example here?

xenonaxel commented 11 months ago

@carTloyal123 Yes, I took it from your development PR. I will test more thoroughly when @jfarmer08 updates the main repo. I have screenshots of the behavior.

Screenshot 2023-07-16 at 3 03 16 PM

Reflects current state and temperature.

Screenshot 2023-07-16 at 3 03 25 PM

I switch it to heat mode. It says heat to 74. (Which is the temperature from the cooling state)

Screenshot 2023-07-16 at 3 03 31 PM

I close the Home App and reopen it. It shows the correct temperature.

From what I can tell this is just a UI bug. My guess is when I switch states it's not calling for the new temperature data right away until I relaunch the app.

carTloyal123 commented 11 months ago

@xenonaxel awesome thanks for the extra info. I can also recreate this on my test setup. I think I can fix this but you are right that the current Homekit implementation does not actually ask for the corresponding temperature when changing modes. Not sure if this is on purpose from Apple or if the expectation is that the accessory should handle this. Either way I am working on a fix and will update if it looks good. Thanks for the extra info!

carTloyal123 commented 11 months ago

I pushed a small change that is a bit of a hack until I can find out what the correct behavior/data flow should be.

carTloyal123 commented 11 months ago

@jfarmer08 thanks for the merge, would you close this issue please?

Barba4life commented 6 months ago

how would one go about applying your fix?

using NAS-Synology

carTloyal123 commented 6 months ago

If you have the last est version of the plugin it should be applied already. Feel free to open a new issue if you are still seeing strange behavior

Barba4life commented 5 months ago

Just made one, hopefully you can help. Thank you.

“Thermostat Not Working #203”