mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-04-19 10:57:14 +00:00

* Add methods to climate entity. Add turn_on, turn_off, toggle to climate entity. * Mods * blog * Mods * style * link to doc * Fix link * Mod date * Update docs/core/entity/climate.md --------- Co-authored-by: G Johansson <goran.johansson@shiftit.se> Co-authored-by: Erik Montnemery <erik@montnemery.com>
693 B
693 B
author | authorURL | title |
---|---|---|
G Johansson | https://github.com/gjohansson-ST | New Climate entity toggle method |
As of Home Assistant Core 2024.3 we have added a new toggle
method to ClimateEntity
and users can now call climate.toggle
in their service calls.
Integrations that support turn_on
and turn_off
implicitly also support the toggle
method.
Read more about the toggle method in our documentation
Example (default implementation):
async def async_toggle(self) -> None:
"""Toggle the entity."""
if self.hvac_mode == HVACMode.OFF:
await self.async_turn_on()
else:
await self.async_turn_off()