Skip to content

Commit

Permalink
Merge pull request #71 from Ultchad/l_pump_str_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikamann authored Oct 16, 2024
2 parents c94147b + bb5f37e commit 0d939e1
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions custom_components/oekofen_pellematic_compact/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,13 @@ def is_on(self) -> bool:
try:
current_value = self._hub.data[self._prefix][self._key.replace("#2", "")]
except:
return current_value
pass

if current_value == 'true':
current_value = True
elif current_value == 'false':
current_value = False

return current_value

async def async_added_to_hass(self):
Expand Down Expand Up @@ -586,6 +592,11 @@ def 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 @@ -599,8 +610,13 @@ def 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:
return current_value
pass
return current_value

@property
Expand Down

0 comments on commit 0d939e1

Please sign in to comment.