hacs structure
This commit is contained in:
parent
ddec014571
commit
aabdabb9c5
6 changed files with 9 additions and 0 deletions
43
custom_components/benq_smartboard/__init__.py
Normal file
43
custom_components/benq_smartboard/__init__.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
"""BenQ Smart Board integration for Home Assistant."""
|
||||
import logging
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
DOMAIN = "benq_smartboard"
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: dict):
|
||||
"""
|
||||
Legacy setup function for when we might support YAML in the future.
|
||||
|
||||
Currently, we do not configure anything via YAML. Just return True.
|
||||
"""
|
||||
return True
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||
"""
|
||||
Set up the BenQ Smart Board integration from a config entry (UI flow).
|
||||
"""
|
||||
hass.data.setdefault(DOMAIN, {})
|
||||
# Store config data (host, port, etc.) so other platforms can access it
|
||||
hass.data[DOMAIN][entry.entry_id] = entry.data
|
||||
|
||||
# Forward entry setup to the media_player platform
|
||||
hass.async_create_task(
|
||||
hass.config_entries.async_forward_entry_setup(entry, "media_player")
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||
"""
|
||||
Unload a config entry (if the user removes it).
|
||||
|
||||
We must also unload the forwarded platforms.
|
||||
"""
|
||||
unload_ok = await hass.config_entries.async_forward_entry_unload(entry, "media_player")
|
||||
if unload_ok:
|
||||
hass.data[DOMAIN].pop(entry.entry_id, None)
|
||||
return unload_ok
|
Loading…
Add table
Add a link
Reference in a new issue