add yaml deprecation

This commit is contained in:
Andrey
2021-01-04 09:59:44 +03:00
parent d56cffa68f
commit f19d3daeff
7 changed files with 12 additions and 77 deletions

View File

@@ -1,13 +1,10 @@
"""The mega integration."""
import asyncio
import logging
import typing
from functools import partial
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PLATFORM, CONF_SCAN_INTERVAL, CONF_ID
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_SCAN_INTERVAL, CONF_ID
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.service import bind_hass
from homeassistant.components import mqtt
from homeassistant.config_entries import ConfigEntry
@@ -74,9 +71,10 @@ async def async_setup(hass: HomeAssistant, config: dict):
if CONF_HOST in conf:
conf = {DEF_ID: conf}
for id, data in conf.items():
_LOGGER.warning('YAML configuration is deprecated, please use web-interface')
await _add_mega(hass, id, data)
for id, hub in hass.data[DOMAIN].__items__():
for id, hub in hass.data[DOMAIN].items():
_POLL_TASKS[id] = asyncio.create_task(hub.poll())
return True

View File

@@ -1,6 +1,4 @@
"""Platform for light integration."""
import asyncio
import json
import logging
import voluptuous as vol
@@ -18,7 +16,6 @@ from homeassistant.const import (
CONF_ID
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.restore_state import RestoreEntity
from .entities import BaseMegaEntity
from .hub import MegaD

View File

@@ -9,7 +9,7 @@ from homeassistant.components import mqtt
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_ID, CONF_PASSWORD, CONF_SCAN_INTERVAL
from homeassistant.core import callback
from .const import DOMAIN, CONF_PORT_TO_SCAN, CONF_RELOAD, CONF_INVERT # pylint:disable=unused-import
from .const import DOMAIN, CONF_PORT_TO_SCAN, CONF_RELOAD # pylint:disable=unused-import
from .hub import MegaD
from . import exceptions

View File

@@ -1,6 +1,4 @@
"""Platform for light integration."""
import asyncio
import json
import logging
import voluptuous as vol
@@ -19,7 +17,6 @@ from homeassistant.const import (
CONF_ID
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.restore_state import RestoreEntity
from .entities import BaseMegaEntity
from .hub import MegaD

View File

@@ -1,7 +1,5 @@
"""Platform for light integration."""
import logging
import typing
import voluptuous as vol
from homeassistant.components.sensor import (

View File

@@ -1,5 +1,4 @@
"""Platform for light integration."""
import json
import logging
import voluptuous as vol
@@ -13,11 +12,7 @@ from homeassistant.const import (
CONF_PLATFORM,
CONF_PORT,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.restore_state import RestoreEntity
from .entities import BaseMegaEntity
from .hub import MegaD
from .const import CONF_DIMMER, CONF_SWITCH
_LOGGER = logging.getLogger(__name__)