From 1cbe080df92babd0e423e37690d45314d7568b7b Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 27 Nov 2018 13:21:42 +0100 Subject: [PATCH] Fix remaining issues (#18416) --- homeassistant/components/light/niko_home_control.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/light/niko_home_control.py b/homeassistant/components/light/niko_home_control.py index 3146954ed62..6b58ced5989 100644 --- a/homeassistant/components/light/niko_home_control.py +++ b/homeassistant/components/light/niko_home_control.py @@ -5,7 +5,6 @@ For more details about this platform, please refer to the documentation https://home-assistant.io/components/light.niko_home_control/ """ import logging -import socket import voluptuous as vol @@ -24,11 +23,11 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ }) -def setup_platform(hass, config, add_devices, discovery_info=None): +def setup_platform(hass, config, add_entities, discovery_info=None): """Set up the Niko Home Control light platform.""" import nikohomecontrol - host = config.get(CONF_HOST) + host = config[CONF_HOST] try: hub = nikohomecontrol.Hub({ @@ -37,11 +36,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None): 'timeout': 20000, 'events': True }) - except socket.error as err: + except OSError as err: _LOGGER.error("Unable to access %s (%s)", host, err) raise PlatformNotReady - add_devices( + add_entities( [NikoHomeControlLight(light, hub) for light in hub.list_actions()], True) @@ -76,12 +75,10 @@ class NikoHomeControlLight(Light): """Instruct the light to turn on.""" self._light.brightness = kwargs.get(ATTR_BRIGHTNESS, 255) self._light.turn_on() - self._state = True def turn_off(self, **kwargs): """Instruct the light to turn off.""" self._light.turn_off() - self._state = False def update(self): """Fetch new state data for this light."""