diff --git a/custom_components/oekofen_pellematic_compact/sensor.py b/custom_components/oekofen_pellematic_compact/sensor.py index c918e9d..a714de0 100644 --- a/custom_components/oekofen_pellematic_compact/sensor.py +++ b/custom_components/oekofen_pellematic_compact/sensor.py @@ -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", "")] @@ -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