mirror of https://github.com/Andre0512/hon.git
Change to new climate enity style, fix #165
This commit is contained in:
parent
0e26b4a0f7
commit
09189ff0f8
|
@ -126,6 +126,7 @@ async def async_setup_entry(
|
||||||
|
|
||||||
class HonACClimateEntity(HonEntity, ClimateEntity):
|
class HonACClimateEntity(HonEntity, ClimateEntity):
|
||||||
entity_description: HonACClimateEntityDescription
|
entity_description: HonACClimateEntityDescription
|
||||||
|
_enable_turn_on_off_backwards_compatibility = False
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -211,6 +212,14 @@ class HonACClimateEntity(HonEntity, ClimateEntity):
|
||||||
await self._device.commands["settings"].send()
|
await self._device.commands["settings"].send()
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
|
await self._device.commands["startProgram"].send()
|
||||||
|
self._device.sync_command("startProgram", "settings")
|
||||||
|
|
||||||
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
|
await self._device.commands["stopProgram"].send()
|
||||||
|
self._device.sync_command("stopProgram", "settings")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def preset_mode(self) -> str | None:
|
def preset_mode(self) -> str | None:
|
||||||
"""Return the current Preset for this channel."""
|
"""Return the current Preset for this channel."""
|
||||||
|
@ -286,6 +295,7 @@ class HonACClimateEntity(HonEntity, ClimateEntity):
|
||||||
|
|
||||||
class HonClimateEntity(HonEntity, ClimateEntity):
|
class HonClimateEntity(HonEntity, ClimateEntity):
|
||||||
entity_description: HonClimateEntityDescription
|
entity_description: HonClimateEntityDescription
|
||||||
|
_enable_turn_on_off_backwards_compatibility = False
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -363,6 +373,14 @@ class HonClimateEntity(HonEntity, ClimateEntity):
|
||||||
self._attr_hvac_mode = hvac_mode
|
self._attr_hvac_mode = hvac_mode
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
|
async def async_turn_on(self) -> None:
|
||||||
|
"""Set the HVAC State to on."""
|
||||||
|
await self._device.commands["startProgram"].send()
|
||||||
|
|
||||||
|
async def async_turn_off(self) -> None:
|
||||||
|
"""Set the HVAC State to off."""
|
||||||
|
await self._device.commands["stopProgram"].send()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def preset_mode(self) -> str | None:
|
def preset_mode(self) -> str | None:
|
||||||
"""Return the current Preset for this channel."""
|
"""Return the current Preset for this channel."""
|
||||||
|
|
Loading…
Reference in New Issue