Add config flow to Velux (#89155)
* Add config_flow * Add old config import * Change from platform setup to entry setup * Improve yaml config import * Allow multiple hosts * Apply recommendations * Add DeerMaximum as codeowner * Apply recommendations * Fix config schema * Fix hass data * Remove DeerMaximum from CODEOWNERS * Try to fix tests in ci * Try to fix tests in ci 2 * Try to fix tests in ci 3 * Revert: Try to fix tests in ci 3 * Add end-to-end flow to connection error test * Fix rebase * Add required changes * Change deprecation date * Import only valid config entries * Improve issue creation * Fix error type * Add missing test * Optimize issue creation * Optimize tests * Add check for duplicate entries * Add already_configured message * Create issue for duplicate entries
This commit is contained in:
parent
2981d7ed0e
commit
d16d9d72c3
15 changed files with 351 additions and 55 deletions
|
@ -4,23 +4,22 @@ from __future__ import annotations
|
|||
from typing import Any
|
||||
|
||||
from homeassistant.components.scene import Scene
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import _LOGGER, DATA_VELUX
|
||||
from . import DOMAIN
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
|
||||
async def async_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
async_add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
async def async_setup_entry(
|
||||
hass: HomeAssistant, config: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up the scenes for Velux platform."""
|
||||
entities = [VeluxScene(scene) for scene in hass.data[DATA_VELUX].pyvlx.scenes]
|
||||
module = hass.data[DOMAIN][config.entry_id]
|
||||
|
||||
entities = [VeluxScene(scene) for scene in module.pyvlx.scenes]
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
|
@ -29,7 +28,6 @@ class VeluxScene(Scene):
|
|||
|
||||
def __init__(self, scene):
|
||||
"""Init velux scene."""
|
||||
_LOGGER.info("Adding Velux scene: %s", scene)
|
||||
self.scene = scene
|
||||
|
||||
@property
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue