Skip to content

Commit ddd7107

Browse files
committed
feat: bring in a lot more state types and data
1 parent f4c6089 commit ddd7107

8 files changed

Lines changed: 122 additions & 77 deletions

File tree

pyomnilogic_local/api/api.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ async def async_get_filter_diagnostics(self, pool_id: int, equipment_id: int, ra
215215

216216
_LOGGER.debug("Sending GetUIFilterDiagnosticInfo with body: %s", req_body)
217217

218-
resp = await self.async_send_and_receive(MessageType.GET_FILTER_DIAGNOSTIC_INFO, req_body)
218+
resp = await self.async_send_and_receive(MessageType.GET_FILTER_DIAGNOSTIC, req_body)
219219

220220
_LOGGER.debug("Received response for GetUIFilterDiagnosticInfo: %s", resp)
221221

@@ -285,7 +285,7 @@ async def async_set_heater(
285285

286286
_LOGGER.debug("Sending SetUIHeaterCmd with body: %s", req_body)
287287

288-
return await self.async_send(MessageType.SET_HEATER_COMMAND, req_body)
288+
return await self.async_send(MessageType.SET_HEATER, req_body)
289289

290290
async def async_set_solar_heater(
291291
self,
@@ -320,7 +320,7 @@ async def async_set_solar_heater(
320320

321321
_LOGGER.debug("Sending SetUISolarSetPointCmd with body: %s", req_body)
322322

323-
return await self.async_send(MessageType.SET_SOLAR_SET_POINT_COMMAND, req_body)
323+
return await self.async_send(MessageType.SET_SOLAR_SETPOINT, req_body)
324324

325325
async def async_set_heater_mode(
326326
self,
@@ -355,7 +355,7 @@ async def async_set_heater_mode(
355355

356356
_LOGGER.debug("Sending SetUIHeaterModeCmd with body: %s", req_body)
357357

358-
return await self.async_send(MessageType.SET_HEATER_MODE_COMMAND, req_body)
358+
return await self.async_send(MessageType.SET_HEATER_MODE, req_body)
359359

360360
async def async_set_heater_enable(
361361
self,
@@ -390,7 +390,7 @@ async def async_set_heater_enable(
390390

391391
_LOGGER.debug("Sending SetHeaterEnable with body: %s", req_body)
392392

393-
return await self.async_send(MessageType.SET_HEATER_ENABLED, req_body)
393+
return await self.async_send(MessageType.SET_HEATER_ENABLE, req_body)
394394

395395
async def async_set_equipment(
396396
self,
@@ -552,7 +552,7 @@ async def async_set_light_show(
552552

553553
_LOGGER.debug("Sending SetStandAloneLightShow with body: %s", req_body)
554554

555-
return await self.async_send(MessageType.SET_STANDALONE_LIGHT_SHOW, req_body)
555+
return await self.async_send(MessageType.SET_LIGHT_SHOW, req_body)
556556

557557
async def async_set_chlorinator_enable(self, pool_id: int, enabled: int | bool) -> None:
558558
body_element = ET.Element("Request", {"xmlns": XML_NAMESPACE})
@@ -570,7 +570,7 @@ async def async_set_chlorinator_enable(self, pool_id: int, enabled: int | bool)
570570

571571
_LOGGER.debug("Sending SetCHLOREnable with body: %s", req_body)
572572

573-
return await self.async_send(MessageType.SET_CHLOR_ENABLED, req_body)
573+
return await self.async_send(MessageType.SET_CHLOR_ENABLE, req_body)
574574

575575
# This is used to set the ORP target value on a CSAD
576576
async def async_set_csad_orp_target_level(
@@ -596,7 +596,7 @@ async def async_set_csad_orp_target_level(
596596

597597
_LOGGER.debug("Sending SetUICSADORPTargetLevel with body: %s", req_body)
598598

599-
return await self.async_send(MessageType.SET_CSAD_ORP_TARGET, req_body)
599+
return await self.async_send(MessageType.SET_CSAD_ORP_TARGET_LEVEL, req_body)
600600

601601
# This is used to set the pH target value on a CSAD
602602
async def async_set_csad_ph_target_value(
@@ -665,7 +665,7 @@ async def async_set_chlorinator_params(
665665

666666
_LOGGER.debug("Sending SetCHLORParams with body: %s", req_body)
667667

668-
return await self.async_send(MessageType.SET_CHLOR_PARAMS, req_body)
668+
return await self.async_send(MessageType.CHLOR_PARAMS_SET, req_body)
669669

670670
async def async_set_chlorinator_superchlorinate(
671671
self,
@@ -690,7 +690,7 @@ async def async_set_chlorinator_superchlorinate(
690690

691691
_LOGGER.debug("Sending SetUISuperCHLORCmd with body: %s", req_body)
692692

693-
return await self.async_send(MessageType.SET_SUPERCHLORINATE, req_body)
693+
return await self.async_send(MessageType.CHLOR_SUPER_CHLOR_SET, req_body)
694694

695695
async def async_restore_idle_state(self) -> None:
696696
body_element = ET.Element("Request", {"xmlns": XML_NAMESPACE})
@@ -747,7 +747,7 @@ async def async_set_spillover(
747747

748748
_LOGGER.debug("Sending SetUISpilloverCmd with body: %s", req_body)
749749

750-
return await self.async_send(MessageType.SET_SPILLOVER, req_body)
750+
return await self.async_send(MessageType.SET_SPILLOVER_CMD, req_body)
751751

752752
async def async_set_group_enable(
753753
self,
@@ -790,7 +790,7 @@ async def async_set_group_enable(
790790

791791
_LOGGER.debug("Sending RunGroupCmd with body: %s", req_body)
792792

793-
return await self.async_send(MessageType.RUN_GROUP_CMD, req_body)
793+
return await self.async_send(MessageType.RUN_GROUP, req_body)
794794

795795
async def async_edit_schedule(
796796
self,
@@ -863,4 +863,4 @@ async def async_edit_schedule(
863863

864864
_LOGGER.debug("Sending EditUIScheduleCmd with body: %s", req_body)
865865

866-
return await self.async_send(MessageType.EDIT_SCHEDULE, req_body)
866+
return await self.async_send(MessageType.EDIT_SCHEDULE_CMD, req_body)

pyomnilogic_local/api/protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
_ACK_PAYLOAD = f'<Request xmlns="{XML_NAMESPACE}">\n<Name>Ack</Name>\n</Request>'
3030

31-
_ACK_TYPES = frozenset({MessageType.ACK, MessageType.XML_ACK})
31+
_ACK_TYPES = frozenset({MessageType.ACK, MessageType.MSP_ACK})
3232

3333
# Type alias for items placed on the receive queue: either a parsed message or a parse error.
3434
_QueueItem = OmniLogicMessage | OmniMessageFormatError
@@ -110,7 +110,7 @@ def _send_xml_ack(self, msg_id: int) -> None:
110110
if self._transport is None:
111111
_LOGGER.warning("cannot send ACK for ID %d, transport unavailable", msg_id)
112112
return
113-
ack = OmniLogicMessage(msg_id=msg_id, msg_type=MessageType.XML_ACK, payload=_ACK_PAYLOAD)
113+
ack = OmniLogicMessage(msg_id=msg_id, msg_type=MessageType.ACK, payload=_ACK_PAYLOAD)
114114
self._transport.sendto(bytes(ack))
115115
_LOGGER.debug("sent XML_ACK for message ID %d", msg_id)
116116

pyomnilogic_local/colorlogiclight.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ def is_ready(self) -> bool:
222222

223223
# Then check light-specific readiness
224224
return self.state not in [
225-
ColorLogicPowerState.FIFTEEN_SECONDS_WHITE,
226-
ColorLogicPowerState.CHANGING_SHOW,
227-
ColorLogicPowerState.POWERING_OFF,
228-
ColorLogicPowerState.COOLDOWN,
225+
ColorLogicPowerState.STARTING_APP,
226+
ColorLogicPowerState.SHOW_ADVANCE,
227+
ColorLogicPowerState.WAIT_POWER_DOWN,
228+
ColorLogicPowerState.POWER_DOWN,
229229
]
230230

231231
@control_method

pyomnilogic_local/filter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ def is_on(self) -> bool:
179179
FilterState.PRIMING,
180180
FilterState.HEATER_EXTEND,
181181
FilterState.CSAD_EXTEND,
182-
FilterState.FILTER_FORCE_PRIMING,
183-
FilterState.FILTER_SUPERCHLORINATE,
182+
FilterState.FORCE_PRIMING,
183+
FilterState.SUPERCHLORINATE,
184184
)
185185

186186
@property
@@ -203,7 +203,7 @@ def is_ready(self) -> bool:
203203
# We need to consider the filter as ready in this state, otherwise we cannot control the
204204
# virtual filter to switch the physical filter back BoW
205205
# ref: https://github.com/cryptk/python-omnilogic-local/issues/100
206-
return self.state in (FilterState.OFF, FilterState.ON, FilterState.SUSPEND)
206+
return self.state in (FilterState.OFF, FilterState.ON, FilterState.SUSPENDED)
207207

208208
# Control methods
209209
@control_method

0 commit comments

Comments
 (0)