Plugwise climate: add HVAC_Mode handling to set_temperature() ()

* Add HVAC_Mode handling to set_temperature()

* Move added code down, as suggested

* Implement walrus as suggested

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
Bouwe Westerdijk 2023-08-13 12:39:46 +02:00 committed by GitHub
parent fea4af69d7
commit 38cea8f31c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@ from __future__ import annotations
from typing import Any
from homeassistant.components.climate import (
ATTR_HVAC_MODE,
ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW,
ClimateEntity,
@ -161,6 +162,9 @@ class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity):
):
raise ValueError("Invalid temperature change requested")
if mode := kwargs.get(ATTR_HVAC_MODE):
await self.async_set_hvac_mode(mode)
await self.coordinator.api.set_temperature(self.device["location"], data)
@plugwise_command