Skip to content

Commit 9d36076

Browse files
committed
Ruffed
1 parent 04f9daa commit 9d36076

File tree

5 files changed

+33
-52
lines changed

5 files changed

+33
-52
lines changed

plugwise/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,11 @@ async def _smile_detect_legacy(
332332
self.smile.legacy = True
333333
return return_model
334334

335-
async def async_update(self) -> dict[str, PlugwiseAnnaData | PlugwiseAdamData | PlugwiseP1Data | PlugwiseStretchData]:
335+
async def async_update(
336+
self,
337+
) -> dict[
338+
str, PlugwiseAnnaData | PlugwiseAdamData | PlugwiseP1Data | PlugwiseStretchData
339+
]:
336340
"""Update the Plugwise Gateway entities and their data and states."""
337341
if self.smile.type == ANNA:
338342
data: dict[str, PlugwiseAnnaData] = {}

plugwise/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
SmartEnergyLegacySensors,
1919
SmartEnergyMeter,
2020
SmileP1Gateway,
21-
SmileThermostatGateway,
21+
SmileTGateway,
2222
StretchGateway,
2323
ThermoZone,
2424
)
@@ -552,7 +552,7 @@ class PlugwiseAnnaData(
552552
GwEntityData,
553553
OnOffTherm,
554554
OpenTherm,
555-
SmileThermostatGateway,
555+
SmileTGateway,
556556
):
557557
"""The Plugwise Anna Data class."""
558558

plugwise/devices.py

Lines changed: 16 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,40 @@
66

77

88
@dataclass
9-
class BaseGateway:
9+
class BaseClass:
1010
"""Plugwise Base Gateway data class."""
1111

12+
available: bool | None
1213
dev_class: str
1314
firmware: str
15+
hardware: str | None
1416
location: str
1517
mac_address: str
1618
model: str
19+
model_id: str | None
1720
name: str
1821
vendor: str
1922

2023

2124
@dataclass
22-
class SmileP1Gateway(BaseGateway):
25+
class SmileP1Gateway(BaseClass):
2326
"""Plugwise Smile P1 Gateway data class."""
2427

2528
binary_sensors: GatewayBinarySensors # Not for legacy?
26-
hardware: str
27-
model_id: str
2829

2930

3031
@dataclass
31-
class StretchGateway(BaseGateway):
32+
class StretchGateway(BaseClass):
3233
"""Plugwise Stretch Gateway data class."""
3334

3435
zigbee_mac_address: str
3536

3637

3738
@dataclass
38-
class SmileThermostatGateway(SmileP1Gateway):
39+
class SmileTGateway(BaseClass):
3940
"""Plugwise Anna Smile-T Gateway data class."""
4041

42+
binary_sensors: GatewayBinarySensors # Not for legacy?
4143
sensors: GatewaySensors
4244

4345

@@ -56,7 +58,7 @@ class GatewaySensors:
5658

5759

5860
@dataclass
59-
class AdamGateway(SmileThermostatGateway):
61+
class AdamGateway(SmileTGateway):
6062
"""Plugwise Adam HA Gateway data class."""
6163

6264
gateway_modes: list[str]
@@ -67,16 +69,10 @@ class AdamGateway(SmileThermostatGateway):
6769

6870

6971
@dataclass
70-
class SmartEnergyMeter:
72+
class SmartEnergyMeter(BaseClass):
7173
"""DSMR Energy Meter data class."""
7274

73-
available: bool
74-
dev_class: str
75-
location: str
76-
model: str
77-
name: str
7875
sensors: SmartEnergySensors
79-
vendor: str
8076

8177

8278
@dataclass
@@ -131,25 +127,18 @@ class SmartEnergyLegacySensors:
131127

132128

133129
@dataclass
134-
class AnnaData:
130+
class AnnaData(BaseClass):
135131
"""Plugwise Anna data class, also for legacy Anna."""
136132

137133
active_preset: str | None
138134
available_schedules: list[str]
139135
climate_mode: str
140136
control_state: str
141-
dev_class: str
142-
firmware: str
143-
hardware: str
144-
location: str
145-
model: str
146-
name: str
147137
preset_modes: list[str] | None
148138
select_schedule: str | None
149139
sensors: AnnaSensors
150140
temperature_offset: SetpointDict | None # not for legacy
151141
thermostat: ThermostatDict
152-
vendor: str
153142

154143

155144
@dataclass
@@ -164,23 +153,18 @@ class AnnaSensors:
164153

165154

166155
@dataclass
167-
class ThermoZone:
156+
class ThermoZone(BaseClass):
168157
"""Plugwise Adam ThermoZone data class."""
169158

170159
active_preset: str | None
171160
available_schedules: list[str]
172161
climate_mode: str
173162
control_state: str
174-
dev_class: str
175-
model: str
176-
name: str
177163
preset_modes: list[str]
178164
select_schedule: str
179165
sensors: ThermoZoneSensors
180166
thermostat: ThermostatDict
181167
thermostats: ThermostatsDict
182-
vendor: str
183-
184168

185169
@dataclass
186170
class ThermoZoneSensors:
@@ -192,39 +176,24 @@ class ThermoZoneSensors:
192176

193177

194178
@dataclass
195-
class AnnaAdamData:
179+
class AnnaAdamData(BaseClass):
196180
"""Plugwise Anna-connected-to-Adam data class."""
197181

198-
dev_class: str
199-
location: str
200-
model: str
201-
model_id: str
202-
name: str
203182
sensors: AnnaSensors
204-
vendor: str
205183

206184

207185
@dataclass
208-
class JipLisaTomData:
186+
class JipLisaTomData(BaseClass):
209187
"""JipLisaTomData data class.
210188
211189
Covering Plugwise Jip, Lisa and Tom/Floor devices.
212190
"""
213191

214-
available: bool
215192
binary_sensors: (
216193
WirelessThermostatBinarySensors | None
217194
) # Not for AC powered Lisa/Tom
218-
dev_class: str
219-
firmware: str
220-
hardware: str
221-
location: str
222-
model: str
223-
model_id: str
224-
name: str
225195
sensors: JipLisaTomSensors
226196
temperature_offset: SetpointDict
227-
vendor: str
228197
zigbee_mac_address: str
229198

230199

@@ -388,10 +357,10 @@ class PlugSwitches:
388357
# data: dict[str, SmileP1Gateway | SmartEnergyMeter | SmartEnergyLegacySensors]
389358

390359

391-
# class Anna(SmileThermostatGateway, AnnaData, OnOffTherm, OpenTherm):
360+
# class Anna(SmileTGateway, AnnaData, OnOffTherm, OpenTherm):
392361
# """Plugwise Anna data class."""
393362
#
394-
# data: dict[str, SmileThermostatGateway | OnOffTherm | OpenTherm | AnnaData]
363+
# data: dict[str, SmileTGateway | OnOffTherm | OpenTherm | AnnaData]
395364

396365

397366
# class Adam(

plugwise/legacy/smile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ def get_all_gateway_entities(self) -> None:
9090

9191
self._all_entity_data()
9292

93-
async def async_update(self) -> dict[str, PlugwiseAnnaData | PlugwiseAdamData | PlugwiseP1Data | PlugwiseStretchData]:
93+
async def async_update(
94+
self,
95+
) -> dict[
96+
str, PlugwiseAnnaData | PlugwiseAdamData | PlugwiseP1Data | PlugwiseStretchData
97+
]:
9498
"""Perform an full update update at day-change: re-collect all gateway entities and their data and states.
9599
96100
Otherwise perform an incremental update: only collect the entities updated data and states.

plugwise/smile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ def get_all_gateway_entities(self) -> None:
123123

124124
self._all_entity_data()
125125

126-
async def async_update(self) -> dict[str, PlugwiseAnnaData | PlugwiseAdamData | PlugwiseP1Data | PlugwiseStretchData]:
126+
async def async_update(
127+
self,
128+
) -> dict[
129+
str, PlugwiseAnnaData | PlugwiseAdamData | PlugwiseP1Data | PlugwiseStretchData
130+
]:
127131
"""Perform an full update: re-collect all gateway entities and their data and states.
128132
129133
Any change in the connected entities will be detected immediately.

0 commit comments

Comments
 (0)