Use core constants for lcn (#46348)

This commit is contained in:
tkdrob 2021-02-10 21:22:32 -05:00 committed by GitHub
parent af2fa17e8e
commit 56adc9dadb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 15 deletions

View File

@ -2,10 +2,10 @@
import pypck
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import CONF_ADDRESS
from homeassistant.const import CONF_ADDRESS, CONF_SOURCE
from . import LcnEntity
from .const import BINSENSOR_PORTS, CONF_CONNECTIONS, CONF_SOURCE, DATA_LCN, SETPOINTS
from .const import BINSENSOR_PORTS, CONF_CONNECTIONS, DATA_LCN, SETPOINTS
from .helpers import get_connection

View File

@ -3,7 +3,12 @@
import pypck
from homeassistant.components.climate import ClimateEntity, const
from homeassistant.const import ATTR_TEMPERATURE, CONF_ADDRESS, CONF_UNIT_OF_MEASUREMENT
from homeassistant.const import (
ATTR_TEMPERATURE,
CONF_ADDRESS,
CONF_SOURCE,
CONF_UNIT_OF_MEASUREMENT,
)
from . import LcnEntity
from .const import (
@ -12,7 +17,6 @@ from .const import (
CONF_MAX_TEMP,
CONF_MIN_TEMP,
CONF_SETPOINT,
CONF_SOURCE,
DATA_LCN,
)
from .helpers import get_connection

View File

@ -25,7 +25,6 @@ CONF_LOCKABLE = "lockable"
CONF_VARIABLE = "variable"
CONF_VALUE = "value"
CONF_RELVARREF = "value_reference"
CONF_SOURCE = "source"
CONF_SETPOINT = "setpoint"
CONF_LED = "led"
CONF_KEYS = "keys"
@ -40,7 +39,6 @@ CONF_MAX_TEMP = "max_temp"
CONF_MIN_TEMP = "min_temp"
CONF_SCENES = "scenes"
CONF_REGISTER = "register"
CONF_SCENE = "scene"
CONF_OUTPUTS = "outputs"
CONF_REVERSE_TIME = "reverse_time"

View File

@ -166,7 +166,6 @@ class LcnRelayLight(LcnEntity, LightEntity):
async def async_turn_on(self, **kwargs):
"""Turn the entity on."""
states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8
states[self.output.value] = pypck.lcn_defs.RelayStateModifier.ON
if not await self.device_connection.control_relays(states):
@ -176,7 +175,6 @@ class LcnRelayLight(LcnEntity, LightEntity):
async def async_turn_off(self, **kwargs):
"""Turn the entity off."""
states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8
states[self.output.value] = pypck.lcn_defs.RelayStateModifier.OFF
if not await self.device_connection.control_relays(states):

View File

@ -4,14 +4,13 @@ from typing import Any
import pypck
from homeassistant.components.scene import Scene
from homeassistant.const import CONF_ADDRESS
from homeassistant.const import CONF_ADDRESS, CONF_SCENE
from . import LcnEntity
from .const import (
CONF_CONNECTIONS,
CONF_OUTPUTS,
CONF_REGISTER,
CONF_SCENE,
CONF_TRANSITION,
DATA_LCN,
OUTPUT_PORTS,

View File

@ -11,7 +11,9 @@ from homeassistant.const import (
CONF_NAME,
CONF_PASSWORD,
CONF_PORT,
CONF_SCENE,
CONF_SENSORS,
CONF_SOURCE,
CONF_SWITCHES,
CONF_UNIT_OF_MEASUREMENT,
CONF_USERNAME,
@ -32,11 +34,9 @@ from .const import (
CONF_OUTPUTS,
CONF_REGISTER,
CONF_REVERSE_TIME,
CONF_SCENE,
CONF_SCENES,
CONF_SETPOINT,
CONF_SK_NUM_TRIES,
CONF_SOURCE,
CONF_TRANSITION,
DIM_MODES,
DOMAIN,

View File

@ -1,12 +1,11 @@
"""Support for LCN sensors."""
import pypck
from homeassistant.const import CONF_ADDRESS, CONF_UNIT_OF_MEASUREMENT
from homeassistant.const import CONF_ADDRESS, CONF_SOURCE, CONF_UNIT_OF_MEASUREMENT
from . import LcnEntity
from .const import (
CONF_CONNECTIONS,
CONF_SOURCE,
DATA_LCN,
LED_PORTS,
S0_INPUTS,

View File

@ -117,7 +117,6 @@ class LcnRelaySwitch(LcnEntity, SwitchEntity):
async def async_turn_off(self, **kwargs):
"""Turn the entity off."""
states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8
states[self.output.value] = pypck.lcn_defs.RelayStateModifier.OFF
if not await self.device_connection.control_relays(states):