python-homewizard-energy 8.2.0__tar.gz → 8.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/PKG-INFO +1 -1
  2. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/models.py +23 -0
  3. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/pyproject.toml +1 -1
  4. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/LICENSE +0 -0
  5. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/README.md +0 -0
  6. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/__init__.py +0 -0
  7. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/const.py +0 -0
  8. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/errors.py +0 -0
  9. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/homewizard_energy.py +0 -0
  10. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/py.typed +0 -0
  11. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/utils.py +0 -0
  12. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/v1/__init__.py +0 -0
  13. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/v1/const.py +0 -0
  14. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/v2/__init__.py +0 -0
  15. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/v2/cacert.py +0 -0
  16. {python_homewizard_energy-8.2.0 → python_homewizard_energy-8.3.0}/homewizard_energy/v2/const.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-homewizard-energy
3
- Version: 8.2.0
3
+ Version: 8.3.0
4
4
  Summary: Asynchronous Python client for the HomeWizard Energy
5
5
  Home-page: https://github.com/homewizard/python-homewizard-energy
6
6
  License: Apache-2.0
@@ -85,6 +85,12 @@ class CombinedModels:
85
85
  self.system = System()
86
86
  self.system.wifi_ssid = self.measurement.wifi_ssid
87
87
 
88
+ ## measurement.wifi_strength -> system.wifi_strength_pct
89
+ if self.measurement is not None and self.measurement.wifi_strength is not None:
90
+ if self.system is None:
91
+ self.system = System()
92
+ self.system.wifi_strength_pct = self.measurement.wifi_strength
93
+
88
94
  ## state.brightness -> system.status_led_brightness_pct
89
95
  if self.state is not None and self.state.brightness is not None:
90
96
  if self.system is None:
@@ -540,6 +546,8 @@ class SystemUpdate(UpdateBaseModel):
540
546
  class System(BaseModel):
541
547
  """Represent System config."""
542
548
 
549
+ wifi_strength_pct: int | None = None
550
+
543
551
  wifi_ssid: str | None = field(default=None)
544
552
  wifi_rssi_db: int | None = field(default=None)
545
553
  cloud_enabled: bool | None = field(default=None)
@@ -547,6 +555,21 @@ class System(BaseModel):
547
555
  status_led_brightness_pct: int | None = field(default=None)
548
556
  api_v1_enabled: bool | None = field(default=None)
549
557
 
558
+ @classmethod
559
+ def __post_deserialize__(cls, obj: System) -> System:
560
+ _ = cls # Unused
561
+
562
+ if obj.wifi_rssi_db is not None:
563
+ obj.wifi_strength_pct = (
564
+ 0
565
+ if obj.wifi_rssi_db <= -100 or obj.wifi_rssi_db == 0
566
+ else 100
567
+ if obj.wifi_rssi_db >= -50
568
+ else 2 * (obj.wifi_rssi_db + 100)
569
+ )
570
+
571
+ return obj
572
+
550
573
 
551
574
  @dataclass(kw_only=True)
552
575
  class Token(BaseModel):
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-homewizard-energy"
3
- version = "8.2.0"
3
+ version = "8.3.0"
4
4
  description = "Asynchronous Python client for the HomeWizard Energy"
5
5
  authors = ["DCSBL"]
6
6
  maintainers = ["DCSBL"]