Esempio n. 1
0
    def __init__(
        self, hass: HomeAssistant, config_entry: ConfigEntry, api: DeconzSession
    ) -> None:
        """Initialize the system."""
        self.hass = hass
        self.config_entry = config_entry
        self.api = api

        api.connection_status_callback = self.async_connection_status_callback

        self.available = True
        self.ignore_state_updates = False

        self.signal_reachable = f"deconz-reachable-{config_entry.entry_id}"
        self.signal_reload_groups = f"deconz_reload_group_{config_entry.entry_id}"
        self.signal_reload_clip_sensors = f"deconz_reload_clip_{config_entry.entry_id}"

        self.deconz_ids: dict[str, str] = {}
        self.entities: dict[str, set[str]] = {}
        self.events: list[DeconzAlarmEvent | DeconzEvent] = []
        self.ignored_devices: set[tuple[Callable[[EventType, str], None], str]] = set()

        self._option_allow_deconz_groups = self.config_entry.options.get(
            CONF_ALLOW_DECONZ_GROUPS, DEFAULT_ALLOW_DECONZ_GROUPS
        )
        self.option_allow_new_devices = self.config_entry.options.get(
            CONF_ALLOW_NEW_DEVICES, DEFAULT_ALLOW_NEW_DEVICES
        )
Esempio n. 2
0
    def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry,
                 api: DeconzSession) -> None:
        """Initialize the system."""
        self.hass = hass
        self.config_entry = config_entry
        self.api = api

        api.add_device_callback = self.async_add_device_callback
        api.connection_status_callback = self.async_connection_status_callback

        self.available = True
        self.ignore_state_updates = False

        self.signal_reachable = f"deconz-reachable-{config_entry.entry_id}"

        self.signal_new_group = f"deconz_new_group_{config_entry.entry_id}"
        self.signal_new_light = f"deconz_new_light_{config_entry.entry_id}"
        self.signal_new_scene = f"deconz_new_scene_{config_entry.entry_id}"
        self.signal_new_sensor = f"deconz_new_sensor_{config_entry.entry_id}"

        self.deconz_resource_type_to_signal_new_device = {
            group.RESOURCE_TYPE: self.signal_new_group,
            light.RESOURCE_TYPE: self.signal_new_light,
            group.RESOURCE_TYPE_SCENE: self.signal_new_scene,
            sensor.RESOURCE_TYPE: self.signal_new_sensor,
        }

        self.deconz_ids: dict[str, str] = {}
        self.entities: dict[str, set[str]] = {}
        self.events: list[DeconzAlarmEvent | DeconzEvent] = []
Esempio n. 3
0
    def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry,
                 api: DeconzSession) -> None:
        """Initialize the system."""
        self.hass = hass
        self.config_entry = config_entry
        self.api = api

        api.add_device_callback = self.async_add_device_callback
        api.connection_status_callback = self.async_connection_status_callback

        self.available = True
        self.ignore_state_updates = False

        self.signal_reachable = f"deconz-reachable-{config_entry.entry_id}"
        self.signal_reload_groups = f"deconz_reload_group_{config_entry.entry_id}"

        self.signal_new_light = f"deconz_new_light_{config_entry.entry_id}"
        self.signal_new_sensor = f"deconz_new_sensor_{config_entry.entry_id}"

        self.deconz_resource_type_to_signal_new_device = {
            ResourceGroup.LIGHT.value: self.signal_new_light,
            ResourceGroup.SENSOR.value: self.signal_new_sensor,
        }

        self.deconz_ids: dict[str, str] = {}
        self.entities: dict[str, set[str]] = {}
        self.events: list[DeconzAlarmEvent | DeconzEvent] = []

        self._option_allow_deconz_groups = self.config_entry.options.get(
            CONF_ALLOW_DECONZ_GROUPS, DEFAULT_ALLOW_DECONZ_GROUPS)