Use port instead of url and fix PEP257 issues (#4192)
This commit is contained in:
parent
d7b3c9c38e
commit
61a0976752
4 changed files with 15 additions and 13 deletions
|
@ -4,7 +4,6 @@ Support for LiteJet lights.
|
||||||
For more details about this platform, please refer to the documentation at
|
For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/light.litejet/
|
https://home-assistant.io/components/light.litejet/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.components.litejet as litejet
|
import homeassistant.components.litejet as litejet
|
||||||
|
@ -18,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Setup lights for the LiteJet platform."""
|
"""Set up lights for the LiteJet platform."""
|
||||||
litejet_ = hass.data['litejet_system']
|
litejet_ = hass.data['litejet_system']
|
||||||
|
|
||||||
devices = []
|
devices = []
|
||||||
|
@ -30,7 +29,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
||||||
|
|
||||||
class LiteJetLight(Light):
|
class LiteJetLight(Light):
|
||||||
"""Represents a single LiteJet light."""
|
"""Representation of a single LiteJet light."""
|
||||||
|
|
||||||
def __init__(self, hass, lj, i, name):
|
def __init__(self, hass, lj, i, name):
|
||||||
"""Initialize a LiteJet light."""
|
"""Initialize a LiteJet light."""
|
||||||
|
|
|
@ -4,24 +4,25 @@ For more details about this component, please refer to the documentation at
|
||||||
https://home-assistant.io/components/litejet/
|
https://home-assistant.io/components/litejet/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.helpers import discovery
|
from homeassistant.helpers import discovery
|
||||||
from homeassistant.const import CONF_URL
|
from homeassistant.const import CONF_PORT
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
DOMAIN = 'litejet'
|
|
||||||
|
|
||||||
REQUIREMENTS = ['pylitejet==0.1']
|
REQUIREMENTS = ['pylitejet==0.1']
|
||||||
|
|
||||||
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONF_EXCLUDE_NAMES = 'exclude_names'
|
CONF_EXCLUDE_NAMES = 'exclude_names'
|
||||||
CONF_INCLUDE_SWITCHES = 'include_switches'
|
CONF_INCLUDE_SWITCHES = 'include_switches'
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
DOMAIN = 'litejet'
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({
|
CONFIG_SCHEMA = vol.Schema({
|
||||||
DOMAIN: vol.Schema({
|
DOMAIN: vol.Schema({
|
||||||
vol.Required(CONF_URL): cv.string,
|
vol.Required(CONF_PORT): cv.string,
|
||||||
vol.Optional(CONF_EXCLUDE_NAMES): vol.All(cv.ensure_list, [cv.string]),
|
vol.Optional(CONF_EXCLUDE_NAMES): vol.All(cv.ensure_list, [cv.string]),
|
||||||
vol.Optional(CONF_INCLUDE_SWITCHES, default=False): cv.boolean
|
vol.Optional(CONF_INCLUDE_SWITCHES, default=False): cv.boolean
|
||||||
})
|
})
|
||||||
|
@ -32,7 +33,7 @@ def setup(hass, config):
|
||||||
"""Initialize the LiteJet component."""
|
"""Initialize the LiteJet component."""
|
||||||
from pylitejet import LiteJet
|
from pylitejet import LiteJet
|
||||||
|
|
||||||
url = config[DOMAIN].get(CONF_URL)
|
url = config[DOMAIN].get(CONF_PORT)
|
||||||
|
|
||||||
hass.data['litejet_system'] = LiteJet(url)
|
hass.data['litejet_system'] = LiteJet(url)
|
||||||
hass.data['litejet_config'] = config[DOMAIN]
|
hass.data['litejet_config'] = config[DOMAIN]
|
||||||
|
|
|
@ -5,6 +5,7 @@ For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/scene.litejet/
|
https://home-assistant.io/components/scene.litejet/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.components.litejet as litejet
|
import homeassistant.components.litejet as litejet
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Setup scenes for the LiteJet platform."""
|
"""Set up scenes for the LiteJet platform."""
|
||||||
litejet_ = hass.data['litejet_system']
|
litejet_ = hass.data['litejet_system']
|
||||||
|
|
||||||
devices = []
|
devices = []
|
||||||
|
@ -28,7 +29,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
||||||
|
|
||||||
class LiteJetScene(Scene):
|
class LiteJetScene(Scene):
|
||||||
"""Represents a single LiteJet scene."""
|
"""Representation of a single LiteJet scene."""
|
||||||
|
|
||||||
def __init__(self, lj, i, name):
|
def __init__(self, lj, i, name):
|
||||||
"""Initialize the scene."""
|
"""Initialize the scene."""
|
||||||
|
|
|
@ -5,6 +5,7 @@ For more details about this platform, please refer to the documentation at
|
||||||
https://home-assistant.io/components/switch.litejet/
|
https://home-assistant.io/components/switch.litejet/
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import homeassistant.components.litejet as litejet
|
import homeassistant.components.litejet as litejet
|
||||||
from homeassistant.components.switch import SwitchDevice
|
from homeassistant.components.switch import SwitchDevice
|
||||||
|
|
||||||
|
@ -16,7 +17,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
"""Setup the LiteJet switch platform."""
|
"""Set up the LiteJet switch platform."""
|
||||||
litejet_ = hass.data['litejet_system']
|
litejet_ = hass.data['litejet_system']
|
||||||
|
|
||||||
devices = []
|
devices = []
|
||||||
|
@ -28,7 +29,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
|
|
||||||
|
|
||||||
class LiteJetSwitch(SwitchDevice):
|
class LiteJetSwitch(SwitchDevice):
|
||||||
"""Represents a single LiteJet switch."""
|
"""Representation of a single LiteJet switch."""
|
||||||
|
|
||||||
def __init__(self, hass, lj, i, name):
|
def __init__(self, hass, lj, i, name):
|
||||||
"""Initialize a LiteJet switch."""
|
"""Initialize a LiteJet switch."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue