Closed akudaikon closed 1 year ago
I do not have the thermostat, so I cannot check anything with this. However, it would seem that the presets would imply that part of the reply should include saved presets. No? If so, I would think that there should be a difference between presets and the current settings.
IE: the presets should be an array of names that could be called as presets by names (or name/value arrays?), presumably. Or is that not how the thermostat functions in-app either? This looks like it would only ever set the "preset" to whatever the current setting is.
I can only speak for what Home Assistant does and expects. It may be useful for the API to include a function that returns CONFIG_SCENARIO, which is a JSON array of all the presets and their high and low temperature settings, for people using it for a different purpose. Home Assistant, however, only cares about a way to set a preset as active and a way to get what the active preset is, which is what CURRENT_SCENARIO provides. Setting a preset as active makes the thermostat automatically update its high and low temperatures to its programmed high and low values for that preset (programmed via the app).
For Home Assistant, the list of available presets is given by the Climate/Thermostat object via:
def preset_modes(self) -> Optional[List[str]]: return [PRESET_HOME, PRESET_AWAY, PRESET_SLEEP]
As far as I know, there is no way to add additional custom presets. Only "Home", "Away", and "Sleep" exist. This is true in the Wyze app too.
From then, it only needs a function to get the current active preset (def preset_mode(self) -> Optional[str]
) and to set a new active preset (async def async_set_preset_mode(self, preset_mode: str) -> None
).
Pull request for the ha-wyzeapi side of things: https://github.com/JoshuaMulliken/ha-wyzeapi/pull/451
Not sure if using CONFIG_SCENARIO instead of CURRENT_SCENARIO was a bug, but changing it and re-adding the Preset property to the Thermostat class seems to work fine.
I've tested this by adding back in preset support in climate.py in ha-wyzeapi and I was able to switch preset modes via HA without any issues. I could also create a pull request for ha-wyzeapi if it'd help.
Thanks for all your work on maintaining this api!