Skip to content

Commit

Permalink
fix boost mode for CV4E_IO (#755)
Browse files Browse the repository at this point in the history
* fix boost mode for CV4E_IO

* invert on/off relaunch state for boost mode

* add boost mode duration.

* Add 7 days duration to boost mode

* remove unused variable.
  • Loading branch information
vlebourl authored Feb 9, 2022
1 parent 3d82788 commit 5f7cebc
Showing 1 changed file with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@

DHWP_TYPE_MURAL = "io:AtlanticDomesticHotWaterProductionV2_MURAL_IOComponent"
DHWP_TYPE_CE_FLAT_C2 = "io:AtlanticDomesticHotWaterProductionV2_CE_FLAT_C2_IOComponent"
DHWP_TYPE_CV4E_IO = "io:AtlanticDomesticHotWaterProductionV2_CV4E_IOComponent"
DHWP_TYPE_MBL = "modbuslink:AtlanticDomesticHotWaterProductionMBLComponent"

SET_BOOST_MODE_DURATION = "setBoostModeDuration" # remove when added to pyoverkiz
REFRESH_BOOST_MODE_DURATION = (
"refreshBoostModeDuration" # remove when added to pyoverkiz
)

STATE_AUTO = "Auto"
STATE_BOOST = "Boost"
STATE_MANUAL = "Manual"
Expand Down Expand Up @@ -49,6 +55,8 @@ def _is_boost_mode_on(self) -> bool:
)
== OverkizCommandParam.ON
)
if self.device.controllable_name == DHWP_TYPE_CV4E_IO:
return self.executor.select_state("core:BoostModeDurationState") > 0
if self.device.controllable_name == DHWP_TYPE_CE_FLAT_C2:
return (
self.executor.select_state(OverkizState.IO_DHW_BOOST_MODE)
Expand Down Expand Up @@ -118,28 +126,34 @@ async def async_set_temperature(self, **kwargs):
async def async_set_operation_mode(self, operation_mode):
"""Set new target operation mode."""
if operation_mode == STATE_BOOST:
if self.device.controllable_name == DHWP_TYPE_MURAL:
if self.device.controllable_name in [DHWP_TYPE_MURAL, DHWP_TYPE_CV4E_IO]:
await self.executor.async_execute_command(
OverkizCommand.SET_CURRENT_OPERATING_MODE,
{
OverkizCommandParam.RELAUNCH: OverkizCommandParam.ON,
OverkizCommandParam.ABSENCE: OverkizCommandParam.OFF,
},
)
if self.device.controllable_name == DHWP_TYPE_CV4E_IO:
await self.executor.async_execute_command(SET_BOOST_MODE_DURATION, 7)
await self.executor.async_execute_command(REFRESH_BOOST_MODE_DURATION)
if self.device.controllable_name == DHWP_TYPE_CE_FLAT_C2:
await self.executor.async_execute_command(
OverkizCommand.SET_BOOST_MODE, OverkizCommand.ON
)
return
if self._is_boost_mode_on:
if self.device.controllable_name == DHWP_TYPE_MURAL:
if self.device.controllable_name in [DHWP_TYPE_MURAL, DHWP_TYPE_CV4E_IO]:
await self.executor.async_execute_command(
OverkizCommand.SET_CURRENT_OPERATING_MODE,
{
OverkizCommandParam.RELAUNCH: OverkizCommandParam.OFF,
OverkizCommandParam.ABSENCE: OverkizCommandParam.OFF,
},
)
if self.device.controllable_name == DHWP_TYPE_CV4E_IO:
await self.executor.async_execute_command(SET_BOOST_MODE_DURATION, 0)
await self.executor.async_execute_command(REFRESH_BOOST_MODE_DURATION)
if self.device.controllable_name == DHWP_TYPE_CE_FLAT_C2:
await self.executor.async_execute_command(
OverkizCommand.SET_BOOST_MODE, OverkizCommand.OFF
Expand All @@ -158,6 +172,13 @@ def is_away_mode_on(self):
)
== OverkizCommandParam.ON
)
if self.device.controllable_name == DHWP_TYPE_CV4E_IO:
return (
self.executor.select_state(OverkizState.CORE_OPERATING_MODE).get(
OverkizCommandParam.AWAY
)
== OverkizCommandParam.ON
)
if self.device.controllable_name == DHWP_TYPE_CE_FLAT_C2:
return (
self.executor.select_state(OverkizState.IO_DHW_ABSENCE_MODE)
Expand All @@ -171,7 +192,7 @@ def is_away_mode_on(self):

async def async_turn_away_mode_on(self):
"""Turn away mode on."""
if self.device.controllable_name == DHWP_TYPE_MURAL:
if self.device.controllable_name in [DHWP_TYPE_MURAL, DHWP_TYPE_CV4E_IO]:
await self.executor.async_execute_command(
OverkizCommand.SET_CURRENT_OPERATING_MODE,
{
Expand All @@ -186,7 +207,7 @@ async def async_turn_away_mode_on(self):

async def async_turn_away_mode_off(self):
"""Turn away mode off."""
if self.device.controllable_name == DHWP_TYPE_MURAL:
if self.device.controllable_name in [DHWP_TYPE_MURAL, DHWP_TYPE_CV4E_IO]:
await self.executor.async_execute_command(
OverkizCommand.SET_CURRENT_OPERATING_MODE,
{
Expand Down

0 comments on commit 5f7cebc

Please sign in to comment.