mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 22:37:11 +00:00
Add new TRV Beca and proper Presets with new one Temporary Manual (#60337)
This commit is contained in:
parent
128433758e
commit
e03283292b
@ -60,6 +60,7 @@ from .core.const import (
|
|||||||
DATA_ZHA,
|
DATA_ZHA,
|
||||||
PRESET_COMPLEX,
|
PRESET_COMPLEX,
|
||||||
PRESET_SCHEDULE,
|
PRESET_SCHEDULE,
|
||||||
|
PRESET_TEMP_MANUAL,
|
||||||
SIGNAL_ADD_ENTITIES,
|
SIGNAL_ADD_ENTITIES,
|
||||||
SIGNAL_ATTR_UPDATED,
|
SIGNAL_ATTR_UPDATED,
|
||||||
)
|
)
|
||||||
@ -601,7 +602,6 @@ class CentralitePearl(ZenWithinThermostat):
|
|||||||
"_TZE200_ckud7u2l",
|
"_TZE200_ckud7u2l",
|
||||||
"_TZE200_ywdxldoj",
|
"_TZE200_ywdxldoj",
|
||||||
"_TZE200_cwnjrr72",
|
"_TZE200_cwnjrr72",
|
||||||
"_TZE200_b6wax7g0",
|
|
||||||
"_TZE200_2atgpdho",
|
"_TZE200_2atgpdho",
|
||||||
"_TZE200_pvvbommb",
|
"_TZE200_pvvbommb",
|
||||||
"_TZE200_4eeyebrt",
|
"_TZE200_4eeyebrt",
|
||||||
@ -685,3 +685,78 @@ class MoesThermostat(Thermostat):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@STRICT_MATCH(
|
||||||
|
channel_names=CHANNEL_THERMOSTAT,
|
||||||
|
manufacturers={
|
||||||
|
"_TZE200_b6wax7g0",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
class BecaThermostat(Thermostat):
|
||||||
|
"""Beca Thermostat implementation."""
|
||||||
|
|
||||||
|
def __init__(self, unique_id, zha_device, channels, **kwargs):
|
||||||
|
"""Initialize ZHA Thermostat instance."""
|
||||||
|
super().__init__(unique_id, zha_device, channels, **kwargs)
|
||||||
|
self._presets = [
|
||||||
|
PRESET_NONE,
|
||||||
|
PRESET_AWAY,
|
||||||
|
PRESET_SCHEDULE,
|
||||||
|
PRESET_ECO,
|
||||||
|
PRESET_BOOST,
|
||||||
|
PRESET_TEMP_MANUAL,
|
||||||
|
]
|
||||||
|
self._supported_flags |= SUPPORT_PRESET_MODE
|
||||||
|
|
||||||
|
@property
|
||||||
|
def hvac_modes(self) -> tuple[str, ...]:
|
||||||
|
"""Return only the heat mode, because the device can't be turned off."""
|
||||||
|
return (HVAC_MODE_HEAT,)
|
||||||
|
|
||||||
|
async def async_attribute_updated(self, record):
|
||||||
|
"""Handle attribute update from device."""
|
||||||
|
if record.attr_name == "operation_preset":
|
||||||
|
if record.value == 0:
|
||||||
|
self._preset = PRESET_AWAY
|
||||||
|
if record.value == 1:
|
||||||
|
self._preset = PRESET_SCHEDULE
|
||||||
|
if record.value == 2:
|
||||||
|
self._preset = PRESET_NONE
|
||||||
|
if record.value == 4:
|
||||||
|
self._preset = PRESET_ECO
|
||||||
|
if record.value == 5:
|
||||||
|
self._preset = PRESET_BOOST
|
||||||
|
if record.value == 7:
|
||||||
|
self._preset = PRESET_TEMP_MANUAL
|
||||||
|
await super().async_attribute_updated(record)
|
||||||
|
|
||||||
|
async def async_preset_handler(self, preset: str, enable: bool = False) -> bool:
|
||||||
|
"""Set the preset mode."""
|
||||||
|
mfg_code = self._zha_device.manufacturer_code
|
||||||
|
if not enable:
|
||||||
|
return await self._thrm.write_attributes(
|
||||||
|
{"operation_preset": 2}, manufacturer=mfg_code
|
||||||
|
)
|
||||||
|
if preset == PRESET_AWAY:
|
||||||
|
return await self._thrm.write_attributes(
|
||||||
|
{"operation_preset": 0}, manufacturer=mfg_code
|
||||||
|
)
|
||||||
|
if preset == PRESET_SCHEDULE:
|
||||||
|
return await self._thrm.write_attributes(
|
||||||
|
{"operation_preset": 1}, manufacturer=mfg_code
|
||||||
|
)
|
||||||
|
if preset == PRESET_ECO:
|
||||||
|
return await self._thrm.write_attributes(
|
||||||
|
{"operation_preset": 4}, manufacturer=mfg_code
|
||||||
|
)
|
||||||
|
if preset == PRESET_BOOST:
|
||||||
|
return await self._thrm.write_attributes(
|
||||||
|
{"operation_preset": 5}, manufacturer=mfg_code
|
||||||
|
)
|
||||||
|
if preset == PRESET_TEMP_MANUAL:
|
||||||
|
return await self._thrm.write_attributes(
|
||||||
|
{"operation_preset": 7}, manufacturer=mfg_code
|
||||||
|
)
|
||||||
|
|
||||||
|
return False
|
||||||
|
@ -211,8 +211,9 @@ MFG_CLUSTER_ID_START = 0xFC00
|
|||||||
POWER_MAINS_POWERED = "Mains"
|
POWER_MAINS_POWERED = "Mains"
|
||||||
POWER_BATTERY_OR_UNKNOWN = "Battery or Unknown"
|
POWER_BATTERY_OR_UNKNOWN = "Battery or Unknown"
|
||||||
|
|
||||||
PRESET_SCHEDULE = "schedule"
|
PRESET_SCHEDULE = "Schedule"
|
||||||
PRESET_COMPLEX = "complex"
|
PRESET_COMPLEX = "Complex"
|
||||||
|
PRESET_TEMP_MANUAL = "Temporary manual"
|
||||||
|
|
||||||
ZHA_ALARM_OPTIONS = "zha_alarm_options"
|
ZHA_ALARM_OPTIONS = "zha_alarm_options"
|
||||||
ZHA_OPTIONS = "zha_options"
|
ZHA_OPTIONS = "zha_options"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user