multiple domains
This commit is contained in:
@@ -121,7 +121,7 @@ class BinarySensorGroup(GroupEntity, BinarySensorEntity):
|
||||
"""Initialize a BinarySensorGroup entity."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = BINARY_SENSOR_DOMAIN
|
||||
self._domains = [BINARY_SENSOR_DOMAIN]
|
||||
self._attr_name = name
|
||||
self._attr_unique_id = unique_id
|
||||
self._device_class = device_class
|
||||
|
||||
@@ -111,7 +111,7 @@ class ButtonGroup(GroupEntity, ButtonEntity):
|
||||
"""Initialize a button group."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = BUTTON_DOMAIN
|
||||
self._domains = [BUTTON_DOMAIN]
|
||||
self._attr_name = name
|
||||
self._attr_unique_id = unique_id
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class CoverGroup(GroupEntity, CoverEntity):
|
||||
"""Initialize a CoverGroup entity."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = COVER_DOMAIN
|
||||
self._domains = [COVER_DOMAIN]
|
||||
self._covers: dict[str, set[str]] = {
|
||||
KEY_OPEN_CLOSE: set(),
|
||||
KEY_STOP: set(),
|
||||
|
||||
@@ -50,7 +50,7 @@ class GroupEntity(Entity):
|
||||
_attr_should_poll = False
|
||||
_entity_ids: list[str]
|
||||
_target_config: dict[str, Any]
|
||||
_domain: str
|
||||
_domains: list[str]
|
||||
|
||||
@callback
|
||||
def async_start_preview(
|
||||
@@ -89,7 +89,7 @@ class GroupEntity(Entity):
|
||||
return {
|
||||
entity_id
|
||||
for entity_id in entity_ids
|
||||
if split_entity_id(entity_id)[0] == self._domain
|
||||
if split_entity_id(entity_id)[0] in self._domains
|
||||
and entity_id != self.entity_id
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class EventGroup(GroupEntity, EventEntity):
|
||||
"""Initialize an event group."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = EVENT_DOMAIN
|
||||
self._domains = [EVENT_DOMAIN]
|
||||
self._attr_name = name
|
||||
self._attr_unique_id = unique_id
|
||||
self._attr_event_types = []
|
||||
|
||||
@@ -121,7 +121,7 @@ class FanGroup(GroupEntity, FanEntity):
|
||||
"""Initialize a FanGroup entity."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = FAN_DOMAIN
|
||||
self._domains = [FAN_DOMAIN]
|
||||
self._fans: dict[int, set[str]] = {flag: set() for flag in SUPPORTED_FLAGS}
|
||||
self._percentage = None
|
||||
self._oscillating = None
|
||||
|
||||
@@ -166,7 +166,7 @@ class LightGroup(GroupEntity, LightEntity):
|
||||
"""Initialize a light group."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = LIGHT_DOMAIN
|
||||
self._domains = [LIGHT_DOMAIN]
|
||||
self._attr_name = name
|
||||
self._attr_unique_id = unique_id
|
||||
self.mode = any
|
||||
|
||||
@@ -114,7 +114,7 @@ class LockGroup(GroupEntity, LockEntity):
|
||||
"""Initialize a lock group."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = LOCK_DOMAIN
|
||||
self._domains = [LOCK_DOMAIN]
|
||||
self.group = GenericGroup(self, target_config.get("entity_id", []))
|
||||
self._attr_supported_features = LockEntityFeature.OPEN
|
||||
self._attr_name = name
|
||||
|
||||
@@ -127,7 +127,7 @@ class MediaPlayerGroup(GroupEntity, MediaPlayerEntity):
|
||||
"""Initialize a Media Group entity."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = MEDIA_PLAYER_DOMAIN
|
||||
self._domains = [MEDIA_PLAYER_DOMAIN]
|
||||
self._name = name
|
||||
self._attr_unique_id = unique_id
|
||||
self._features: dict[str, set[str]] = {
|
||||
|
||||
@@ -166,7 +166,7 @@ class NotifyGroup(GroupEntity, NotifyEntity):
|
||||
"""Initialize a NotifyGroup."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = NOTIFY_DOMAIN
|
||||
self._domains = [NOTIFY_DOMAIN]
|
||||
self._attr_name = name
|
||||
self._attr_unique_id = unique_id
|
||||
|
||||
|
||||
@@ -357,7 +357,7 @@ class SensorGroup(GroupEntity, SensorEntity):
|
||||
"""Initialize a sensor group."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = SENSOR_DOMAIN
|
||||
self._domains = [SENSOR_DOMAIN, NUMBER_DOMAIN, INPUT_NUMBER_DOMAIN]
|
||||
self.hass = hass
|
||||
self._sensor_type = sensor_type
|
||||
self._configured_state_class = state_class
|
||||
|
||||
@@ -123,7 +123,7 @@ class SwitchGroup(GroupEntity, SwitchEntity):
|
||||
"""Initialize a switch group."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = SWITCH_DOMAIN
|
||||
self._domains = [SWITCH_DOMAIN]
|
||||
self._attr_name = name
|
||||
self._attr_unique_id = unique_id
|
||||
self.mode = any
|
||||
|
||||
@@ -114,7 +114,7 @@ class ValveGroup(GroupEntity, ValveEntity):
|
||||
"""Initialize a ValveGroup entity."""
|
||||
super().__init__()
|
||||
self._target_config = target_config
|
||||
self._domain = VALVE_DOMAIN
|
||||
self._domains = [VALVE_DOMAIN]
|
||||
self._valves: dict[str, set[str]] = {
|
||||
KEY_OPEN_CLOSE: set(),
|
||||
KEY_STOP: set(),
|
||||
|
||||
Reference in New Issue
Block a user