Refactor plum_lightpad (#36761)
This commit is contained in:
parent
4862f6d516
commit
e969d364e6
3 changed files with 8 additions and 7 deletions
|
@ -10,9 +10,9 @@ from homeassistant.helpers import discovery
|
|||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
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(
|
||||
{
|
||||
|
@ -26,8 +26,6 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
PLUM_DATA = "plum"
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
"""Plum Lightpad Platform initialization."""
|
||||
|
@ -35,7 +33,7 @@ async def async_setup(hass, config):
|
|||
conf = config[DOMAIN]
|
||||
plum = Plum(conf[CONF_USERNAME], conf[CONF_PASSWORD])
|
||||
|
||||
hass.data[PLUM_DATA] = plum
|
||||
hass.data[DOMAIN] = plum
|
||||
|
||||
def cleanup(event):
|
||||
"""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
|
||||
|
||||
from . import PLUM_DATA
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
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:
|
||||
return
|
||||
|
||||
plum = hass.data[PLUM_DATA]
|
||||
plum = hass.data[DOMAIN]
|
||||
|
||||
entities = []
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue