mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 14:27:07 +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_CLIMATE,
|
||||||
CONF_FLOOR_TEMP,
|
CONF_FLOOR_TEMP,
|
||||||
CONF_PRECISION,
|
CONF_PRECISION,
|
||||||
|
CONF_TEMPORARY_OVRD_MODE,
|
||||||
CONNECTION_TIMEOUT,
|
CONNECTION_TIMEOUT,
|
||||||
DATA_GATEWAYS,
|
DATA_GATEWAYS,
|
||||||
DATA_OPENTHERM_GW,
|
DATA_OPENTHERM_GW,
|
||||||
@ -105,6 +106,7 @@ PLATFORMS = [
|
|||||||
async def options_updated(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
async def options_updated(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
||||||
"""Handle options update."""
|
"""Handle options update."""
|
||||||
gateway = hass.data[DATA_OPENTHERM_GW][DATA_GATEWAYS][entry.data[CONF_ID]]
|
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)
|
async_dispatcher_send(hass, gateway.options_update_signal, entry)
|
||||||
|
|
||||||
|
|
||||||
@ -469,7 +471,7 @@ class OpenThermGatewayHub:
|
|||||||
self.device_path = config_entry.data[CONF_DEVICE]
|
self.device_path = config_entry.data[CONF_DEVICE]
|
||||||
self.hub_id = config_entry.data[CONF_ID]
|
self.hub_id = config_entry.data[CONF_ID]
|
||||||
self.name = config_entry.data[CONF_NAME]
|
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.config_entry_id = config_entry.entry_id
|
||||||
self.update_signal = f"{DATA_OPENTHERM_GW}_{self.hub_id}_update"
|
self.update_signal = f"{DATA_OPENTHERM_GW}_{self.hub_id}_update"
|
||||||
self.options_update_signal = f"{DATA_OPENTHERM_GW}_{self.hub_id}_options_update"
|
self.options_update_signal = f"{DATA_OPENTHERM_GW}_{self.hub_id}_options_update"
|
||||||
@ -565,3 +567,9 @@ class OpenThermGatewayHub:
|
|||||||
def connected(self):
|
def connected(self):
|
||||||
"""Report whether or not we are connected to the gateway."""
|
"""Report whether or not we are connected to the gateway."""
|
||||||
return self.gateway.connection.connected
|
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 (
|
from .const import (
|
||||||
CONF_READ_PRECISION,
|
CONF_READ_PRECISION,
|
||||||
CONF_SET_PRECISION,
|
CONF_SET_PRECISION,
|
||||||
CONF_TEMPORARY_OVRD_MODE,
|
|
||||||
DATA_GATEWAYS,
|
DATA_GATEWAYS,
|
||||||
DATA_OPENTHERM_GW,
|
DATA_OPENTHERM_GW,
|
||||||
THERMOSTAT_DEVICE_DESCRIPTION,
|
THERMOSTAT_DEVICE_DESCRIPTION,
|
||||||
@ -102,14 +101,12 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity):
|
|||||||
if CONF_READ_PRECISION in options:
|
if CONF_READ_PRECISION in options:
|
||||||
self._attr_precision = options[CONF_READ_PRECISION]
|
self._attr_precision = options[CONF_READ_PRECISION]
|
||||||
self._attr_target_temperature_step = options.get(CONF_SET_PRECISION)
|
self._attr_target_temperature_step = options.get(CONF_SET_PRECISION)
|
||||||
self.temporary_ovrd_mode = options.get(CONF_TEMPORARY_OVRD_MODE, True)
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def update_options(self, entry):
|
def update_options(self, entry):
|
||||||
"""Update climate entity options."""
|
"""Update climate entity options."""
|
||||||
self._attr_precision = entry.options[CONF_READ_PRECISION]
|
self._attr_precision = entry.options[CONF_READ_PRECISION]
|
||||||
self._attr_target_temperature_step = entry.options[CONF_SET_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()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
@ -195,7 +192,5 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity):
|
|||||||
temp = float(kwargs[ATTR_TEMPERATURE])
|
temp = float(kwargs[ATTR_TEMPERATURE])
|
||||||
if temp == self.target_temperature:
|
if temp == self.target_temperature:
|
||||||
return
|
return
|
||||||
self._new_target_temperature = await self._gateway.gateway.set_target_temp(
|
self._new_target_temperature = await self._gateway.set_room_setpoint(temp)
|
||||||
temp, self.temporary_ovrd_mode
|
|
||||||
)
|
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user