Fix bug related to possibly missing task ID in Notion API data (#43330)
* Fix bug related to possibly missing task ID in Notion API data * Calculate unique ID once * Code review * Simplify * Code review
This commit is contained in:
parent
492ef81069
commit
a4f7b7d784
3 changed files with 13 additions and 9 deletions
|
@ -76,7 +76,7 @@ class NotionSensor(NotionEntity):
|
|||
@callback
|
||||
def _async_update_from_latest_data(self) -> None:
|
||||
"""Fetch new state data for the sensor."""
|
||||
task = self.coordinator.data["tasks"][self._task_id]
|
||||
task = self.coordinator.data["tasks"][self.task_id]
|
||||
|
||||
if task["task_type"] == SENSOR_TEMPERATURE:
|
||||
self._state = round(float(task["status"]["value"]), 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue