1+ from typing import TYPE_CHECKING
2+
13from pyomnilogic_local ._base import OmniEquipment
2- from pyomnilogic_local .api .api import OmniLogicAPI
34from pyomnilogic_local .chlorinator import Chlorinator
45from pyomnilogic_local .collections import EquipmentDict
56from pyomnilogic_local .colorlogiclight import _LOGGER , ColorLogicLight
1213from pyomnilogic_local .relay import Relay
1314from pyomnilogic_local .sensor import Sensor
1415
16+ if TYPE_CHECKING :
17+ from pyomnilogic_local .omnilogic import OmniLogic
18+
1519
1620class Bow (OmniEquipment [MSPBoW , TelemetryBoW ]):
1721 """Represents a bow in the OmniLogic system."""
@@ -25,8 +29,8 @@ class Bow(OmniEquipment[MSPBoW, TelemetryBoW]):
2529 chlorinator : Chlorinator | None = None
2630 csads : EquipmentDict [CSAD ] = EquipmentDict ()
2731
28- def __init__ (self , _api : OmniLogicAPI , mspconfig : MSPBoW , telemetry : Telemetry ) -> None :
29- super ().__init__ (_api , mspconfig , telemetry )
32+ def __init__ (self , omni : "OmniLogic" , mspconfig : MSPBoW , telemetry : Telemetry ) -> None :
33+ super ().__init__ (omni , mspconfig , telemetry )
3034
3135 @property
3236 def equip_type (self ) -> str :
@@ -52,60 +56,60 @@ def _update_filters(self, mspconfig: MSPBoW, telemetry: Telemetry) -> None:
5256 self .filters = EquipmentDict ()
5357 return
5458
55- self .filters = EquipmentDict ([Filter (self ._api , filter_ , telemetry ) for filter_ in mspconfig .filter ])
59+ self .filters = EquipmentDict ([Filter (self ._omni , filter_ , telemetry ) for filter_ in mspconfig .filter ])
5660
5761 def _update_heater (self , mspconfig : MSPBoW , telemetry : Telemetry ) -> None :
5862 """Update the heater based on the MSP configuration."""
5963 if mspconfig .heater is None :
6064 self .heater = None
6165 return
6266
63- self .heater = Heater (self ._api , mspconfig .heater , telemetry )
67+ self .heater = Heater (self ._omni , mspconfig .heater , telemetry )
6468
6569 def _update_relays (self , mspconfig : MSPBoW , telemetry : Telemetry ) -> None :
6670 """Update the relays based on the MSP configuration."""
6771 if mspconfig .relay is None :
6872 self .relays = EquipmentDict ()
6973 return
7074
71- self .relays = EquipmentDict ([Relay (self ._api , relay , telemetry ) for relay in mspconfig .relay ])
75+ self .relays = EquipmentDict ([Relay (self ._omni , relay , telemetry ) for relay in mspconfig .relay ])
7276
7377 def _update_sensors (self , mspconfig : MSPBoW , telemetry : Telemetry ) -> None :
7478 """Update the sensors based on the MSP configuration."""
7579 if mspconfig .sensor is None :
7680 self .sensors = EquipmentDict ()
7781 return
7882
79- self .sensors = EquipmentDict ([Sensor (self ._api , sensor , telemetry ) for sensor in mspconfig .sensor ])
83+ self .sensors = EquipmentDict ([Sensor (self ._omni , sensor , telemetry ) for sensor in mspconfig .sensor ])
8084
8185 def _update_lights (self , mspconfig : MSPBoW , telemetry : Telemetry ) -> None :
8286 """Update the lights based on the MSP configuration."""
8387 if mspconfig .colorlogic_light is None :
8488 self .lights = EquipmentDict ()
8589 return
8690
87- self .lights = EquipmentDict ([ColorLogicLight (self ._api , light , telemetry ) for light in mspconfig .colorlogic_light ])
91+ self .lights = EquipmentDict ([ColorLogicLight (self ._omni , light , telemetry ) for light in mspconfig .colorlogic_light ])
8892
8993 def _update_pumps (self , mspconfig : MSPBoW , telemetry : Telemetry ) -> None :
9094 """Update the pumps based on the MSP configuration."""
9195 if mspconfig .pump is None :
9296 self .pumps = EquipmentDict ()
9397 return
9498
95- self .pumps = EquipmentDict ([Pump (self ._api , pump , telemetry ) for pump in mspconfig .pump ])
99+ self .pumps = EquipmentDict ([Pump (self ._omni , pump , telemetry ) for pump in mspconfig .pump ])
96100
97101 def _update_chlorinators (self , mspconfig : MSPBoW , telemetry : Telemetry ) -> None :
98102 """Update the chlorinators based on the MSP configuration."""
99103 if mspconfig .chlorinator is None :
100104 self .chlorinator = None
101105 return
102106
103- self .chlorinator = Chlorinator (self ._api , mspconfig .chlorinator , telemetry )
107+ self .chlorinator = Chlorinator (self ._omni , mspconfig .chlorinator , telemetry )
104108
105109 def _update_csads (self , mspconfig : MSPBoW , telemetry : Telemetry ) -> None :
106110 """Update the CSADs based on the MSP configuration."""
107111 if mspconfig .csad is None :
108112 self .csads = EquipmentDict ()
109113 return
110114
111- self .csads = EquipmentDict ([CSAD (self ._api , csad , telemetry ) for csad in mspconfig .csad ])
115+ self .csads = EquipmentDict ([CSAD (self ._omni , csad , telemetry ) for csad in mspconfig .csad ])
0 commit comments