Skip to content

Commit 5c60f72

Browse files
committed
Clean up
1 parent fb31ff6 commit 5c60f72

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

plugwise/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def _power_data_energy_diff(
171171
diff = 1
172172
if "produced" in measurement:
173173
diff = -1
174-
if net_string not in direct_data["sensors"]:
174+
if net_string not in data["sensors"]:
175175
tmp_val: float | int = 0
176176
else:
177177
tmp_val = data["sensors"][net_string]

plugwise/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def _update_zones(self) -> None:
5858
Collect data for each zone/location and add to self.zones.
5959
"""
6060
for location_id, zone in self.zones.items():
61-
data = self._get_location_data(location_id)
61+
data = self._get_zone_data(location_id)
6262
zone.update(data)
6363

6464
def _update_gw_entities(self) -> None:
@@ -153,7 +153,7 @@ def _update_for_cooling(self, entity: GwEntityData) -> None:
153153
self._count += 2 # add 4, remove 2
154154

155155

156-
def _get_location_data(self, loc_id: str) -> GwEntityData:
156+
def _get_zone_data(self, loc_id: str) -> GwEntityData:
157157
"""Helper-function for _all_entity_data() and async_update().
158158
159159
Provide entity-data, based on Location ID (= loc_id).

plugwise/helper.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def __init__(self) -> None:
261261
self.smile_type: str
262262
self.smile_zigbee_mac_address: str | None
263263
self.therms_with_offset_func: list[str] = []
264-
self.zone_data: dict[str, GwEntityData] = {}
264+
self.zones: dict[str, GwEntityData] = {}
265265
SmileCommon.__init__(self)
266266

267267
def _all_appliances(self) -> None:
@@ -488,7 +488,7 @@ def _get_zone_data(self, loc_id: str) -> GwEntityData:
488488
Collect the location-data based on location id.
489489
"""
490490
data: GwEntityData = {"sensors": {}}
491-
zone = self.zone_data[loc_id]
491+
zone = self.zones[loc_id]
492492
measurements = ZONE_MEASUREMENTS
493493
if (
494494
location := self._domain_objects.find(f'./location[@id="{loc_id}"]')
@@ -552,7 +552,7 @@ def _power_data_from_location(self, loc_id: str) -> GwEntityData:
552552
553553
Collect the power-data based on Location ID, from LOCATIONS.
554554
"""
555-
direct_data: GwEntityData = {"sensors": {}}
555+
data: GwEntityData = {"sensors": {}}
556556
loc = Munch()
557557
log_list: list[str] = ["point_log", "cumulative_log", "interval_log"]
558558
t_string = "tariff"
@@ -561,10 +561,10 @@ def _power_data_from_location(self, loc_id: str) -> GwEntityData:
561561
loc.logs = search.find(f'./location[@id="{loc_id}"]/logs')
562562
for loc.measurement, loc.attrs in P1_MEASUREMENTS.items():
563563
for loc.log_type in log_list:
564-
self._collect_power_values(direct_data, loc, t_string)
564+
self._collect_power_values(data, loc, t_string)
565565

566-
self._count += len(direct_data["sensors"])
567-
return direct_data
566+
self._count += len(data["sensors"])
567+
return data
568568

569569
def _appliance_measurements(
570570
self,
@@ -866,7 +866,7 @@ def _scan_thermostats(self) -> None:
866866

867867
for loc_id, loc_data in list(self._thermo_locs.items()):
868868
if loc_data["primary_prio"] != 0:
869-
self.zone_data[loc_id] = {
869+
self.zones[loc_id] = {
870870
"dev_class": "climate",
871871
"name": loc_data["name"],
872872
"thermostats": {"primary": loc_data["primary"], "secondary": loc_data["secondary"]}

plugwise/legacy/helper.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def _power_data_from_modules(self) -> GwEntityData:
316316
317317
Collect the power-data from MODULES (P1 legacy only).
318318
"""
319-
direct_data: GwEntityData = {"sensors": {}}
319+
data: GwEntityData = {"sensors": {}}
320320
loc = Munch()
321321
mod_list: list[str] = ["interval_meter", "cumulative_meter", "point_meter"]
322322
t_string = "tariff_indicator"
@@ -327,10 +327,10 @@ def _power_data_from_modules(self) -> GwEntityData:
327327
loc.meas_list = loc.measurement.split("_")
328328
for loc.logs in mod_logs:
329329
for loc.log_type in mod_list:
330-
self._collect_power_values(direct_data, loc, t_string, legacy=True)
330+
self._collect_power_values(data, loc, t_string, legacy=True)
331331

332-
self._count += len(direct_data["sensors"])
333-
return direct_data
332+
self._count += len(data["sensors"])
333+
return data
334334

335335
def _appliance_measurements(
336336
self,

plugwise/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
UOM,
2424
BinarySensorType,
2525
GwEntityData,
26-
ModelData,
26+
ModuleData,
2727
SensorType,
2828
SpecialType,
2929
SwitchType,
@@ -179,7 +179,7 @@ def format_measure(measure: str, unit: str) -> float | int:
179179
return result
180180

181181

182-
def get_vendor_name(module: etree, model_data: ModelData) -> ModelData:
182+
def get_vendor_name(module: etree, model_data: ModuleData) -> ModuleData:
183183
"""Helper-function for _get_model_data()."""
184184
if (vendor_name := module.find("vendor_name").text) is not None:
185185
model_data["vendor_name"] = vendor_name

0 commit comments

Comments
 (0)