diff --git a/homeassistant/components/switcher_kis/__init__.py b/homeassistant/components/switcher_kis/__init__.py index 244ed708cc7..d081b3331c7 100644 --- a/homeassistant/components/switcher_kis/__init__.py +++ b/homeassistant/components/switcher_kis/__init__.py @@ -8,7 +8,7 @@ from aioswitcher.bridge import SwitcherV2Bridge import voluptuous as vol from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN -from homeassistant.const import EVENT_HOMEASSISTANT_STOP +from homeassistant.const import CONF_DEVICE_ID, EVENT_HOMEASSISTANT_STOP from homeassistant.core import callback from homeassistant.helpers import config_validation as cv from homeassistant.helpers.discovery import async_load_platform @@ -20,7 +20,6 @@ _LOGGER = logging.getLogger(__name__) DOMAIN = "switcher_kis" -CONF_DEVICE_ID = "device_id" CONF_DEVICE_PASSWORD = "device_password" CONF_PHONE_ID = "phone_id" @@ -48,7 +47,6 @@ CONFIG_SCHEMA = vol.Schema( async def async_setup(hass: HomeAssistantType, config: Dict) -> bool: """Set up the switcher component.""" - phone_id = config[DOMAIN][CONF_PHONE_ID] device_id = config[DOMAIN][CONF_DEVICE_ID] device_password = config[DOMAIN][CONF_DEVICE_PASSWORD] diff --git a/homeassistant/components/switcher_kis/switch.py b/homeassistant/components/switcher_kis/switch.py index 5e75a0e6090..6b4b5026c2f 100644 --- a/homeassistant/components/switcher_kis/switch.py +++ b/homeassistant/components/switcher_kis/switch.py @@ -62,7 +62,6 @@ async def async_setup_platform( async def async_set_auto_off_service(entity, service_call: ServiceCallType) -> None: """Use for handling setting device auto-off service calls.""" - async with SwitcherV2Api( hass.loop, device_data.ip_addr, @@ -76,7 +75,6 @@ async def async_setup_platform( entity, service_call: ServiceCallType ) -> None: """Use for handling turning device on with a timer service calls.""" - async with SwitcherV2Api( hass.loop, device_data.ip_addr, @@ -133,7 +131,6 @@ class SwitcherControl(SwitchEntity): @property def is_on(self) -> bool: """Return True if entity is on.""" - return self._state == SWITCHER_STATE_ON @property @@ -144,7 +141,6 @@ class SwitcherControl(SwitchEntity): @property def device_state_attributes(self) -> Dict: """Return the optional state attributes.""" - attribs = {} for prop, attr in DEVICE_PROPERTIES_TO_HA_ATTRIBUTES.items(): @@ -157,7 +153,6 @@ class SwitcherControl(SwitchEntity): @property def available(self) -> bool: """Return True if entity is available.""" - return self._state in [SWITCHER_STATE_ON, SWITCHER_STATE_OFF] async def async_added_to_hass(self) -> None: @@ -188,7 +183,6 @@ class SwitcherControl(SwitchEntity): async def _control_device(self, send_on: bool) -> None: """Turn the entity on or off.""" - response: SwitcherV2ControlResponseMSG = None async with SwitcherV2Api( self.hass.loop,