1 """Support for Lupusec Home Security system."""
3 from json
import JSONDecodeError
7 from lupupy.exceptions
import LupusecException
13 _LOGGER = logging.getLogger(__name__)
17 NOTIFICATION_ID =
"lupusec_notification"
18 NOTIFICATION_TITLE =
"Lupusec Security Setup"
21 PLATFORMS: list[Platform] = [
22 Platform.ALARM_CONTROL_PANEL,
23 Platform.BINARY_SENSOR,
29 """Set up this integration using UI."""
31 host = entry.data[CONF_HOST]
32 username = entry.data[CONF_USERNAME]
33 password = entry.data[CONF_PASSWORD]
36 lupusec_system = await hass.async_add_executor_job(
37 lupupy.Lupusec, username, password, host
39 except LupusecException:
40 _LOGGER.error(
"Failed to connect to Lupusec device at %s", host)
42 except JSONDecodeError:
43 _LOGGER.error(
"Failed to connect to Lupusec device at %s", host)
46 hass.data.setdefault(DOMAIN, {})[entry.entry_id] = lupusec_system
48 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)