Skip to content

Commit

Permalink
Replace async_track_state_change -> async_track_state_change_event (Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed May 10, 2024
1 parent 4683c08 commit 45aa6eb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions custom_components/car_wash/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
EVENT_HOMEASSISTANT_START,
UnitOfTemperature,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.core import Event, EventStateChangedData, HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.event import async_track_state_change
from homeassistant.helpers.event import async_track_state_change_event
from homeassistant.helpers.typing import ConfigType
from homeassistant.util import dt as dt_util
from homeassistant.util.unit_conversion import TemperatureConverter
Expand Down Expand Up @@ -119,20 +119,20 @@ def available(self) -> bool:
"""Return True if entity is available."""
return self._attr_is_on is not None

async def async_added_to_hass(self):
async def async_added_to_hass(self) -> None:
"""Register callbacks."""

# 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.async_schedule_update_ha_state(True)

# pylint: disable=unused-argument
@callback
def sensor_startup(event):
def sensor_startup(event) -> None:
"""Update template on startup."""
async_track_state_change(
async_track_state_change_event(
self.hass, [self._weather_entity], sensor_state_listener
)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/car_wash/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Base component constants
NAME: Final = "Car Wash"
DOMAIN: Final = "car_wash"
VERSION: Final = "1.5.6"
VERSION: Final = "1.5.7-alpha"
ISSUE_URL: Final = "https://github.com/Limych/ha-car_wash/issues"

STARTUP_MESSAGE: Final = f"""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/car_wash/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"iot_class": "calculated",
"issue_tracker": "https://github.com/Limych/ha-car_wash/issues",
"requirements": [],
"version": "1.5.6"
"version": "1.5.7-alpha"
}

0 comments on commit 45aa6eb

Please sign in to comment.