Skip to content

Commit 27a2475

Browse files
committed
Improve main function docstrings
1 parent 7d701a3 commit 27a2475

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

plugwise/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,15 @@ async def _smile_detect_legacy(
305305
return return_model
306306

307307
async def full_xml_update(self) -> None:
308-
"""Helper-function used for testing."""
308+
"""Perform a first fetch of the Plugwise server XML data."""
309309
await self._smile_api.full_xml_update()
310310

311311
def get_all_gateway_entities(self) -> None:
312-
"""Helper-function used for testing."""
312+
"""Collect the Plugwise gateway entities and their data and states from the received raw XML-data."""
313313
self._smile_api.get_all_gateway_entities()
314314

315315
async def async_update(self) -> PlugwiseData:
316-
"""Update the various entities and their states."""
316+
"""Update the Plughwise gateway entities and their data and states."""
317317
data = PlugwiseData(devices={}, gateway={})
318318
try:
319319
data = await self._smile_api.async_update()

plugwise/legacy/smile.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(
8383
self._previous_day_number: str = "0"
8484

8585
async def full_xml_update(self) -> None:
86-
"""Perform a first fetch of all XML data, needed for initialization."""
86+
"""Perform a first fetch of the Plugwise server XML data."""
8787
self._domain_objects = await self.request(DOMAIN_OBJECTS)
8888
self._locations = await self.request(LOCATIONS)
8989
self._modules = await self.request(MODULES)
@@ -92,24 +92,23 @@ async def full_xml_update(self) -> None:
9292
self._appliances = await self.request(APPLIANCES)
9393

9494
def get_all_gateway_entities(self) -> None:
95-
"""Collect the gateway entities from the received raw XML-data.
95+
"""Collect the Plugwise gateway entities and their data and states from the received raw XML-data.
9696
97-
Run this functions once to gather the initial device configuration,
98-
then regularly run async_update() to refresh the device data.
97+
First, collect all the connected entities and their initial data.
98+
Collect and add switching- and/or pump-group entities.
99+
Finally, collect the data and states for each entity.
99100
"""
100-
# Gather all the devices and their initial data
101101
self._all_appliances()
102-
103-
# Collect and add switching- and/or pump-group devices
104102
if group_data := self._get_group_switches():
105103
self.gw_entities.update(group_data)
106104

107-
# Collect the remaining data for all entities
108105
self._all_entity_data()
109106

110107
async def async_update(self) -> PlugwiseData:
111-
"""Perform an incremental update for updating the various device states."""
112-
# Perform a full update at day-change
108+
"""Perform an full update update at day-change: re-collect all gateway entities and their data and states.
109+
110+
Otherwise perform an incremental update: only collect the entities updated data and states.
111+
"""
113112
day_number = dt.datetime.now().strftime("%w")
114113
if (
115114
day_number # pylint: disable=consider-using-assignment-expr
@@ -129,7 +128,6 @@ async def async_update(self) -> PlugwiseData:
129128
raise DataMissingError(
130129
"No (full) Plugwise legacy data received"
131130
) from err
132-
# Otherwise perform an incremental update
133131
else:
134132
try:
135133
self._domain_objects = await self.request(DOMAIN_OBJECTS)

plugwise/smile.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,42 +97,43 @@ def __init__(
9797
SmileData.__init__(self)
9898

9999
async def full_xml_update(self) -> None:
100-
"""Perform a first fetch of all XML data, needed for initialization."""
100+
"""Perform a first fetch of the Plugwise server XML data."""
101101
self._domain_objects = await self.request(DOMAIN_OBJECTS)
102102
self._get_plugwise_notifications()
103103

104104
def get_all_gateway_entities(self) -> None:
105-
"""Collect the gateway entities from the received raw XML-data.
105+
"""Collect the Plugwise gateway entities and their data and states from the received raw XML-data.
106106
107-
Run this functions once to gather the initial configuration,
108-
then regularly run async_update() to refresh the entity data.
107+
First, collect all the connected entities and their initial data.
108+
If a thermostat-gateway, collect a list of thermostats with offset-capability.
109+
Collect and add switching- and/or pump-group entities.
110+
Finally, collect the data and states for each entity.
109111
"""
110-
# Gather all the entities and their initial data
111112
self._all_appliances()
112113
if self._is_thermostat:
113-
if self.smile(ADAM):
114-
self._scan_thermostats()
115-
# Collect a list of thermostats with offset-capability
116114
self.therms_with_offset_func = (
117115
self._get_appliances_with_offset_functionality()
118116
)
117+
if self.smile(ADAM):
118+
self._scan_thermostats()
119119

120-
# Collect and add switching- and/or pump-group devices
121120
if group_data := self._get_group_switches():
122121
self.gw_entities.update(group_data)
123122

124-
# Collect the remaining data for all entities
125123
self._all_entity_data()
126124

127125
async def async_update(self) -> PlugwiseData:
128-
"""Perform an incremental update for updating the various device states."""
126+
"""Perform an full update: re-collect all gateway entities and their data and states.
127+
128+
Any change in the connected entities will be detected immediately.
129+
"""
129130
self.gw_data: GatewayData = {}
130131
self.gw_entities: dict[str, GwEntityData] = {}
131132
self._zones: dict[str, GwEntityData] = {}
132133
try:
133134
await self.full_xml_update()
134135
self.get_all_gateway_entities()
135-
# Set self._cooling_enabled - required for set_temperature,
136+
# Set self._cooling_enabled - required for set_temperature(),
136137
# also, check for a failed data-retrieval
137138
if "heater_id" in self.gw_data:
138139
heat_cooler = self.gw_entities[self.gw_data["heater_id"]]

0 commit comments

Comments
 (0)