Skip to content

Commit

Permalink
Remove deprecated 'run_immediately' (#991)
Browse files Browse the repository at this point in the history
  • Loading branch information
casse-boubou authored May 12, 2024
1 parent 1a2cd73 commit b746e5f
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions custom_components/adaptive_lighting/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
STATE_OFF,
STATE_ON,
)
from homeassistant.const import __version__ as ha_version
from homeassistant.core import (
CALLBACK_TYPE,
Context,
Expand Down Expand Up @@ -950,15 +949,9 @@ async def async_added_to_hass(self) -> None:
if self.hass.is_running:
await self._setup_listeners()
else:
kw = {}
year, month = (int(x) for x in ha_version.split(".")[:2])
if (year, month) >= (2024, 4):
# Added in https://github.com/home-assistant/core/pull/113020
kw["run_immediately"] = False
self.hass.bus.async_listen_once(
EVENT_HOMEASSISTANT_STARTED,
self._setup_listeners,
**kw,
)
last_state: State | None = await self.async_get_last_state()
is_new_entry = last_state is None # newly added to HA
Expand Down Expand Up @@ -1665,12 +1658,10 @@ def __init__(self, hass: HomeAssistant) -> None:
self.hass.bus.async_listen(
EVENT_CALL_SERVICE,
self.turn_on_off_event_listener,
run_immediately=False,
),
self.hass.bus.async_listen(
EVENT_STATE_CHANGED,
self.state_changed_event_listener,
run_immediately=False,
),
]

Expand Down

0 comments on commit b746e5f

Please sign in to comment.