@@ -66,7 +66,7 @@ def covers(self) -> Dict[str, MyQGaragedoor]:
66
66
67
67
@property
68
68
def lamps (self ) -> Dict [str , MyQLamp ]:
69
- """Return only those devices that are covers ."""
69
+ """Return only those devices that are lamps ."""
70
70
return {
71
71
device_id : device
72
72
for device_id , device in self .devices .items ()
@@ -75,13 +75,23 @@ def lamps(self) -> Dict[str, MyQLamp]:
75
75
76
76
@property
77
77
def gateways (self ) -> Dict [str , MyQDevice ]:
78
- """Return only those devices that are covers ."""
78
+ """Return only those devices that are gateways ."""
79
79
return {
80
80
device_id : device
81
81
for device_id , device in self .devices .items ()
82
82
if device .device_json ["device_family" ] == DEVICE_FAMILY_GATEWAY
83
83
}
84
84
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
+
85
95
async def _get_devices (self ) -> None :
86
96
87
97
_LOGGER .debug ("Retrieving devices for account %s" , self .name or self .id )
@@ -136,20 +146,24 @@ async def _get_devices(self) -> None:
136
146
device_json = device ,
137
147
state_update = state_update_timestmp ,
138
148
)
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
+
143
162
new_device = MyQDevice (
144
163
account = self ,
145
164
device_json = device ,
146
165
state_update = state_update_timestmp ,
147
166
)
148
- else :
149
- _LOGGER .warning (
150
- "Unknown device family %s" , device .get ("device_family" )
151
- )
152
- new_device = None
153
167
154
168
if new_device :
155
169
self ._devices [serial_number ] = new_device
0 commit comments