add selected engine state parameters

This commit is contained in:
vincent committed 2024-02-27 17:10:14 +01:00
1 parent d25ed3810f
commit 2308b2a154
5 files changed
+115 -6

No files matched your search

+16 -2
View File
@@ -453,14 +453,28 @@ class Koolnova:
''' Get name '''
return self._name
async def async_set_engine_state(self,
val:const.FlowEngine,
engine_id: int,
) -> None:
''' set engine flow from id '''
_LOGGER.debug("set engine (id:{}) flow : {}".format(engine_id, val))
if not isinstance(val, const.FlowEngine):
raise AssertionError('Input variable must be Enum FlowEngine')
ret = await self._client.async_set_engine_state(engine_id, val)
if not ret:
_LOGGER.error("[GLOBAL] Error writing {} to modbus".format(val))
raise UpdateValueError('Error writing to modbus updated value')
self._engines[engine_id - 1].state = val
@property
def global_mode(self) -> const.GlobalMode:
''' Get Global Mode '''
return self._global_mode
async def async_set_global_mode(self,
val:const.GlobalMode,
) -> None:
val:const.GlobalMode,
) -> None:
''' Set Global Mode '''
_LOGGER.debug("set global mode : {}".format(val))
if not isinstance(val, const.GlobalMode):
+12
View File
@@ -306,6 +306,18 @@ class Operations:
reg = 0
return ret, const.FlowEngine(reg)
async def async_set_engine_state(self,
engine_id:int = 0,
opt:const.FlowEngine = const.FlowEngine.AUTO,
) -> bool:
''' write engine state specified by id '''
if engine_id < 1 or engine_id > 4:
raise UnitIdError("Engine id must be between 1 and 4")
reg, ret = await self.__async_write_register(reg = const.REG_START_FLOW_STATE_ENGINE + (engine_id - 1), val = int(opt))
if not ret:
_LOGGER.error('Error writing engine state for id:{}'.format(engine_id))
return ret
async def async_engine_order_temp(self,
engine_id:int = 0,
) -> (bool, float):