@@ -66,7 +66,7 @@ def covers(self) -> Dict[str, MyQGaragedoor]:
6666
6767 @property
6868 def lamps (self ) -> Dict [str , MyQLamp ]:
69- """Return only those devices that are covers ."""
69+ """Return only those devices that are lamps ."""
7070 return {
7171 device_id : device
7272 for device_id , device in self .devices .items ()
@@ -75,13 +75,23 @@ def lamps(self) -> Dict[str, MyQLamp]:
7575
7676 @property
7777 def gateways (self ) -> Dict [str , MyQDevice ]:
78- """Return only those devices that are covers ."""
78+ """Return only those devices that are gateways ."""
7979 return {
8080 device_id : device
8181 for device_id , device in self .devices .items ()
8282 if device .device_json ["device_family" ] == DEVICE_FAMILY_GATEWAY
8383 }
8484
85+ @property
86+ def other (self ) -> Dict [str , MyQDevice ]:
87+ """Return only those devices that are covers."""
88+ return {
89+ device_id : device
90+ for device_id , device in self .devices .items ()
91+ if type (device ) is MyQDevice
92+ and device .device_json ["device_family" ] != DEVICE_FAMILY_GATEWAY
93+ }
94+
8595 async def _get_devices (self ) -> None :
8696
8797 _LOGGER .debug ("Retrieving devices for account %s" , self .name or self .id )
@@ -136,20 +146,24 @@ async def _get_devices(self) -> None:
136146 device_json = device ,
137147 state_update = state_update_timestmp ,
138148 )
139- elif device .get ("device_family" ) == DEVICE_FAMILY_GATEWAY :
140- _LOGGER .debug (
141- "Adding new gateway with serial number %s" , serial_number
142- )
149+ else :
150+ if device .get ("device_family" ) == DEVICE_FAMILY_GATEWAY :
151+ _LOGGER .debug (
152+ "Adding new gateway with serial number %s" ,
153+ serial_number ,
154+ )
155+ else :
156+ _LOGGER .debug (
157+ "Adding unknown device family %s with serial number %s" ,
158+ device .get ("device_family" ),
159+ serial_number ,
160+ )
161+
143162 new_device = MyQDevice (
144163 account = self ,
145164 device_json = device ,
146165 state_update = state_update_timestmp ,
147166 )
148- else :
149- _LOGGER .warning (
150- "Unknown device family %s" , device .get ("device_family" )
151- )
152- new_device = None
153167
154168 if new_device :
155169 self ._devices [serial_number ] = new_device
0 commit comments