From 92f5d50d2a5e10869c086ce72b284de4c55fcf21 Mon Sep 17 00:00:00 2001 From: Nick Gordon Date: Sat, 1 Aug 2020 20:20:13 -0700 Subject: [PATCH] fix issue with changing SwitchDevice to SwitchEntity --- custom_components/noonlight/switch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/noonlight/switch.py b/custom_components/noonlight/switch.py index 1f43dc1..289495a 100644 --- a/custom_components/noonlight/switch.py +++ b/custom_components/noonlight/switch.py @@ -6,7 +6,10 @@ from noonlight import NoonlightClient from homeassistant.components import persistent_notification -from homeassistant.components.switch import SwitchDevice +try: + from homeassistant.components.switch import SwitchDevice +except ImportError: + from homeassistant.components.switch import SwitchEntity as SwitchDevice from homeassistant.helpers.event import async_track_time_interval from . import (DOMAIN, EVENT_NOONLIGHT_TOKEN_REFRESHED,