1 """deCONZ config entry abstraction."""
3 from __future__
import annotations
5 from dataclasses
import dataclass
6 from typing
import Self
12 CONF_ALLOW_CLIP_SENSOR,
13 CONF_ALLOW_DECONZ_GROUPS,
14 CONF_ALLOW_NEW_DEVICES,
15 DEFAULT_ALLOW_CLIP_SENSOR,
16 DEFAULT_ALLOW_DECONZ_GROUPS,
17 DEFAULT_ALLOW_NEW_DEVICES,
23 """Represent a deCONZ config entry."""
31 allow_clip_sensor: bool
32 allow_deconz_groups: bool
33 allow_new_devices: bool
37 """Create object from config entry."""
38 config = config_entry.data
39 options = config_entry.options
42 host=config[CONF_HOST],
43 port=config[CONF_PORT],
44 api_key=config[CONF_API_KEY],
45 allow_clip_sensor=options.get(
46 CONF_ALLOW_CLIP_SENSOR,
47 DEFAULT_ALLOW_CLIP_SENSOR,
49 allow_deconz_groups=options.get(
50 CONF_ALLOW_DECONZ_GROUPS,
51 DEFAULT_ALLOW_DECONZ_GROUPS,
53 allow_new_devices=options.get(
54 CONF_ALLOW_NEW_DEVICES,
55 DEFAULT_ALLOW_NEW_DEVICES,
Self from_config_entry(cls, ConfigEntry config_entry)