-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
27 lines (20 loc) · 792 Bytes
/
__init__.py
File metadata and controls
27 lines (20 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# __init__.py
import logging
from homeassistant.core import HomeAssistant
from homeassistant.config_entries import ConfigEntry
from .voltalis import Voltalis
DOMAIN = "voltalis"
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Voltalis from a config entry."""
voltalis = Voltalis(entry.data['username'], entry.data['password'])
await voltalis.login()
# Stockage de l'objet Voltalis en utilisant entry.entry_id
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = voltalis
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, "switch")
)
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, "sensor")
)
return True