Skip to content

Commit

Permalink
Fix sensor_state_listener
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed May 3, 2024
1 parent 91d4791 commit 89ec045
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/iaquk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
UNIT_NOT_RECOGNIZED_TEMPLATE,
UnitOfTemperature,
)
from homeassistant.core import State, callback
from homeassistant.core import Event, EventStateChangedData, State, callback
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import async_track_state_change_event
Expand Down Expand Up @@ -177,7 +177,7 @@ def async_added_to_hass(self):

# pylint: disable=unused-argument
@callback
def sensor_state_listener(entity, old_state, new_state):
def sensor_state_listener(event: Event[EventStateChangedData]) -> None:
"""Handle device state changes."""
self.update()

Expand All @@ -199,7 +199,7 @@ def sensor_startup(event):
)

async_track_state_change_event(self.hass, entity_ids, sensor_state_listener)
sensor_state_listener(None, None, None) # Force first update
self.update() # Force first update

if not self._added:
self._added = True
Expand Down

0 comments on commit 89ec045

Please sign in to comment.