Add missing @callback decorator in here_travel_time sensor (#83009)

pull/83013/head
Kevin Stillhammer 2022-11-30 22:40:17 +01:00 committed by GitHub
parent 671e6b3832
commit e158546425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -21,7 +21,7 @@ from homeassistant.const import (
TIME_MINUTES,
UnitOfLength,
)
from homeassistant.core import HomeAssistant
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -99,7 +99,7 @@ async def async_setup_entry(
async_add_entities(sensors)
class HERETravelTimeSensor(RestoreSensor, CoordinatorEntity):
class HERETravelTimeSensor(CoordinatorEntity, RestoreSensor):
"""Representation of a HERE travel time sensor."""
def __init__(
@ -136,6 +136,7 @@ class HERETravelTimeSensor(RestoreSensor, CoordinatorEntity):
self.async_on_remove(async_at_start(self.hass, _update_at_start))
@callback
def _handle_coordinator_update(self) -> None:
"""Handle updated data from the coordinator."""
if self.coordinator.data is not None:

View File

@ -558,8 +558,6 @@ async def test_restore_state(hass):
await hass.config_entries.async_setup(mock_entry.entry_id)
await hass.async_block_till_done()
print(hass.states.async_all())
# restore from cache
state = hass.states.get("sensor.test_duration")
assert state.state == "1234"