Add missing @callback decorator in here_travel_time sensor (#83009)
parent
671e6b3832
commit
e158546425
|
@ -21,7 +21,7 @@ from homeassistant.const import (
|
||||||
TIME_MINUTES,
|
TIME_MINUTES,
|
||||||
UnitOfLength,
|
UnitOfLength,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.device_registry import DeviceEntryType
|
from homeassistant.helpers.device_registry import DeviceEntryType
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
@ -99,7 +99,7 @@ async def async_setup_entry(
|
||||||
async_add_entities(sensors)
|
async_add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class HERETravelTimeSensor(RestoreSensor, CoordinatorEntity):
|
class HERETravelTimeSensor(CoordinatorEntity, RestoreSensor):
|
||||||
"""Representation of a HERE travel time sensor."""
|
"""Representation of a HERE travel time sensor."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -136,6 +136,7 @@ class HERETravelTimeSensor(RestoreSensor, CoordinatorEntity):
|
||||||
|
|
||||||
self.async_on_remove(async_at_start(self.hass, _update_at_start))
|
self.async_on_remove(async_at_start(self.hass, _update_at_start))
|
||||||
|
|
||||||
|
@callback
|
||||||
def _handle_coordinator_update(self) -> None:
|
def _handle_coordinator_update(self) -> None:
|
||||||
"""Handle updated data from the coordinator."""
|
"""Handle updated data from the coordinator."""
|
||||||
if self.coordinator.data is not None:
|
if self.coordinator.data is not None:
|
||||||
|
|
|
@ -558,8 +558,6 @@ async def test_restore_state(hass):
|
||||||
await hass.config_entries.async_setup(mock_entry.entry_id)
|
await hass.config_entries.async_setup(mock_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
print(hass.states.async_all())
|
|
||||||
|
|
||||||
# restore from cache
|
# restore from cache
|
||||||
state = hass.states.get("sensor.test_duration")
|
state = hass.states.get("sensor.test_duration")
|
||||||
assert state.state == "1234"
|
assert state.state == "1234"
|
||||||
|
|
Loading…
Reference in New Issue