Skip to content

Commit 6ee7f78

Browse files
committed
Rename gw_data to _smile_props
1 parent dbb3332 commit 6ee7f78

File tree

6 files changed

+40
-40
lines changed

6 files changed

+40
-40
lines changed

plugwise/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
SMILES,
1818
STATUS,
1919
SYSTEM,
20-
GatewayData,
2120
PlugwiseData,
21+
SmileProps,
2222
ThermoLoc,
2323
)
2424
from plugwise.exceptions import (
@@ -70,10 +70,10 @@ def __init__(
7070
self._opentherm_device = False
7171
self._schedule_old_states: dict[str, dict[str, str]] = {}
7272
self._smile_api: SmileAPI | SmileLegacyAPI
73+
self._smile_props: SmileProps = {}
7374
self._stretch_v2 = False
7475
self._target_smile: str = NONE
7576
self.cooling_present = False
76-
self.gw_data: GatewayData = {}
7777
self.smile_hostname: str = NONE
7878
self.smile_hw_version: str | None = None
7979
self.smile_legacy = False
@@ -88,27 +88,27 @@ def __init__(
8888
@property
8989
def gateway_id(self) -> str:
9090
"""Return the gateway-id."""
91-
return self.gw_data["gateway_id"]
91+
return self._smile_props["gateway_id"]
9292

9393
@property
9494
def heater_id(self) -> str:
9595
"""Return the heater-id."""
96-
return self.gw_data["heater_id"]
96+
return self._smile_props["heater_id"]
9797

9898
@property
9999
def item_count(self) -> int:
100100
"""Return the item-count."""
101-
return self.gw_data["item_count"]
101+
return self._smile_props["item_count"]
102102

103103
@property
104104
def notifications(self) -> dict[str, dict[str, str]]:
105105
"""Return the Plugwise notifications."""
106-
return self.gw_data["notifications"]
106+
return self._smile_props["notifications"]
107107

108108
@property
109109
def reboot(self) -> bool:
110110
"""Return the reboot capability."""
111-
return self.gw_data["reboot"]
111+
return self._smile_props["reboot"]
112112

113113
async def connect(self) -> Version | None:
114114
"""Connect to the Plugwise Gateway and determine its name, type, version, and other data."""
@@ -156,8 +156,8 @@ async def connect(self) -> Version | None:
156156
self._opentherm_device,
157157
self._request,
158158
self._schedule_old_states,
159+
self._smile_props,
159160
self.cooling_present,
160-
self.gw_data,
161161
self.smile_hostname,
162162
self.smile_hw_version,
163163
self.smile_mac_address,
@@ -174,9 +174,9 @@ async def connect(self) -> Version | None:
174174
self._on_off_device,
175175
self._opentherm_device,
176176
self._request,
177+
self._smile_props,
177178
self._stretch_v2,
178179
self._target_smile,
179-
self.gw_data,
180180
self.smile_hostname,
181181
self.smile_hw_version,
182182
self.smile_mac_address,

plugwise/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@
394394
)
395395

396396

397-
class GatewayData(TypedDict, total=False):
398-
"""The Gateway Data class."""
397+
class SmileProps(TypedDict, total=False):
398+
"""The SmileProps Data class."""
399399

400400
cooling_present: bool
401401
gateway_id: str
@@ -584,4 +584,4 @@ class PlugwiseData:
584584
"""Plugwise data provided as output."""
585585

586586
devices: dict[str, GwEntityData]
587-
gateway: GatewayData
587+
gateway: SmileProps

plugwise/data.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
NONE,
1616
OFF,
1717
ActuatorData,
18-
GatewayData,
1918
GwEntityData,
19+
SmileProps,
2020
)
2121
from plugwise.helper import SmileHelper
2222
from plugwise.util import remove_empty_platform_dicts
@@ -27,27 +27,27 @@ class SmileData(SmileHelper):
2727

2828
def __init__(self) -> None:
2929
"""Init."""
30-
self.gw_data: GatewayData
30+
self._smile_props: SmileProps
3131
SmileHelper.__init__(self)
3232

3333
def _all_entity_data(self) -> None:
3434
"""Helper-function for get_all_gateway_entities().
3535
36-
Collect data for each entity and add to self.gw_data and self.gw_entities.
36+
Collect data for each entity and add to self._smile_props and self.gw_entities.
3737
"""
3838
self._update_gw_entities()
3939
if self.smile(ADAM):
4040
self._update_zones()
4141
self.gw_entities.update(self._zones)
4242

43-
self.gw_data["gateway_id"] = self._gateway_id
44-
self.gw_data["item_count"] = self._count
45-
self.gw_data["notifications"] = self._notifications
46-
self.gw_data["reboot"] = True
47-
self.gw_data["smile_name"] = self.smile_name
43+
self._smile_props["gateway_id"] = self._gateway_id
44+
self._smile_props["item_count"] = self._count
45+
self._smile_props["notifications"] = self._notifications
46+
self._smile_props["reboot"] = True
47+
self._smile_props["smile_name"] = self.smile_name
4848
if self._is_thermostat:
49-
self.gw_data["heater_id"] = self._heater_id
50-
self.gw_data["cooling_present"] = self.cooling_present
49+
self._smile_props["heater_id"] = self._heater_id
50+
self._smile_props["cooling_present"] = self.cooling_present
5151

5252
def _update_zones(self) -> None:
5353
"""Helper-function for _all_entity_data() and async_update().

plugwise/legacy/data.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Dict as class
99
# Version detection
10-
from plugwise.constants import NONE, OFF, GatewayData, GwEntityData
10+
from plugwise.constants import NONE, OFF, GwEntityData, SmileProps
1111
from plugwise.legacy.helper import SmileLegacyHelper
1212
from plugwise.util import remove_empty_platform_dicts
1313

@@ -17,21 +17,21 @@ class SmileLegacyData(SmileLegacyHelper):
1717

1818
def __init__(self) -> None:
1919
"""Init."""
20-
self.gw_data: GatewayData
20+
self._smile_props: SmileProps
2121
SmileLegacyHelper.__init__(self)
2222

2323
def _all_entity_data(self) -> None:
2424
"""Helper-function for get_all_gateway_entities().
2525
26-
Collect data for each entity and add to self.gw_data and self.gw_entities.
26+
Collect data for each entity and add to self._smile_props and self.gw_entities.
2727
"""
2828
self._update_gw_entities()
29-
self.gw_data["gateway_id"] = self.gateway_id
30-
self.gw_data["item_count"] = self._count
31-
self.gw_data["smile_name"] = self.smile_name
29+
self._smile_props["gateway_id"] = self.gateway_id
30+
self._smile_props["item_count"] = self._count
31+
self._smile_props["smile_name"] = self.smile_name
3232
if self._is_thermostat:
33-
self.gw_data["heater_id"] = self._heater_id
34-
self.gw_data["cooling_present"] = False
33+
self._smile_props["heater_id"] = self._heater_id
34+
self._smile_props["cooling_present"] = False
3535

3636
def _update_gw_entities(self) -> None:
3737
"""Helper-function for _all_entity_data() and async_update().

plugwise/legacy/smile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
OFF,
1919
REQUIRE_APPLIANCES,
2020
RULES,
21-
GatewayData,
2221
GwEntityData,
2322
PlugwiseData,
23+
SmileProps,
2424
ThermoLoc,
2525
)
2626
from plugwise.exceptions import ConnectionFailedError, DataMissingError, PlugwiseError
@@ -42,9 +42,9 @@ def __init__(
4242
_on_off_device: bool,
4343
_opentherm_device: bool,
4444
_request: Callable[..., Awaitable[Any]],
45+
_smile_props: SmileProps,
4546
_stretch_v2: bool,
4647
_target_smile: str,
47-
gw_data: GatewayData,
4848
smile_hostname: str,
4949
smile_hw_version: str | None,
5050
smile_mac_address: str | None,
@@ -60,10 +60,10 @@ def __init__(
6060
self._on_off_device = _on_off_device
6161
self._opentherm_device = _opentherm_device
6262
self._request = _request
63+
self._smile_props = _smile_props
6364
self._stretch_v2 = _stretch_v2
6465
self._target_smile = _target_smile
6566
self.cooling_present = False
66-
self.gw_data = gw_data
6767
self.smile_hostname = smile_hostname
6868
self.smile_hw_version = smile_hw_version
6969
self.smile_mac_address = smile_mac_address
@@ -139,7 +139,7 @@ async def async_update(self) -> PlugwiseData:
139139
self._previous_day_number = day_number
140140
return PlugwiseData(
141141
devices=self.gw_entities,
142-
gateway=self.gw_data,
142+
gateway=self._smile_props,
143143
)
144144

145145
########################################################################################################

plugwise/smile.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
NOTIFICATIONS,
2323
OFF,
2424
RULES,
25-
GatewayData,
2625
GwEntityData,
2726
PlugwiseData,
27+
SmileProps,
2828
ThermoLoc,
2929
)
3030
from plugwise.data import SmileData
@@ -52,8 +52,8 @@ def __init__(
5252
_opentherm_device: bool,
5353
_request: Callable[..., Awaitable[Any]],
5454
_schedule_old_states: dict[str, dict[str, str]],
55+
_smile_props: SmileProps,
5556
cooling_present: bool,
56-
gw_data: GatewayData,
5757
smile_hostname: str | None,
5858
smile_hw_version: str | None,
5959
smile_mac_address: str | None,
@@ -75,8 +75,8 @@ def __init__(
7575
self._opentherm_device = _opentherm_device
7676
self._request = _request
7777
self._schedule_old_states = _schedule_old_states
78+
self._smile_props = _smile_props
7879
self.cooling_present = cooling_present
79-
self.gw_data = gw_data
8080
self.smile_hostname = smile_hostname
8181
self.smile_hw_version = smile_hw_version
8282
self.smile_mac_address = smile_mac_address
@@ -126,8 +126,8 @@ async def async_update(self) -> PlugwiseData:
126126
self.get_all_gateway_entities()
127127
# Set self._cooling_enabled - required for set_temperature(),
128128
# also, check for a failed data-retrieval
129-
if "heater_id" in self.gw_data:
130-
heat_cooler = self.gw_entities[self.gw_data["heater_id"]]
129+
if "heater_id" in self._smile_props:
130+
heat_cooler = self.gw_entities[self._smile_props["heater_id"]]
131131
if (
132132
"binary_sensors" in heat_cooler
133133
and "cooling_enabled" in heat_cooler["binary_sensors"]
@@ -142,7 +142,7 @@ async def async_update(self) -> PlugwiseData:
142142

143143
return PlugwiseData(
144144
devices=self.gw_entities,
145-
gateway=self.gw_data,
145+
gateway=self._smile_props,
146146
)
147147

148148
########################################################################################################

0 commit comments

Comments
 (0)