mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Fix nobo_hub HVAC mode (#83947)
This commit is contained in:
parent
98eabd2f68
commit
c7d1402320
@ -19,7 +19,6 @@ from homeassistant.components.climate import (
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_IDENTIFIERS,
|
ATTR_IDENTIFIERS,
|
||||||
ATTR_MODE,
|
|
||||||
ATTR_NAME,
|
ATTR_NAME,
|
||||||
ATTR_SUGGESTED_AREA,
|
ATTR_SUGGESTED_AREA,
|
||||||
ATTR_VIA_DEVICE,
|
ATTR_VIA_DEVICE,
|
||||||
@ -29,12 +28,10 @@ from homeassistant.const import (
|
|||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.util import dt
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_OVERRIDE_ALLOWED,
|
|
||||||
ATTR_SERIAL,
|
ATTR_SERIAL,
|
||||||
ATTR_TARGET_ID,
|
|
||||||
ATTR_TARGET_TYPE,
|
|
||||||
ATTR_TEMP_COMFORT_C,
|
ATTR_TEMP_COMFORT_C,
|
||||||
ATTR_TEMP_ECO_C,
|
ATTR_TEMP_ECO_C,
|
||||||
CONF_OVERRIDE_TYPE,
|
CONF_OVERRIDE_TYPE,
|
||||||
@ -124,12 +121,9 @@ class NoboZone(ClimateEntity):
|
|||||||
await self.async_set_preset_mode(PRESET_NONE)
|
await self.async_set_preset_mode(PRESET_NONE)
|
||||||
elif hvac_mode == HVACMode.HEAT:
|
elif hvac_mode == HVACMode.HEAT:
|
||||||
await self.async_set_preset_mode(PRESET_COMFORT)
|
await self.async_set_preset_mode(PRESET_COMFORT)
|
||||||
self._attr_hvac_mode = hvac_mode
|
|
||||||
|
|
||||||
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
||||||
"""Set new zone override."""
|
"""Set new zone override."""
|
||||||
if self._nobo.zones[self._id][ATTR_OVERRIDE_ALLOWED] != "1":
|
|
||||||
return
|
|
||||||
if preset_mode == PRESET_ECO:
|
if preset_mode == PRESET_ECO:
|
||||||
mode = nobo.API.OVERRIDE_MODE_ECO
|
mode = nobo.API.OVERRIDE_MODE_ECO
|
||||||
elif preset_mode == PRESET_AWAY:
|
elif preset_mode == PRESET_AWAY:
|
||||||
@ -163,7 +157,7 @@ class NoboZone(ClimateEntity):
|
|||||||
@callback
|
@callback
|
||||||
def _read_state(self) -> None:
|
def _read_state(self) -> None:
|
||||||
"""Read the current state from the hub. These are only local calls."""
|
"""Read the current state from the hub. These are only local calls."""
|
||||||
state = self._nobo.get_current_zone_mode(self._id)
|
state = self._nobo.get_current_zone_mode(self._id, dt.now())
|
||||||
self._attr_hvac_mode = HVACMode.AUTO
|
self._attr_hvac_mode = HVACMode.AUTO
|
||||||
self._attr_preset_mode = PRESET_NONE
|
self._attr_preset_mode = PRESET_NONE
|
||||||
|
|
||||||
@ -176,17 +170,8 @@ class NoboZone(ClimateEntity):
|
|||||||
elif state == nobo.API.NAME_COMFORT:
|
elif state == nobo.API.NAME_COMFORT:
|
||||||
self._attr_preset_mode = PRESET_COMFORT
|
self._attr_preset_mode = PRESET_COMFORT
|
||||||
|
|
||||||
if self._nobo.zones[self._id][ATTR_OVERRIDE_ALLOWED] == "1":
|
if self._nobo.get_zone_override_mode(self._id) != nobo.API.NAME_NORMAL:
|
||||||
for override in self._nobo.overrides:
|
self._attr_hvac_mode = HVACMode.HEAT
|
||||||
if self._nobo.overrides[override][ATTR_MODE] == "0":
|
|
||||||
continue # "normal" overrides
|
|
||||||
if (
|
|
||||||
self._nobo.overrides[override][ATTR_TARGET_TYPE]
|
|
||||||
== nobo.API.OVERRIDE_TARGET_ZONE
|
|
||||||
and self._nobo.overrides[override][ATTR_TARGET_ID] == self._id
|
|
||||||
):
|
|
||||||
self._attr_hvac_mode = HVACMode.HEAT
|
|
||||||
break
|
|
||||||
|
|
||||||
current_temperature = self._nobo.get_current_zone_temperature(self._id)
|
current_temperature = self._nobo.get_current_zone_temperature(self._id)
|
||||||
self._attr_current_temperature = (
|
self._attr_current_temperature = (
|
||||||
|
@ -14,7 +14,4 @@ ATTR_SOFTWARE_VERSION = "software_version"
|
|||||||
ATTR_SERIAL = "serial"
|
ATTR_SERIAL = "serial"
|
||||||
ATTR_TEMP_COMFORT_C = "temp_comfort_c"
|
ATTR_TEMP_COMFORT_C = "temp_comfort_c"
|
||||||
ATTR_TEMP_ECO_C = "temp_eco_c"
|
ATTR_TEMP_ECO_C = "temp_eco_c"
|
||||||
ATTR_OVERRIDE_ALLOWED = "override_allowed"
|
|
||||||
ATTR_TARGET_TYPE = "target_type"
|
|
||||||
ATTR_TARGET_ID = "target_id"
|
|
||||||
ATTR_ZONE_ID = "zone_id"
|
ATTR_ZONE_ID = "zone_id"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user