Skip to content

Commit

Permalink
Fix values assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
Aohzan committed Jan 16, 2023
1 parent 027e7bd commit f217e55
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.3.1

- Fix values assignments

## 4.3.0

- Add support of teleinfo "jours bleu,blanc,rouge"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ecodevices/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"config_flow": true,
"requirements": ["xmltodict==0.12.0", "pyecodevices==1.5.0"],
"dependencies": [],
"version": "4.3.0",
"version": "4.3.1",
"iot_class": "local_polling"
}
22 changes: 10 additions & 12 deletions custom_components/ecodevices/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ class T1TotalEdDevice(EdDevice):
@property
def native_value(self) -> float:
"""Return the total value if it's greater than 0."""
if value := float(self.coordinator.data["T1_BASE"]) > 0:
if (value := float(self.coordinator.data["T1_BASE"])) > 0:
return value
raise EcoDevicesIncorrectValueError("Total value not greater than 0.")

Expand All @@ -414,7 +414,7 @@ def native_value(self) -> float:
"""Return the total value if it's greater than 0."""
value_hc = float(self.coordinator.data["T1_HCHC"])
value_hp = float(self.coordinator.data["T1_HCHP"])
if value := value_hc + value_hp > 0:
if (value := value_hc + value_hp) > 0:
return value
raise EcoDevicesIncorrectValueError("Total value not greater than 0.")

Expand All @@ -425,7 +425,7 @@ class T1TotalHcEdDevice(EdDevice):
@property
def native_value(self) -> float:
"""Return the total value if it's greater than 0."""
if value := float(self.coordinator.data["T1_HCHC"]) > 0:
if (value := float(self.coordinator.data["T1_HCHC"])) > 0:
return value
raise EcoDevicesIncorrectValueError("Total value not greater than 0.")

Expand All @@ -436,7 +436,7 @@ class T1TotalHpEdDevice(EdDevice):
@property
def native_value(self) -> float:
"""Return the total value if it's greater than 0."""
if value := float(self.coordinator.data["T1_HCHP"]) > 0:
if (value := float(self.coordinator.data["T1_HCHP"])) > 0:
return value
raise EcoDevicesIncorrectValueError("Total value not greater than 0.")

Expand Down Expand Up @@ -502,7 +502,7 @@ class T2TotalEdDevice(EdDevice):
@property
def native_value(self) -> float:
"""Return the total value if it's greater than 0."""
if value := float(self.coordinator.data["T2_BASE"]) > 0:
if (value := float(self.coordinator.data["T2_BASE"])) > 0:
return value
raise EcoDevicesIncorrectValueError("Total value not greater than 0.")

Expand All @@ -515,7 +515,7 @@ def native_value(self) -> float:
"""Return the total value if it's greater than 0."""
value_hc = float(self.coordinator.data["T2_HCHC"])
value_hp = float(self.coordinator.data["T2_HCHP"])
if value := value_hc + value_hp > 0:
if (value := value_hc + value_hp) > 0:
return value
raise EcoDevicesIncorrectValueError("Total value not greater than 0.")

Expand All @@ -526,7 +526,7 @@ class T2TotalHcEdDevice(EdDevice):
@property
def native_value(self) -> float:
"""Return the total value if it's greater than 0."""
if value := float(self.coordinator.data["T2_HCHC"]) > 0:
if (value := float(self.coordinator.data["T2_HCHC"])) > 0:
return value
raise EcoDevicesIncorrectValueError("Total value not greater than 0.")

Expand All @@ -537,7 +537,7 @@ class T2TotalHpEdDevice(EdDevice):
@property
def native_value(self) -> float:
"""Return the total value if it's greater than 0."""
if value := float(self.coordinator.data["T2_HCHP"]) > 0:
if (value := float(self.coordinator.data["T2_HCHP"])) > 0:
return value
raise EcoDevicesIncorrectValueError("Total value not greater than 0.")

Expand Down Expand Up @@ -576,8 +576,7 @@ class C1TotalEdDevice(EdDevice):
@property
def native_value(self) -> float:
"""Return the total value if it's greater than 0."""
value = float(self.coordinator.data["count0"])
if value > 0:
if (value := float(self.coordinator.data["count0"])) > 0:
return value / 1000
raise EcoDevicesIncorrectValueError("Total value not greater than 0.")

Expand Down Expand Up @@ -616,8 +615,7 @@ class C2TotalEdDevice(EdDevice):
@property
def native_value(self) -> float:
"""Return the total value if it's greater than 0."""
value = float(self.coordinator.data["count1"])
if value > 0:
if (value := float(self.coordinator.data["count1"])) > 0:
return value / 1000
raise EcoDevicesIncorrectValueError("Total value not greater than 0.")

Expand Down

0 comments on commit f217e55

Please sign in to comment.