mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Move set_room_setpoint to opentherm_gw hub (#132152)
This commit is contained in:
parent
39b2cf6ed2
commit
3e2bac96e6
@ -47,6 +47,7 @@ from .const import (
|
||||
CONF_CLIMATE,
|
||||
CONF_FLOOR_TEMP,
|
||||
CONF_PRECISION,
|
||||
CONF_TEMPORARY_OVRD_MODE,
|
||||
CONNECTION_TIMEOUT,
|
||||
DATA_GATEWAYS,
|
||||
DATA_OPENTHERM_GW,
|
||||
@ -105,6 +106,7 @@ PLATFORMS = [
|
||||
async def options_updated(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||
"""Handle options update."""
|
||||
gateway = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][entry.data[CONF_ID]]
|
||||
gateway.options = entry.options
|
||||
async_dispatcher_send(hass, gateway.options_update_signal, entry)
|
||||
|
||||
|
||||
@ -469,7 +471,7 @@ class OpenThermGatewayHub:
|
||||
self.device_path = config_entry.data[CONF_DEVICE]
|
||||
self.hub_id = config_entry.data[CONF_ID]
|
||||
self.name = config_entry.data[CONF_NAME]
|
||||
self.climate_config = config_entry.options
|
||||
self.options = config_entry.options
|
||||
self.config_entry_id = config_entry.entry_id
|
||||
self.update_signal = f"{DATA_OPENTHERM_GW}_{self.hub_id}_update"
|
||||
self.options_update_signal = f"{DATA_OPENTHERM_GW}_{self.hub_id}_options_update"
|
||||
@ -565,3 +567,9 @@ class OpenThermGatewayHub:
|
||||
def connected(self):
|
||||
"""Report whether or not we are connected to the gateway."""
|
||||
return self.gateway.connection.connected
|
||||
|
||||
async def set_room_setpoint(self, temp) -> float:
|
||||
"""Set the room temperature setpoint on the gateway. Return the new temperature."""
|
||||
return await self.gateway.set_target_temp(
|
||||
temp, self.options.get(CONF_TEMPORARY_OVRD_MODE, True)
|
||||
)
|
||||
|
@ -28,7 +28,6 @@ from . import OpenThermGatewayHub
|
||||
from .const import (
|
||||
CONF_READ_PRECISION,
|
||||
CONF_SET_PRECISION,
|
||||
CONF_TEMPORARY_OVRD_MODE,
|
||||
DATA_GATEWAYS,
|
||||
DATA_OPENTHERM_GW,
|
||||
THERMOSTAT_DEVICE_DESCRIPTION,
|
||||
@ -102,14 +101,12 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity):
|
||||
if CONF_READ_PRECISION in options:
|
||||
self._attr_precision = options[CONF_READ_PRECISION]
|
||||
self._attr_target_temperature_step = options.get(CONF_SET_PRECISION)
|
||||
self.temporary_ovrd_mode = options.get(CONF_TEMPORARY_OVRD_MODE, True)
|
||||
|
||||
@callback
|
||||
def update_options(self, entry):
|
||||
"""Update climate entity options."""
|
||||
self._attr_precision = entry.options[CONF_READ_PRECISION]
|
||||
self._attr_target_temperature_step = entry.options[CONF_SET_PRECISION]
|
||||
self.temporary_ovrd_mode = entry.options[CONF_TEMPORARY_OVRD_MODE]
|
||||
self.async_write_ha_state()
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
@ -195,7 +192,5 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity):
|
||||
temp = float(kwargs[ATTR_TEMPERATURE])
|
||||
if temp == self.target_temperature:
|
||||
return
|
||||
self._new_target_temperature = await self._gateway.gateway.set_target_temp(
|
||||
temp, self.temporary_ovrd_mode
|
||||
)
|
||||
self._new_target_temperature = await self._gateway.set_room_setpoint(temp)
|
||||
self.async_write_ha_state()
|
||||
|
Loading…
x
Reference in New Issue
Block a user