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
Add on/off supported feature to climate #11379
Conversation
What's the advantage over adding an 'off' |
@tinloaf The list of operation modes comes from sensibo API, it is not hardcoded into the platform. Also on/off is unrelated to operation mode. This is like saying that lights don't need on/off as we could set brightness to 0 or rgb color to 'black'. |
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.
Looks good! A minor comment below.
if self.current_operation: | ||
return self.current_operation | ||
if self.is_on: | ||
return STATE_ON | ||
return STATE_UNKNOWN |
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.
This should preferably return None
as we want the Entity
base class to handle that case, ie set STATE_UNKNOWN
.
I'm also torn between adding this on/off service or just let operation mode handle that. But I think we could add it now, and postpone the final decision until we have the new outline decided for how the climate component should be changed for the better. |
I think it adds even more diversity into the climate component. Even if we are going to do a big refactoring some time soon, this won't make it easier. Currently the items of the My suggestion would be: add a special 'off' mode to the list of |
The operations in Sensibo depend on the A/C model. They could include 'heat', 'cold', 'fan', 'dry', 'auto', etc. But whatever Sensibo does is irrelevant to this PR. I think different parts of the world have different "types" of thermostats, thus this misunderstanding. When I first started with HA the current way climate is implemented made no sense to me. The main thing each A/C has is an on/off. What it does when it is on is platform-dependent implementation detail. To me the suggestion to add 'off' to operations is like to say that lights don't need on/off as 'off' can be added to brightness or rgb color or blink/not-blink mode. |
I don't have too strong feelings towards this. ;-) You're right, adding a separate on / off switch might make sense in the component overall, maybe we should do this when doing the refactoring. An on / off setting could also be represented via a toggle in the UI, while an operation mode will probably always be a list to pick from. |
I have to agree with @andrey-git that adding on/off makes sense. Even with Inside the component you can easily just passthrough the on/off to the thermostat or make a transformation to operation_mode. Later edit: Also if Climate gets a toggle switch, you could switch all Climates within a group (that also would get that toggle switch) Off at the same time. This is useful in a house with multiple zones that each have a thermostat when you enter summer time and want to make sure your heating stays off. |
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.
One general remark: Currently, scenes allow for exactly one service call per entity. Thus, with your current approach, it is not possible to turn a climate device on and set it to a certain temperature, operation mode or anything within a scene. I guess that basically renders climate devices useless in scenes, since you can never be sure that the device is on, thus always have to call SERVICE_TURN_ON, and can never set any "real" value from within the scene.
The way that e.g. the light component currently handles this is to accept all kind of parameters in its SERVICE_TURN_ON. I guess that would be a feasible approach here, too. However, the climate component already has something similar: the SERVICE_SET_TEMPERATURE also accepts an operation mode, to allow setting both via a scene. Thus, one could also make SERVICE_SET_TEMPERATURE accept an additional turn_on flag or something. I would consider adding most (or all?) possible parameters to SERVICE_TURN_ON cleaner, though.
That is a problem of scene and how that work or even not. I don't think this PR could solve that or should try it. It's like media_player. In this case the core changes are okay |
But then we should label this a breaking change, since the configuration of people using climate devices (at least from sensibo and all other platforms that will implement |
The change is breaking if it changes existing functionality or requires a config change. |
True. Existing configurations should never call |
Description:
There are different climate platforms in the wild, but up until now the general assumption was that it is a mostly always-on device that can change a mode of operation.
This PR brings a better support for A/C units that are manually turned on and off by adding SUPPORT_ON_OFF to supported_features and turn_on and turn_off services.
Support for on/off is added to Sensibo platform.
Meanwhile Sensibo keeps the aux_heat support to make this change backwards compatible. When on/off support is added to the frontend - Sensibo should drop the aux_heat support.
This PR implements part of #11295
Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#4306
Checklist:
If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
tox
run successfully. Your PR cannot be merged unless tests passREQUIREMENTS
variable ([example][ex-requir]).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.