Skip to content

Commit

Permalink
Fix state if value function exists
Browse files Browse the repository at this point in the history
  • Loading branch information
cyr-ius committed Jun 10, 2024
1 parent 16ad5d9 commit 1ebdc66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/audiconnect/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,6 @@ class AudiBinarySensor(AudiEntity, BinarySensorEntity):
def is_on(self):
"""Return is on."""
value = self.getattr(self.entity_description.value)
if value and self.entity_description.value_fn:
if value is not None and self.entity_description.value_fn:
return self.entity_description.value_fn(value)
return value
2 changes: 1 addition & 1 deletion custom_components/audiconnect/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,6 @@ class AudiSensor(AudiEntity, SensorEntity):
def state(self):
"""Return sensor state."""
value = self.getattr(self.entity_description.value)
if value and self.entity_description.value_fn:
if value is not None and self.entity_description.value_fn:
return self.entity_description.value_fn(value)
return value

0 comments on commit 1ebdc66

Please sign in to comment.