-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix deprecation warnings on initialization #24
Conversation
This adds ClimateEntityFeature.TURN_ON and ClimateEntityFeature.TURN_OFF to supported features and disables the backwards compatibility flag related to those. This prevents a warning at initialization. Specific warning is: Entity None (<class 'custom_components.wundasmart.climate.Device'>) implements HVACMode(s): off, auto, heat and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please create a bug report at https://github.com/tonyroberts/hawundasmart/issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the TURN_ON/TURN_OFF flags, don't the "turn_on" and "turn_off" methods need to be implemented if those flags are set?
The way I read https://developers.home-assistant.io/blog/2024/01/24/climate-climateentityfeatures-expanded/ is that _enable_turn_on_off_backwards_compatibility should be set to False to stop those feature flags from being inferred automatically, but if the turn_on/turn_off methods are not implemented those feature flags should not be set.
Unless I'm missing something, either the turn_on/off methods need to be implemented, or the TURN_ON/TURN_OFF feature flags should not be set.
From https://github.com/home-assistant/core/blob/0643ff1cfe1057617cb6fda410084022f99d9252/homeassistant/components/climate/__init__.py#L746, it looks like the service calls always exist and if I thought the blog post was saying that the flag was necessary so that in the future these service calls would not be hidden. That said I find the documentation/blog posts quite terse and hard to decipher. Just to test things out, I created a button with this config for my kitchen sensor:
I clicked the button and confirmed the result with the wunda app. The kitchen thermostat was now set to on. I changed it turn_off and clicked it again and the thermostat was set to off. |
All that said, I removed the flags for now. Can always add them back later if the service calls are required. |
Thanks for the PR @danelphick! :) |
This fixes a couple of different warnings that show up in the logs.