mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Refactor plum_lightpad (#36761)
This commit is contained in:
parent
4862f6d516
commit
e969d364e6
@ -10,9 +10,9 @@ from homeassistant.helpers import discovery
|
|||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
from .const import DOMAIN
|
||||||
|
|
||||||
DOMAIN = "plum_lightpad"
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema(
|
CONFIG_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
@ -26,8 +26,6 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
extra=vol.ALLOW_EXTRA,
|
extra=vol.ALLOW_EXTRA,
|
||||||
)
|
)
|
||||||
|
|
||||||
PLUM_DATA = "plum"
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass, config):
|
||||||
"""Plum Lightpad Platform initialization."""
|
"""Plum Lightpad Platform initialization."""
|
||||||
@ -35,7 +33,7 @@ async def async_setup(hass, config):
|
|||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
plum = Plum(conf[CONF_USERNAME], conf[CONF_PASSWORD])
|
plum = Plum(conf[CONF_USERNAME], conf[CONF_PASSWORD])
|
||||||
|
|
||||||
hass.data[PLUM_DATA] = plum
|
hass.data[DOMAIN] = plum
|
||||||
|
|
||||||
def cleanup(event):
|
def cleanup(event):
|
||||||
"""Clean up resources."""
|
"""Clean up resources."""
|
||||||
|
3
homeassistant/components/plum_lightpad/const.py
Normal file
3
homeassistant/components/plum_lightpad/const.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
"""Constants for the Plum Lightpad component."""
|
||||||
|
|
||||||
|
DOMAIN = "plum_lightpad"
|
@ -8,7 +8,7 @@ from homeassistant.components.light import (
|
|||||||
)
|
)
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
from . import PLUM_DATA
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||||
@ -16,7 +16,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||||||
if discovery_info is None:
|
if discovery_info is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
plum = hass.data[PLUM_DATA]
|
plum = hass.data[DOMAIN]
|
||||||
|
|
||||||
entities = []
|
entities = []
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user