mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use core constants for lcn (#46348)
This commit is contained in:
parent
af2fa17e8e
commit
56adc9dadb
@ -2,10 +2,10 @@
|
|||||||
import pypck
|
import pypck
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
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 . 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
|
from .helpers import get_connection
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,12 @@
|
|||||||
import pypck
|
import pypck
|
||||||
|
|
||||||
from homeassistant.components.climate import ClimateEntity, const
|
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 . import LcnEntity
|
||||||
from .const import (
|
from .const import (
|
||||||
@ -12,7 +17,6 @@ from .const import (
|
|||||||
CONF_MAX_TEMP,
|
CONF_MAX_TEMP,
|
||||||
CONF_MIN_TEMP,
|
CONF_MIN_TEMP,
|
||||||
CONF_SETPOINT,
|
CONF_SETPOINT,
|
||||||
CONF_SOURCE,
|
|
||||||
DATA_LCN,
|
DATA_LCN,
|
||||||
)
|
)
|
||||||
from .helpers import get_connection
|
from .helpers import get_connection
|
||||||
|
@ -25,7 +25,6 @@ CONF_LOCKABLE = "lockable"
|
|||||||
CONF_VARIABLE = "variable"
|
CONF_VARIABLE = "variable"
|
||||||
CONF_VALUE = "value"
|
CONF_VALUE = "value"
|
||||||
CONF_RELVARREF = "value_reference"
|
CONF_RELVARREF = "value_reference"
|
||||||
CONF_SOURCE = "source"
|
|
||||||
CONF_SETPOINT = "setpoint"
|
CONF_SETPOINT = "setpoint"
|
||||||
CONF_LED = "led"
|
CONF_LED = "led"
|
||||||
CONF_KEYS = "keys"
|
CONF_KEYS = "keys"
|
||||||
@ -40,7 +39,6 @@ CONF_MAX_TEMP = "max_temp"
|
|||||||
CONF_MIN_TEMP = "min_temp"
|
CONF_MIN_TEMP = "min_temp"
|
||||||
CONF_SCENES = "scenes"
|
CONF_SCENES = "scenes"
|
||||||
CONF_REGISTER = "register"
|
CONF_REGISTER = "register"
|
||||||
CONF_SCENE = "scene"
|
|
||||||
CONF_OUTPUTS = "outputs"
|
CONF_OUTPUTS = "outputs"
|
||||||
CONF_REVERSE_TIME = "reverse_time"
|
CONF_REVERSE_TIME = "reverse_time"
|
||||||
|
|
||||||
|
@ -166,7 +166,6 @@ class LcnRelayLight(LcnEntity, LightEntity):
|
|||||||
|
|
||||||
async def async_turn_on(self, **kwargs):
|
async def async_turn_on(self, **kwargs):
|
||||||
"""Turn the entity on."""
|
"""Turn the entity on."""
|
||||||
|
|
||||||
states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8
|
states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8
|
||||||
states[self.output.value] = pypck.lcn_defs.RelayStateModifier.ON
|
states[self.output.value] = pypck.lcn_defs.RelayStateModifier.ON
|
||||||
if not await self.device_connection.control_relays(states):
|
if not await self.device_connection.control_relays(states):
|
||||||
@ -176,7 +175,6 @@ class LcnRelayLight(LcnEntity, LightEntity):
|
|||||||
|
|
||||||
async def async_turn_off(self, **kwargs):
|
async def async_turn_off(self, **kwargs):
|
||||||
"""Turn the entity off."""
|
"""Turn the entity off."""
|
||||||
|
|
||||||
states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8
|
states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8
|
||||||
states[self.output.value] = pypck.lcn_defs.RelayStateModifier.OFF
|
states[self.output.value] = pypck.lcn_defs.RelayStateModifier.OFF
|
||||||
if not await self.device_connection.control_relays(states):
|
if not await self.device_connection.control_relays(states):
|
||||||
|
@ -4,14 +4,13 @@ from typing import Any
|
|||||||
import pypck
|
import pypck
|
||||||
|
|
||||||
from homeassistant.components.scene import Scene
|
from homeassistant.components.scene import Scene
|
||||||
from homeassistant.const import CONF_ADDRESS
|
from homeassistant.const import CONF_ADDRESS, CONF_SCENE
|
||||||
|
|
||||||
from . import LcnEntity
|
from . import LcnEntity
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_CONNECTIONS,
|
CONF_CONNECTIONS,
|
||||||
CONF_OUTPUTS,
|
CONF_OUTPUTS,
|
||||||
CONF_REGISTER,
|
CONF_REGISTER,
|
||||||
CONF_SCENE,
|
|
||||||
CONF_TRANSITION,
|
CONF_TRANSITION,
|
||||||
DATA_LCN,
|
DATA_LCN,
|
||||||
OUTPUT_PORTS,
|
OUTPUT_PORTS,
|
||||||
|
@ -11,7 +11,9 @@ from homeassistant.const import (
|
|||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_PORT,
|
CONF_PORT,
|
||||||
|
CONF_SCENE,
|
||||||
CONF_SENSORS,
|
CONF_SENSORS,
|
||||||
|
CONF_SOURCE,
|
||||||
CONF_SWITCHES,
|
CONF_SWITCHES,
|
||||||
CONF_UNIT_OF_MEASUREMENT,
|
CONF_UNIT_OF_MEASUREMENT,
|
||||||
CONF_USERNAME,
|
CONF_USERNAME,
|
||||||
@ -32,11 +34,9 @@ from .const import (
|
|||||||
CONF_OUTPUTS,
|
CONF_OUTPUTS,
|
||||||
CONF_REGISTER,
|
CONF_REGISTER,
|
||||||
CONF_REVERSE_TIME,
|
CONF_REVERSE_TIME,
|
||||||
CONF_SCENE,
|
|
||||||
CONF_SCENES,
|
CONF_SCENES,
|
||||||
CONF_SETPOINT,
|
CONF_SETPOINT,
|
||||||
CONF_SK_NUM_TRIES,
|
CONF_SK_NUM_TRIES,
|
||||||
CONF_SOURCE,
|
|
||||||
CONF_TRANSITION,
|
CONF_TRANSITION,
|
||||||
DIM_MODES,
|
DIM_MODES,
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
"""Support for LCN sensors."""
|
"""Support for LCN sensors."""
|
||||||
import pypck
|
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 . import LcnEntity
|
||||||
from .const import (
|
from .const import (
|
||||||
CONF_CONNECTIONS,
|
CONF_CONNECTIONS,
|
||||||
CONF_SOURCE,
|
|
||||||
DATA_LCN,
|
DATA_LCN,
|
||||||
LED_PORTS,
|
LED_PORTS,
|
||||||
S0_INPUTS,
|
S0_INPUTS,
|
||||||
|
@ -117,7 +117,6 @@ class LcnRelaySwitch(LcnEntity, SwitchEntity):
|
|||||||
|
|
||||||
async def async_turn_off(self, **kwargs):
|
async def async_turn_off(self, **kwargs):
|
||||||
"""Turn the entity off."""
|
"""Turn the entity off."""
|
||||||
|
|
||||||
states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8
|
states = [pypck.lcn_defs.RelayStateModifier.NOCHANGE] * 8
|
||||||
states[self.output.value] = pypck.lcn_defs.RelayStateModifier.OFF
|
states[self.output.value] = pypck.lcn_defs.RelayStateModifier.OFF
|
||||||
if not await self.device_connection.control_relays(states):
|
if not await self.device_connection.control_relays(states):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user