Skip to content

Commit

Permalink
Import depending on HA version
Browse files Browse the repository at this point in the history
  • Loading branch information
MrEbbinghaus committed May 14, 2024
1 parent 1a4a0a6 commit dce96a0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion custom_components/adaptive_lighting/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
EVENT_CALL_SERVICE,
EVENT_HOMEASSISTANT_STARTED,
EVENT_STATE_CHANGED,
MAJOR_VERSION,
MINOR_VERSION,
SERVICE_TOGGLE,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
Expand All @@ -70,7 +72,12 @@
callback,
)
from homeassistant.helpers import entity_platform, entity_registry
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo

if MAJOR_VERSION < 2024 and MINOR_VERSION < 9:
from homeassistant.helpers.entity import DeviceInfo
else:
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.device_registry import DeviceEntryType
from homeassistant.helpers.event import (
async_track_state_change_event,
async_track_time_interval,
Expand Down

0 comments on commit dce96a0

Please sign in to comment.