Skip to content

Commit

Permalink
Fix value function
Browse files Browse the repository at this point in the history
  • Loading branch information
cyr-ius committed Jun 10, 2024
1 parent 228ea72 commit 60a0cfd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/audiconnect/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class AudiLock(AudiEntity, LockEntity):
def is_locked(self):
"""Return lock status."""
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

Expand Down
2 changes: 1 addition & 1 deletion custom_components/audiconnect/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def mode(self) -> str:
def native_value(self) -> float:
"""Native value."""
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

Expand Down
2 changes: 1 addition & 1 deletion custom_components/audiconnect/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AudiSelect(AudiEntity, SelectEntity):
def current_option(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

Expand Down

0 comments on commit 60a0cfd

Please sign in to comment.