Use core constants for dynalite (#46044)
parent
1a8cdba9af
commit
2ecac6550f
|
@ -8,7 +8,7 @@ import voluptuous as vol
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components.cover import DEVICE_CLASSES_SCHEMA
|
from homeassistant.components.cover import DEVICE_CLASSES_SCHEMA
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_TYPE
|
from homeassistant.const import CONF_DEFAULT, CONF_HOST, CONF_NAME, CONF_PORT, CONF_TYPE
|
||||||
from homeassistant.core import HomeAssistant, ServiceCall
|
from homeassistant.core import HomeAssistant, ServiceCall
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
|
@ -29,7 +29,6 @@ from .const import (
|
||||||
CONF_CHANNEL,
|
CONF_CHANNEL,
|
||||||
CONF_CHANNEL_COVER,
|
CONF_CHANNEL_COVER,
|
||||||
CONF_CLOSE_PRESET,
|
CONF_CLOSE_PRESET,
|
||||||
CONF_DEFAULT,
|
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_DURATION,
|
CONF_DURATION,
|
||||||
CONF_FADE,
|
CONF_FADE,
|
||||||
|
@ -181,7 +180,6 @@ CONFIG_SCHEMA = vol.Schema(
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: Dict[str, Any]) -> bool:
|
async def async_setup(hass: HomeAssistant, config: Dict[str, Any]) -> bool:
|
||||||
"""Set up the Dynalite platform."""
|
"""Set up the Dynalite platform."""
|
||||||
|
|
||||||
conf = config.get(DOMAIN)
|
conf = config.get(DOMAIN)
|
||||||
LOGGER.debug("Setting up dynalite component config = %s", conf)
|
LOGGER.debug("Setting up dynalite component config = %s", conf)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ CONF_BRIDGES = "bridges"
|
||||||
CONF_CHANNEL = "channel"
|
CONF_CHANNEL = "channel"
|
||||||
CONF_CHANNEL_COVER = "channel_cover"
|
CONF_CHANNEL_COVER = "channel_cover"
|
||||||
CONF_CLOSE_PRESET = "close"
|
CONF_CLOSE_PRESET = "close"
|
||||||
CONF_DEFAULT = "default"
|
|
||||||
CONF_DEVICE_CLASS = "class"
|
CONF_DEVICE_CLASS = "class"
|
||||||
CONF_DURATION = "duration"
|
CONF_DURATION = "duration"
|
||||||
CONF_FADE = "fade"
|
CONF_FADE = "fade"
|
||||||
|
|
|
@ -4,7 +4,14 @@ from typing import Any, Dict
|
||||||
|
|
||||||
from dynalite_devices_lib import const as dyn_const
|
from dynalite_devices_lib import const as dyn_const
|
||||||
|
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_ROOM, CONF_TYPE
|
from homeassistant.const import (
|
||||||
|
CONF_DEFAULT,
|
||||||
|
CONF_HOST,
|
||||||
|
CONF_NAME,
|
||||||
|
CONF_PORT,
|
||||||
|
CONF_ROOM,
|
||||||
|
CONF_TYPE,
|
||||||
|
)
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ACTIVE_INIT,
|
ACTIVE_INIT,
|
||||||
|
@ -16,7 +23,6 @@ from .const import (
|
||||||
CONF_CHANNEL,
|
CONF_CHANNEL,
|
||||||
CONF_CHANNEL_COVER,
|
CONF_CHANNEL_COVER,
|
||||||
CONF_CLOSE_PRESET,
|
CONF_CLOSE_PRESET,
|
||||||
CONF_DEFAULT,
|
|
||||||
CONF_DEVICE_CLASS,
|
CONF_DEVICE_CLASS,
|
||||||
CONF_DURATION,
|
CONF_DURATION,
|
||||||
CONF_FADE,
|
CONF_FADE,
|
||||||
|
|
|
@ -12,7 +12,6 @@ async def async_setup_entry(
|
||||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable
|
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Record the async_add_entities function to add them later when received from Dynalite."""
|
"""Record the async_add_entities function to add them later when received from Dynalite."""
|
||||||
|
|
||||||
async_setup_entry_base(
|
async_setup_entry_base(
|
||||||
hass, config_entry, async_add_entities, "light", DynaliteLight
|
hass, config_entry, async_add_entities, "light", DynaliteLight
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,7 +12,6 @@ async def async_setup_entry(
|
||||||
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable
|
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: Callable
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Record the async_add_entities function to add them later when received from Dynalite."""
|
"""Record the async_add_entities function to add them later when received from Dynalite."""
|
||||||
|
|
||||||
async_setup_entry_base(
|
async_setup_entry_base(
|
||||||
hass, config_entry, async_add_entities, "switch", DynaliteSwitch
|
hass, config_entry, async_add_entities, "switch", DynaliteSwitch
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import pytest
|
||||||
from voluptuous import MultipleInvalid
|
from voluptuous import MultipleInvalid
|
||||||
|
|
||||||
import homeassistant.components.dynalite.const as dynalite
|
import homeassistant.components.dynalite.const as dynalite
|
||||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_ROOM
|
from homeassistant.const import CONF_DEFAULT, CONF_HOST, CONF_NAME, CONF_PORT, CONF_ROOM
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
@ -54,7 +54,7 @@ async def test_async_setup(hass):
|
||||||
dynalite.CONF_TEMPLATE: dynalite.CONF_TIME_COVER,
|
dynalite.CONF_TEMPLATE: dynalite.CONF_TIME_COVER,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dynalite.CONF_DEFAULT: {dynalite.CONF_FADE: 2.3},
|
CONF_DEFAULT: {dynalite.CONF_FADE: 2.3},
|
||||||
dynalite.CONF_ACTIVE: dynalite.ACTIVE_INIT,
|
dynalite.CONF_ACTIVE: dynalite.ACTIVE_INIT,
|
||||||
dynalite.CONF_PRESET: {
|
dynalite.CONF_PRESET: {
|
||||||
"5": {CONF_NAME: "pres5", dynalite.CONF_FADE: 4.5}
|
"5": {CONF_NAME: "pres5", dynalite.CONF_FADE: 4.5}
|
||||||
|
|
Loading…
Reference in New Issue