Add support for config flows for switches

This commit is contained in:
Pierre Ståhl
2020-09-06 10:29:39 +02:00
parent 181ba360b7
commit b8333affc5
8 changed files with 322 additions and 18 deletions

View File

@@ -1 +1,30 @@
"""The Tuya local integration."""
"""The LocalTuya integration integration."""
import asyncio
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from .const import CONF_DEVICE_TYPE, DOMAIN, DEVICE_TYPE_POWER_OUTLET
async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the LocalTuya integration component."""
return True
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up LocalTuya integration from a config entry."""
if entry.data[CONF_DEVICE_TYPE] == DEVICE_TYPE_POWER_OUTLET:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, "switch")
)
return True
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
# Nothing is stored and no persistent connections exist, so nothing to do
return True