mirror of
https://github.com/sudoxnym/sleepd.git
synced 2026-04-14 11:37:11 +00:00
32 lines
No EOL
1.2 KiB
Python
32 lines
No EOL
1.2 KiB
Python
"""The SAAS - Sleep As Android Stats integration."""
|
|
import voluptuous as vol
|
|
from homeassistant.config_entries import ConfigEntry
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers import discovery
|
|
from .const import DOMAIN
|
|
|
|
async def async_setup(hass: HomeAssistant, config: dict):
|
|
"""Set up the SAAS - Sleep As Android Status component."""
|
|
return True
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
|
"""Set up SAAS - Sleep As Android Status from a config entry."""
|
|
hass.data[DOMAIN] = entry.data
|
|
discovery.load_platform(hass, "sensor", DOMAIN, {}, entry.data)
|
|
return True
|
|
|
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
|
|
"""Unload a config entry."""
|
|
# Remove the sensor platform
|
|
await hass.config_entries.async_forward_entry_unload(entry, "sensor")
|
|
|
|
# Remove the entry from the domain data
|
|
hass.data[DOMAIN].pop(entry.entry_id)
|
|
|
|
return True
|
|
|
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
|
"""Set up SAAS - Sleep As Android Status from a config entry."""
|
|
hass.data[DOMAIN] = entry.data
|
|
hass.async_create_task(hass.config_entries.async_forward_entry_setup(entry, "sensor"))
|
|
return True |