Skip to content

Commit

Permalink
Merge pull request #72 from dominikamann/dominikamann-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikamann authored Oct 16, 2024
2 parents 0d939e1 + 8832e3b commit 5033a70
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions custom_components/oekofen_pellematic_compact/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,11 @@ def _update_state(self):
current_value = int(current_value) / 10
else:
current_value = int(current_value) / 10000
if self._attr_device_class == SensorDeviceClass.POWER_FACTOR:
if current_value == 'true':
current_value = 100
elif current_value == 'false':
current_value = 0
except:
try:
current_value = self._hub.data[self._prefix][self._key.replace("#2", "")]
Expand All @@ -557,6 +562,11 @@ def _update_state(self):
current_value = int(current_value) / 10
else:
current_value = int(current_value) / 10000
if self._attr_device_class == SensorDeviceClass.POWER_FACTOR:
if current_value == 'true':
current_value = 100
elif current_value == 'false':
current_value = 0
except:
self._state = current_value
self._state = current_value
Expand Down

0 comments on commit 5033a70

Please sign in to comment.