SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
722 stars 112 forks source link

Latest update disables themostats? #560

Closed davidhearn3606 closed 2 months ago

davidhearn3606 commented 3 months ago

Describe the bug

After 3/21 update, previously working thermostats are not available To Reproduce Install latest wyze integration update

ValueError: is not a valid HVACMode 2024-03-21 14:10:05.978 WARNING (MainThread) [homeassistant.components.konnected.panel] Exception trying to connect to panel: 2024-03-21 14:10:10.322 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/update_manager.py", line 44, in update self.device.callback_function(self.device) File "/config/custom_components/wyzeapi/climate.py", line 316, in async_update_callback self.async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1227, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.__async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 322, in __getattribute__ return super().__getattribute__(__name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 414, in state return HVACMode(hvac_mode).value # type: ignore[unreachable] ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in __call__ return cls.__new__(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in __new__ raise ve_exc ValueError: is not a valid HVACMode 2024-03-21 14:10:35.791 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/update_manager.py", line 44, in update self.device.callback_function(self.device) File "/config/custom_components/wyzeapi/climate.py", line 316, in async_update_callback self.async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1227, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.__async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 322, in __getattribute__ return super().__getattribute__(__name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 414, in state return HVACMode(hvac_mode).value # type: ignore[unreachable] ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in __call__ return cls.__new__(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in __new__ raise ve_exc ValueError: is not a valid HVACMode 2024-03-21 14:10:52.058 WARNING (MainThread) [homeassistant.components.konnected.panel] Exception trying to connect to panel: 2024-03-21 14:11:06.140 ERROR (MainThread) [wyzeapy.services.update_manager] Unknown error happened during updating device info Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/wyzeapy/services/update_manager.py", line 44, in update self.device.callback_function(self.device) File "/config/custom_components/wyzeapi/climate.py", line 316, in async_update_callback self.async_schedule_update_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1227, in async_schedule_update_ha_state self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 992, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1113, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.__async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1050, in __async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 322, in __getattribute__ return super().__getattribute__(__name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 414, in state return HVACMode(hvac_mode).value # type: ignore[unreachable] ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in __call__ return cls.__new__(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in __new__ raise ve_exc
SecKatie commented 3 months ago

@brg468 this seems really weird... Why would an HVACMode not be an HVACMode???

FrankJaco commented 3 months ago

Happy to see I am not the only one who lost his Wyze Thermostats. What can we provide to help you resolve?

brg468 commented 3 months ago

I think I see what happened...We were using a HVACMode enum in the wyzeapy lib, but in this change HA also switched to a HVACMode enum in their constants. So we essentially are trying to set the HA state with our enum when its expecting theirs. 😞

brg468 commented 3 months ago

@SecKatie do you have a thermostat to test on?

brg468 commented 3 months ago

Anybody wanna test for me?

Download from my branch and replace your climate.py file with the one in my branch and restart. See if that corrects it.

https://github.com/brg468/ha-wyzeapi/tree/update-thermostat

davidhearn3606 commented 3 months ago

On it as soon as I get home. Wow, fast!

On Thu, Mar 21, 2024, 4:43 PM Brian Rogers @.***> wrote:

Anybody wanna test for me?

Download from my branch and replace your climate.py file with the one in my branch and restart. See if that corrects it.

https://github.com/brg468/ha-wyzeapi/tree/update-thermostat

— Reply to this email directly, view it on GitHub https://github.com/SecKatie/ha-wyzeapi/issues/560#issuecomment-2013694924, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL7J4FTVJQJJ37BMA3Q2WK3YZNA6FAVCNFSM6AAAAABFCAHVGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJTGY4TIOJSGQ . You are receiving this because you authored the thread.Message ID: @.***>

davidhearn3606 commented 3 months ago

Outstanding, amazing, and thank you! That seems to have done the trick! Quickest turnaround I've ever seen :)

David

On Thu, Mar 21, 2024 at 4:43 PM Brian Rogers @.***> wrote:

Anybody wanna test for me?

Download from my branch and replace your climate.py file with the one in my branch and restart. See if that corrects it.

https://github.com/brg468/ha-wyzeapi/tree/update-thermostat

— Reply to this email directly, view it on GitHub https://github.com/SecKatie/ha-wyzeapi/issues/560#issuecomment-2013694924, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL7J4FTVJQJJ37BMA3Q2WK3YZNA6FAVCNFSM6AAAAABFCAHVGSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJTGY4TIOJSGQ . You are receiving this because you authored the thread.Message ID: @.***>

-- David Hearn CIO - Florida Housing Finance Corporation 850-445-1503

talormanda commented 3 months ago

How do we get this updated in the official build?

jloberg1 commented 3 months ago

I too can confirm the updated climate.py file solved my thermostat issue. You are AWESOME!!!

carverofchoice commented 3 months ago

Did this get added into the 0.1.24 version that I'm showing is available now?

brg468 commented 3 months ago

It is not in that version. If yours is working now I wouldn’t upgrade, or follow my instructions above to patch.

piersonjarvis commented 3 months ago

This also worked for me. Hopefully this gets included in the next version.

th3jesta commented 3 months ago

Worked for me. Thanks so much!

Mr-Wicket commented 3 months ago

thanks for the patch!

piersonjarvis commented 2 months ago

It's broken again for me now. Tried reverting to the proper climate.py and back to the branch version, neither are working.

brg468 commented 2 months ago

Any logs?

jloberg1 commented 2 months ago

I just checked, and my Wyze thermostat is still working. I am current on Home Assistant (not beta) updates and not I am not showing any HACS updates pending. If things change, I will post an update.

piersonjarvis commented 2 months ago

Logger: homeassistant.components.climate Source: helpers/entity_platform.py:890 integration: Climate (documentation, issues) First occurred: 11:18:15 AM (1 occurrences) Last logged: 11:18:15 AM

Error adding entity climate.thermostat for domain climate with platform wyzeapi Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 890, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in async_calculate_state state = self._stringify_state(available) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state if (state := self.state) is None: ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 328, in getattribute return super().getattribute(name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/climate/init__.py", line 464, in state return HVACMode(hvac_mode).value # type: ignore[unreachable] ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 744, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/enum.py", line 1158, in new raise ve_exc ValueError: <HVACMode.AUTO: 'auto'> is not a valid HVACMode

piersonjarvis commented 2 months ago

I just checked, and my Wyze thermostat is still working. I am current on Home Assistant (not beta) updates and not I am not showing any HACS updates pending. If things change, I will post an update.

I also didn't see any updates, just one day it was showing unavailable again.