Updated apps
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
@@ -474,7 +474,6 @@ class GroupedSensor(BaseEntity, SensorEntity):
|
||||
self._start_time: float = time.time()
|
||||
self._last_update_time: float = 0
|
||||
self._update_interval_exceeded_callback: CALLBACK_TYPE | None = None
|
||||
self._unit_converter_cache: dict[str, Callable[[float], float]] = {}
|
||||
|
||||
async def async_added_to_hass(self) -> None:
|
||||
"""Register state listeners."""
|
||||
@@ -793,7 +792,6 @@ class GroupedEnergySensor(GroupedSensor, RestoreSensor, EnergySensor):
|
||||
"""Reset the group sensor and underlying member sensor when supported."""
|
||||
_LOGGER.debug("%s: Reset grouped energy sensor", self.entity_id)
|
||||
self._set_native_value(Decimal(0))
|
||||
self.async_write_ha_state()
|
||||
|
||||
for entity_id in self._entities:
|
||||
_LOGGER.debug("Resetting %s", entity_id)
|
||||
@@ -813,7 +811,6 @@ class GroupedEnergySensor(GroupedSensor, RestoreSensor, EnergySensor):
|
||||
async def async_calibrate(self, value: str) -> None:
|
||||
_LOGGER.debug("%s: Calibrate group energy sensor to: %s", self.entity_id, value)
|
||||
self._set_native_value(Decimal(value))
|
||||
self.async_write_ha_state()
|
||||
|
||||
def calculate_initial_state(
|
||||
self,
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
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
|
||||
|
||||
from custom_components.powercalc.const import CONF_GROUP_TYPE, GroupType
|
||||
from custom_components.powercalc.sensors.group.custom import create_group_sensors_custom
|
||||
|
||||
|
||||
def create_domain_group_sensor(
|
||||
hass: HomeAssistant,
|
||||
config: ConfigType,
|
||||
) -> list[Entity]:
|
||||
domain = config[CONF_DOMAIN]
|
||||
name: str = config.get(CONF_NAME, f"All {domain}")
|
||||
if CONF_UNIQUE_ID not in config:
|
||||
config[CONF_UNIQUE_ID] = generate_unique_id(config)
|
||||
config[CONF_GROUP_TYPE] = GroupType.DOMAIN
|
||||
return create_group_sensors_custom(
|
||||
hass,
|
||||
name,
|
||||
config,
|
||||
set(),
|
||||
set(),
|
||||
force_create=True,
|
||||
)
|
||||
|
||||
|
||||
def generate_unique_id(sensor_config: ConfigType) -> str:
|
||||
return f"powercalc_domaingroup_{sensor_config[CONF_DOMAIN]}"
|
||||
@@ -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