Updated apps
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import CONF_DOMAIN, CONF_NAME, CONF_UNIQUE_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
@@ -7,7 +8,6 @@ from custom_components.powercalc.analytics.analytics import collect_analytics
|
||||
from custom_components.powercalc.const import CONF_GROUP_TYPE, DATA_GROUP_TYPES, GroupType
|
||||
from custom_components.powercalc.errors import SensorConfigurationError
|
||||
import custom_components.powercalc.sensors.group.custom as custom_group
|
||||
import custom_components.powercalc.sensors.group.domain as domain_group
|
||||
import custom_components.powercalc.sensors.group.standby as standby_group
|
||||
import custom_components.powercalc.sensors.group.subtract as subtract_group
|
||||
from custom_components.powercalc.sensors.group.tracked_untracked import TrackedPowerSensorFactory
|
||||
@@ -24,9 +24,17 @@ async def create_group_sensors(
|
||||
collect_analytics(hass, config_entry).inc(DATA_GROUP_TYPES, group_type)
|
||||
|
||||
if group_type == GroupType.DOMAIN:
|
||||
return domain_group.create_domain_group_sensor(
|
||||
domain = sensor_config[CONF_DOMAIN]
|
||||
name: str = sensor_config.get(CONF_NAME, f"All {domain}")
|
||||
sensor_config.setdefault(CONF_UNIQUE_ID, f"powercalc_domaingroup_{domain}")
|
||||
sensor_config[CONF_GROUP_TYPE] = GroupType.DOMAIN
|
||||
return custom_group.create_group_sensors_custom(
|
||||
hass,
|
||||
name,
|
||||
sensor_config,
|
||||
set(),
|
||||
set(),
|
||||
force_create=True,
|
||||
)
|
||||
if group_type == GroupType.STANDBY:
|
||||
return standby_group.create_general_standby_sensors(hass, sensor_config)
|
||||
|
||||
Reference in New Issue
Block a user