Skip to content

Commit f3280a3

Browse files
committed
Formatting
1 parent ce5a682 commit f3280a3

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

plugwise/models.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
def process_key(data: dict[str, Any], key: str) -> Any | None:
1212
"""Return the key value from the data dict, when present."""
13-
1413
if key in data:
1514
return data[key]
1615

@@ -19,7 +18,6 @@ def process_key(data: dict[str, Any], key: str) -> Any | None:
1918

2019
def process_dict(data: dict[str, Any], dict_type: str, key: str) -> Any | None:
2120
"""Return the key value from the data dict, when present."""
22-
2321
if dict_type in data and key in data[dict_type]:
2422
return data[dict_type][key]
2523

@@ -46,7 +44,6 @@ class DeviceBase:
4644

4745
def update_from_dict(self, data: dict[str, Any]) -> None:
4846
"""Update this DeviceBase object with data from a dictionary."""
49-
5047
self.available = process_key(data, "available")
5148
self.dev_class = process_key(data, "dev_class")
5249
self.firmware = process_key(data, "firmware")
@@ -79,7 +76,6 @@ def __init__(self) -> None:
7976

8077
def update_from_dict(self, data: dict[str, Any]) -> None:
8178
"""Update this Gateway object with data from a dictionary."""
82-
8379
super().update_from_dict(data)
8480
self.binary_sensors.update_from_dict(data)
8581
self.gateway_modes = process_key(data, "gateway_modes")
@@ -97,7 +93,6 @@ class GatewayBinarySensors:
9793

9894
def update_from_dict(self, data: dict[str, Any]) -> None:
9995
"""Update this GatewayBinarySensors object with data from a dictionary."""
100-
10196
self.plugwise_notification = process_dict(
10297
data, "binary_sensors", "plugwise_notification"
10398
)
@@ -111,7 +106,6 @@ class Weather:
111106

112107
def update_from_dict(self, data: dict[str, Any]) -> None:
113108
"""Update this Weather object with data from a dictionary."""
114-
115109
self.outdoor_temperature = process_dict(data, "sensors", "outdoor_temperature")
116110

117111

@@ -128,7 +122,6 @@ def __init__(self) -> None:
128122

129123
def update_from_dict(self, data: dict[str, Any]) -> None:
130124
"""Update this SmartEnergyMeter object with data from a dictionary."""
131-
132125
super().update_from_dict(data)
133126
self.sensors.update_from_dict(data)
134127

@@ -167,7 +160,6 @@ class SmartEnergySensors:
167160

168161
def update_from_dict(self, data: dict[str, Any]) -> None:
169162
"""Update this SmartEnergySensors object with data from a dictionary."""
170-
171163
self.electricity_consumed_off_peak_cumulative = process_dict(
172164
data, "sensors", "electricity_consumed_off_peak_cumulative"
173165
)
@@ -268,7 +260,6 @@ def __init__(self) -> None:
268260

269261
def update_from_dict(self, data: dict[str, Any]) -> None:
270262
"""Update this climate Zone object with data from a dictionary."""
271-
272263
super().update_from_dict(data)
273264
self.sensors.update_from_dict(data)
274265
self.available_schedules = process_key(data, "available_schedules")
@@ -293,7 +284,6 @@ class ZoneSensors:
293284

294285
def update_from_dict(self, data: dict[str, Any]) -> None:
295286
"""Update this ZoneSensors object with data from a dictionary."""
296-
297287
self.electricity_consumed = process_dict(
298288
data, "sensors", "electricity_consumed"
299289
)
@@ -327,7 +317,6 @@ def __init__(self) -> None:
327317

328318
def update_from_dict(self, data: dict[str, Any]) -> None:
329319
"""Update this Thermostat object with data from a dictionary."""
330-
331320
super().update_from_dict(data)
332321
self.binary_sensors.update_from_dict(data)
333322
self.sensors.update_from_dict(data)
@@ -358,7 +347,6 @@ class ThermostatSensors:
358347

359348
def update_from_dict(self, data: dict[str, Any]) -> None:
360349
"""Update this ThermostatSensors object with data from a dictionary."""
361-
362350
self.battery = process_dict(data, "sensors", "battery")
363351
self.humidity = process_dict(data, "sensors", "humidity")
364352
self.illuminance = process_dict(data, "sensors", "illuminance")
@@ -380,7 +368,6 @@ class WirelessThermostatBinarySensors:
380368

381369
def update_from_dict(self, data: dict[str, Any]) -> None:
382370
"""Update this WirelessThermostatBinarySensors object with data from a dictionary."""
383-
384371
self.low_battery = process_dict(data, "binary_sensors", "low_battery")
385372

386373

@@ -440,7 +427,6 @@ def __init__(self) -> None:
440427

441428
def update_from_dict(self, data: dict[str, Any]) -> None:
442429
"""Update this ClimateDevice object with data from a dictionary."""
443-
444430
super().update_from_dict(data)
445431
self.binary_sensors.update_from_dict(data)
446432
self.sensors.update_from_dict(data)
@@ -466,7 +452,6 @@ class ClimateDeviceBinarySensors:
466452

467453
def update_from_dict(self, data: dict[str, Any]) -> None:
468454
"""Update this ClimateDeviceBinarySensors object with data from a dictionary."""
469-
470455
self.compressor_state = process_dict(data, "binary_sensors", "compressor_state")
471456
self.cooling_enabled = process_dict(data, "binary_sensors", "cooling_enabled")
472457
self.cooling_state = process_dict(data, "binary_sensors", "cooling_state")
@@ -493,7 +478,6 @@ class ClimateDeviceSensors:
493478

494479
def update_from_dict(self, data: dict[str, Any]) -> None:
495480
"""Update this ClimateDeviceSensors object with data from a dictionary."""
496-
497481
self.dhw_temperature = process_dict(data, "sensors", "dhw_temperature")
498482
self.domestic_hot_water_setpoint = process_dict(
499483
data, "sensors", "domestic_hot_water_setpoint"
@@ -519,7 +503,6 @@ class ClimateDeviceSwitches:
519503

520504
def update_from_dict(self, data: dict[str, Any]) -> None:
521505
"""Update this ClimateDeviceSwitches object with data from a dictionary."""
522-
523506
self.cooling_ena_switch = process_dict(data, "switches", "cooling_ena_switch")
524507
self.dhw_cm_switch = process_dict(data, "switches", "dhw_cm_switch")
525508

@@ -540,7 +523,6 @@ def __init__(self) -> None:
540523

541524
def update_from_dict(self, data: dict[str, Any]) -> None:
542525
"""Update this Plug object with data from a dictionary."""
543-
544526
super().update_from_dict(data)
545527
self.sensors.update_from_dict(data)
546528
self.switches.update_from_dict(data)
@@ -558,7 +540,6 @@ class PlugSensors:
558540

559541
def update_from_dict(self, data: dict[str, Any]) -> None:
560542
"""Update this PlugSensors object with data from a dictionary."""
561-
562543
self.electricity_consumed = process_dict(
563544
data, "sensors", "electricity_consumed"
564545
)
@@ -582,7 +563,6 @@ class PlugSwitches:
582563

583564
def update_from_dict(self, data: dict[str, Any]) -> None:
584565
"""Update this PlugSwitches object with data from a dictionary."""
585-
586566
self.lock = process_dict(data, "switches", "lock")
587567
self.relay = process_dict(data, "switches", "relay")
588568

@@ -673,7 +653,6 @@ def __init__(self, data: Any) -> None:
673653

674654
def update_from_dict(self, data: dict[str, Any]) -> None:
675655
"""Update the status object with data received from the Plugwise API."""
676-
677656
for device_id, device in data.items():
678657
if device["dev_class"] == "gateway":
679658
self.gateway.update_from_dict(device)

0 commit comments

Comments
 (0)