Update notion to use CoordinatorEntity (#39460)
This commit is contained in:
parent
773860ca5c
commit
692ed8c639
3 changed files with 21 additions and 23 deletions
|
@ -73,12 +73,12 @@ class NotionBinarySensor(NotionEntity, BinarySensorEntity):
|
|||
@callback
|
||||
def _async_update_from_latest_data(self) -> None:
|
||||
"""Fetch new state data for the sensor."""
|
||||
self._state = self._coordinator.data["tasks"][self._task_id]["status"]["value"]
|
||||
self._state = self.coordinator.data["tasks"][self._task_id]["status"]["value"]
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""Return whether the sensor is on or off."""
|
||||
task = self._coordinator.data["tasks"][self._task_id]
|
||||
task = self.coordinator.data["tasks"][self._task_id]
|
||||
|
||||
if task["task_type"] == SENSOR_BATTERY:
|
||||
return self._state != "battery_good"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue