Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions homeassistant/components/switchbot_cloud/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,17 @@ def __init__(
self.entity_description = description
self._attr_unique_id = f"{device.device_id}_{description.key}"

@property
def is_on(self) -> bool | None:
def _set_attributes(self) -> None:
"""Set attributes from coordinator data."""
if not self.coordinator.data:
return None
return

if self.entity_description.value_fn:
return self.entity_description.value_fn(self.coordinator.data)
self._attr_is_on = self.entity_description.value_fn(self.coordinator.data)
return

return (
self._attr_is_on = (
self.coordinator.data.get(self.entity_description.key)
== self.entity_description.on_value
)
return
Loading