Add external handling in Overkiz AtlanticElectricalHeaterWithAdjustableTemperatureSetPoint (#84010)
* Add external handling in AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint * Improve comparing to external Co-authored-by: Thibaut <thibaut@etienne.pw> * Update to pyoverkiz 1.7.3 * Fix coding style lint * Use OverkizCommand * Fix small issues Co-authored-by: Thibaut <thibaut@etienne.pw>
This commit is contained in:
parent
588211223b
commit
93fe77de8d
4 changed files with 19 additions and 5 deletions
|
@ -24,6 +24,7 @@ PRESET_COMFORT1 = "comfort-1"
|
||||||
PRESET_COMFORT2 = "comfort-2"
|
PRESET_COMFORT2 = "comfort-2"
|
||||||
PRESET_FROST_PROTECTION = "frost_protection"
|
PRESET_FROST_PROTECTION = "frost_protection"
|
||||||
PRESET_PROG = "prog"
|
PRESET_PROG = "prog"
|
||||||
|
PRESET_EXTERNAL = "external"
|
||||||
|
|
||||||
|
|
||||||
# Map Overkiz presets to Home Assistant presets
|
# Map Overkiz presets to Home Assistant presets
|
||||||
|
@ -36,6 +37,7 @@ OVERKIZ_TO_PRESET_MODE: dict[str, str] = {
|
||||||
OverkizCommandParam.COMFORT_2: PRESET_COMFORT2,
|
OverkizCommandParam.COMFORT_2: PRESET_COMFORT2,
|
||||||
OverkizCommandParam.AUTO: PRESET_AUTO,
|
OverkizCommandParam.AUTO: PRESET_AUTO,
|
||||||
OverkizCommandParam.BOOST: PRESET_BOOST,
|
OverkizCommandParam.BOOST: PRESET_BOOST,
|
||||||
|
OverkizCommandParam.EXTERNAL: PRESET_EXTERNAL,
|
||||||
OverkizCommandParam.INTERNAL: PRESET_PROG,
|
OverkizCommandParam.INTERNAL: PRESET_PROG,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +50,7 @@ OVERKIZ_TO_HVAC_MODE: dict[str, str] = {
|
||||||
OverkizCommandParam.AUTO: HVACMode.AUTO,
|
OverkizCommandParam.AUTO: HVACMode.AUTO,
|
||||||
OverkizCommandParam.BASIC: HVACMode.HEAT,
|
OverkizCommandParam.BASIC: HVACMode.HEAT,
|
||||||
OverkizCommandParam.STANDBY: HVACMode.OFF,
|
OverkizCommandParam.STANDBY: HVACMode.OFF,
|
||||||
|
OverkizCommandParam.EXTERNAL: HVACMode.AUTO,
|
||||||
OverkizCommandParam.INTERNAL: HVACMode.AUTO,
|
OverkizCommandParam.INTERNAL: HVACMode.AUTO,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,15 +99,26 @@ class AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint(
|
||||||
@property
|
@property
|
||||||
def preset_mode(self) -> str | None:
|
def preset_mode(self) -> str | None:
|
||||||
"""Return the current preset mode, e.g., home, away, temp."""
|
"""Return the current preset mode, e.g., home, away, temp."""
|
||||||
|
|
||||||
|
states = self.device.states
|
||||||
|
|
||||||
if (
|
if (
|
||||||
state := self.device.states[OverkizState.IO_TARGET_HEATING_LEVEL]
|
operating_mode := states[OverkizState.CORE_OPERATING_MODE]
|
||||||
|
) and operating_mode.value_as_str == OverkizCommandParam.EXTERNAL:
|
||||||
|
return PRESET_EXTERNAL
|
||||||
|
|
||||||
|
if (
|
||||||
|
state := states[OverkizState.IO_TARGET_HEATING_LEVEL]
|
||||||
) and state.value_as_str:
|
) and state.value_as_str:
|
||||||
return OVERKIZ_TO_PRESET_MODE[state.value_as_str]
|
return OVERKIZ_TO_PRESET_MODE[state.value_as_str]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
async def async_set_preset_mode(self, preset_mode: str) -> None:
|
||||||
"""Set new preset mode."""
|
"""Set new preset mode."""
|
||||||
if preset_mode in [PRESET_AUTO, PRESET_PROG]:
|
|
||||||
|
if preset_mode == PRESET_EXTERNAL:
|
||||||
|
command = OverkizCommand.SET_SCHEDULING_TYPE
|
||||||
|
elif preset_mode in [PRESET_AUTO, PRESET_PROG]:
|
||||||
command = OverkizCommand.SET_OPERATING_MODE
|
command = OverkizCommand.SET_OPERATING_MODE
|
||||||
else:
|
else:
|
||||||
command = OverkizCommand.SET_HEATING_LEVEL
|
command = OverkizCommand.SET_HEATING_LEVEL
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"integration_type": "hub",
|
"integration_type": "hub",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/overkiz",
|
"documentation": "https://www.home-assistant.io/integrations/overkiz",
|
||||||
"requirements": ["pyoverkiz==1.7.2"],
|
"requirements": ["pyoverkiz==1.7.3"],
|
||||||
"zeroconf": [
|
"zeroconf": [
|
||||||
{
|
{
|
||||||
"type": "_kizbox._tcp.local.",
|
"type": "_kizbox._tcp.local.",
|
||||||
|
|
|
@ -1820,7 +1820,7 @@ pyotgw==2.1.3
|
||||||
pyotp==2.8.0
|
pyotp==2.8.0
|
||||||
|
|
||||||
# homeassistant.components.overkiz
|
# homeassistant.components.overkiz
|
||||||
pyoverkiz==1.7.2
|
pyoverkiz==1.7.3
|
||||||
|
|
||||||
# homeassistant.components.openweathermap
|
# homeassistant.components.openweathermap
|
||||||
pyowm==3.2.0
|
pyowm==3.2.0
|
||||||
|
|
|
@ -1297,7 +1297,7 @@ pyotgw==2.1.3
|
||||||
pyotp==2.8.0
|
pyotp==2.8.0
|
||||||
|
|
||||||
# homeassistant.components.overkiz
|
# homeassistant.components.overkiz
|
||||||
pyoverkiz==1.7.2
|
pyoverkiz==1.7.3
|
||||||
|
|
||||||
# homeassistant.components.openweathermap
|
# homeassistant.components.openweathermap
|
||||||
pyowm==3.2.0
|
pyowm==3.2.0
|
||||||
|
|
Loading…
Add table
Reference in a new issue