From b43bc3f32d96faca4996cb43c05055850feadfab Mon Sep 17 00:00:00 2001 From: Keilin Bickar Date: Tue, 29 Oct 2024 12:44:19 -0400 Subject: [PATCH] Add Sense Devices for entities (#129182) --- homeassistant/components/sense/__init__.py | 1 - .../components/sense/binary_sensor.py | 25 +- homeassistant/components/sense/const.py | 2 +- homeassistant/components/sense/entity.py | 71 +++ homeassistant/components/sense/sensor.py | 91 +--- tests/components/sense/conftest.py | 5 + tests/components/sense/const.py | 7 +- .../sense/snapshots/test_binary_sensor.ambr | 28 +- .../sense/snapshots/test_sensor.ambr | 510 +++++++++--------- tests/components/sense/test_binary_sensor.py | 12 +- tests/components/sense/test_sensor.py | 59 +- 11 files changed, 414 insertions(+), 397 deletions(-) create mode 100644 homeassistant/components/sense/entity.py diff --git a/homeassistant/components/sense/__init__.py b/homeassistant/components/sense/__init__.py index b9eb5b68758..e919d48e96d 100644 --- a/homeassistant/components/sense/__init__.py +++ b/homeassistant/components/sense/__init__.py @@ -113,7 +113,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: SenseConfigEntry) -> boo ) await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) - return True diff --git a/homeassistant/components/sense/binary_sensor.py b/homeassistant/components/sense/binary_sensor.py index ea154751d4e..d06b3a62937 100644 --- a/homeassistant/components/sense/binary_sensor.py +++ b/homeassistant/components/sense/binary_sensor.py @@ -11,11 +11,11 @@ from homeassistant.components.binary_sensor import ( from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.update_coordinator import CoordinatorEntity from . import SenseConfigEntry -from .const import ATTRIBUTION, DOMAIN, MDI_ICONS +from .const import DOMAIN from .coordinator import SenseRealtimeCoordinator +from .entity import SenseDeviceEntity _LOGGER = logging.getLogger(__name__) @@ -30,7 +30,7 @@ async def async_setup_entry( realtime_coordinator = config_entry.runtime_data.rt devices = [ - SenseBinarySensor(device, sense_monitor_id, realtime_coordinator) + SenseBinarySensor(device, realtime_coordinator, sense_monitor_id) for device in config_entry.runtime_data.data.devices ] @@ -39,33 +39,20 @@ async def async_setup_entry( async_add_entities(devices) -def sense_to_mdi(sense_icon: str) -> str: - """Convert sense icon to mdi icon.""" - return f"mdi:{MDI_ICONS.get(sense_icon, "power-plug")}" - - -class SenseBinarySensor( - CoordinatorEntity[SenseRealtimeCoordinator], BinarySensorEntity -): +class SenseBinarySensor(SenseDeviceEntity, BinarySensorEntity): """Implementation of a Sense energy device binary sensor.""" - _attr_attribution = ATTRIBUTION - _attr_should_poll = False _attr_device_class = BinarySensorDeviceClass.POWER def __init__( self, device: SenseDevice, - sense_monitor_id: str, coordinator: SenseRealtimeCoordinator, + sense_monitor_id: str, ) -> None: """Initialize the Sense binary sensor.""" - super().__init__(coordinator) - self._attr_name = device.name + super().__init__(device, coordinator, sense_monitor_id, device.id) self._id = device.id - self._attr_unique_id = f"{sense_monitor_id}-{self._id}" - self._attr_icon = sense_to_mdi(device.icon) - self._device = device @property def old_unique_id(self) -> str: diff --git a/homeassistant/components/sense/const.py b/homeassistant/components/sense/const.py index 27225d769f9..b23117c977d 100644 --- a/homeassistant/components/sense/const.py +++ b/homeassistant/components/sense/const.py @@ -20,7 +20,7 @@ ACTIVE_TYPE = "active" ATTRIBUTION = "Data provided by Sense.com" -CONSUMPTION_NAME = "Usage" +CONSUMPTION_NAME = "Energy" CONSUMPTION_ID = "usage" PRODUCTION_NAME = "Production" PRODUCTION_ID = "production" diff --git a/homeassistant/components/sense/entity.py b/homeassistant/components/sense/entity.py new file mode 100644 index 00000000000..248be53ceb7 --- /dev/null +++ b/homeassistant/components/sense/entity.py @@ -0,0 +1,71 @@ +"""Base entities for Sense energy.""" + +from sense_energy import ASyncSenseable +from sense_energy.sense_api import SenseDevice + +from homeassistant.helpers.device_registry import DeviceInfo +from homeassistant.helpers.update_coordinator import CoordinatorEntity + +from .const import ATTRIBUTION, DOMAIN, MDI_ICONS +from .coordinator import SenseCoordinator + + +def sense_to_mdi(sense_icon: str) -> str: + """Convert sense icon to mdi icon.""" + return f"mdi:{MDI_ICONS.get(sense_icon, "power-plug")}" + + +class SenseEntity(CoordinatorEntity[SenseCoordinator]): + """Base implementation of a Sense sensor.""" + + _attr_attribution = ATTRIBUTION + _attr_should_poll = False + _attr_has_entity_name = True + + def __init__( + self, + gateway: ASyncSenseable, + coordinator: SenseCoordinator, + sense_monitor_id: str, + unique_id: str, + ) -> None: + """Initialize the Sense sensor.""" + super().__init__(coordinator) + self._attr_unique_id = f"{sense_monitor_id}-{unique_id}" + self._gateway = gateway + self._attr_device_info = DeviceInfo( + name=f"Sense {sense_monitor_id}", + identifiers={(DOMAIN, sense_monitor_id)}, + model="Sense", + manufacturer="Sense Labs, Inc.", + configuration_url="https://home.sense.com", + ) + + +class SenseDeviceEntity(CoordinatorEntity[SenseCoordinator]): + """Base implementation of a Sense sensor.""" + + _attr_attribution = ATTRIBUTION + _attr_should_poll = False + _attr_has_entity_name = True + + def __init__( + self, + device: SenseDevice, + coordinator: SenseCoordinator, + sense_monitor_id: str, + unique_id: str, + ) -> None: + """Initialize the Sense sensor.""" + super().__init__(coordinator) + self._attr_unique_id = f"{sense_monitor_id}-{unique_id}" + self._device = device + self._attr_icon = sense_to_mdi(device.icon) + self._attr_device_info = DeviceInfo( + name=device.name, + identifiers={(DOMAIN, f"{sense_monitor_id}:{device.id}")}, + model="Sense", + manufacturer="Sense Labs, Inc.", + configuration_url="https://home.sense.com", + via_device=(DOMAIN, sense_monitor_id), + ) diff --git a/homeassistant/components/sense/sensor.py b/homeassistant/components/sense/sensor.py index bb5db4771d6..b264b1fd166 100644 --- a/homeassistant/components/sense/sensor.py +++ b/homeassistant/components/sense/sensor.py @@ -17,21 +17,15 @@ from homeassistant.const import ( UnitOfPower, ) from homeassistant.core import HomeAssistant -from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback -from homeassistant.helpers.update_coordinator import CoordinatorEntity from . import SenseConfigEntry from .const import ( - ACTIVE_NAME, ACTIVE_TYPE, - ATTRIBUTION, CONSUMPTION_ID, CONSUMPTION_NAME, - DOMAIN, FROM_GRID_ID, FROM_GRID_NAME, - MDI_ICONS, NET_PRODUCTION_ID, NET_PRODUCTION_NAME, PRODUCTION_ID, @@ -43,11 +37,8 @@ from .const import ( TO_GRID_ID, TO_GRID_NAME, ) -from .coordinator import ( - SenseCoordinator, - SenseRealtimeCoordinator, - SenseTrendCoordinator, -) +from .coordinator import SenseRealtimeCoordinator, SenseTrendCoordinator +from .entity import SenseDeviceEntity, SenseEntity # Sensor types/ranges TRENDS_SENSOR_TYPES = { @@ -72,11 +63,6 @@ TREND_SENSOR_VARIANTS = [ ] -def sense_to_mdi(sense_icon: str) -> str: - """Convert sense icon to mdi icon.""" - return f"mdi:{MDI_ICONS.get(sense_icon, 'power-plug')}" - - async def async_setup_entry( hass: HomeAssistant, config_entry: SenseConfigEntry, @@ -126,24 +112,7 @@ async def async_setup_entry( async_add_entities(entities) -class SenseBaseSensor(CoordinatorEntity[SenseCoordinator], SensorEntity): - """Base implementation of a Sense sensor.""" - - _attr_attribution = ATTRIBUTION - _attr_should_poll = False - - def __init__( - self, - coordinator: SenseCoordinator, - sense_monitor_id: str, - unique_id: str, - ) -> None: - """Initialize the Sense sensor.""" - super().__init__(coordinator) - self._attr_unique_id = f"{sense_monitor_id}-{unique_id}" - - -class SensePowerSensor(SenseBaseSensor): +class SensePowerSensor(SenseEntity, SensorEntity): """Implementation of a Sense energy sensor.""" _attr_device_class = SensorDeviceClass.POWER @@ -152,7 +121,7 @@ class SensePowerSensor(SenseBaseSensor): def __init__( self, - data: ASyncSenseable, + gateway: ASyncSenseable, sense_monitor_id: str, variant_id: str, variant_name: str, @@ -160,23 +129,25 @@ class SensePowerSensor(SenseBaseSensor): ) -> None: """Initialize the Sense sensor.""" super().__init__( - realtime_coordinator, sense_monitor_id, f"{ACTIVE_TYPE}-{variant_id}" + gateway, + realtime_coordinator, + sense_monitor_id, + f"{ACTIVE_TYPE}-{variant_id}", ) - self._attr_name = f"{ACTIVE_NAME} {variant_name}" - self._data = data + self._attr_name = variant_name self._variant_id = variant_id @property def native_value(self) -> float: """Return the state of the sensor.""" return round( - self._data.active_solar_power + self._gateway.active_solar_power if self._variant_id == PRODUCTION_ID - else self._data.active_power + else self._gateway.active_power ) -class SenseVoltageSensor(SenseBaseSensor): +class SenseVoltageSensor(SenseEntity, SensorEntity): """Implementation of a Sense energy voltage sensor.""" _attr_device_class = SensorDeviceClass.VOLTAGE @@ -185,29 +156,30 @@ class SenseVoltageSensor(SenseBaseSensor): def __init__( self, - data: ASyncSenseable, + gateway: ASyncSenseable, index: int, sense_monitor_id: str, realtime_coordinator: SenseRealtimeCoordinator, ) -> None: """Initialize the Sense sensor.""" - super().__init__(realtime_coordinator, sense_monitor_id, f"L{index + 1}") + super().__init__( + gateway, realtime_coordinator, sense_monitor_id, f"L{index + 1}" + ) self._attr_name = f"L{index + 1} Voltage" - self._data = data self._voltage_index = index @property def native_value(self) -> float: """Return the state of the sensor.""" - return round(self._data.active_voltage[self._voltage_index], 1) + return round(self._gateway.active_voltage[self._voltage_index], 1) -class SenseTrendsSensor(SenseBaseSensor): +class SenseTrendsSensor(SenseEntity, SensorEntity): """Implementation of a Sense energy sensor.""" def __init__( self, - data: ASyncSenseable, + gateway: ASyncSenseable, scale: Scale, variant_id: str, variant_name: str, @@ -216,12 +188,12 @@ class SenseTrendsSensor(SenseBaseSensor): ) -> None: """Initialize the Sense sensor.""" super().__init__( + gateway, trends_coordinator, sense_monitor_id, f"{TRENDS_SENSOR_TYPES[scale].lower()}-{variant_id}", ) self._attr_name = f"{TRENDS_SENSOR_TYPES[scale]} {variant_name}" - self._data = data self._scale = scale self._variant_id = variant_id self._had_any_update = False @@ -234,28 +206,21 @@ class SenseTrendsSensor(SenseBaseSensor): self._attr_device_class = SensorDeviceClass.ENERGY self._attr_state_class = SensorStateClass.TOTAL self._attr_native_unit_of_measurement = UnitOfEnergy.KILO_WATT_HOUR - self._attr_device_info = DeviceInfo( - name=f"Sense {sense_monitor_id}", - identifiers={(DOMAIN, sense_monitor_id)}, - model="Sense", - manufacturer="Sense Labs, Inc.", - configuration_url="https://home.sense.com", - ) @property def native_value(self) -> float: """Return the state of the sensor.""" - return round(self._data.get_stat(self._scale, self._variant_id), 1) + return round(self._gateway.get_stat(self._scale, self._variant_id), 1) @property def last_reset(self) -> datetime | None: """Return the time when the sensor was last reset, if any.""" if self._attr_state_class == SensorStateClass.TOTAL: - return self._data.trend_start(self._scale) + return self._gateway.trend_start(self._scale) return None -class SenseDevicePowerSensor(SenseBaseSensor): +class SenseDevicePowerSensor(SenseDeviceEntity, SensorEntity): """Implementation of a Sense energy device.""" _attr_state_class = SensorStateClass.MEASUREMENT @@ -266,16 +231,12 @@ class SenseDevicePowerSensor(SenseBaseSensor): self, device: SenseDevice, sense_monitor_id: str, - realtime_coordinator: SenseRealtimeCoordinator, + coordinator: SenseRealtimeCoordinator, ) -> None: - """Initialize the Sense binary sensor.""" + """Initialize the Sense device sensor.""" super().__init__( - realtime_coordinator, sense_monitor_id, f"{device.id}-{CONSUMPTION_ID}" + device, coordinator, sense_monitor_id, f"{device.id}-{CONSUMPTION_ID}" ) - self._attr_name = f"{device.name} {CONSUMPTION_NAME}" - self._id = device.id - self._attr_icon = sense_to_mdi(device.icon) - self._device = device @property def native_value(self) -> float: diff --git a/tests/components/sense/conftest.py b/tests/components/sense/conftest.py index 805dcab2744..7cf1626f40e 100644 --- a/tests/components/sense/conftest.py +++ b/tests/components/sense/conftest.py @@ -7,14 +7,17 @@ import datetime from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch import pytest +from sense_energy import Scale from homeassistant.components.sense.binary_sensor import SenseDevice from homeassistant.components.sense.const import DOMAIN from .const import ( + DEVICE_1_DAY_ENERGY, DEVICE_1_ID, DEVICE_1_NAME, DEVICE_1_POWER, + DEVICE_2_DAY_ENERGY, DEVICE_2_ID, DEVICE_2_NAME, DEVICE_2_POWER, @@ -68,12 +71,14 @@ def mock_sense() -> Generator[MagicMock]: device_1.icon = "car" device_1.is_on = False device_1.power_w = DEVICE_1_POWER + device_1.energy_kwh[Scale.DAY] = DEVICE_1_DAY_ENERGY device_2 = SenseDevice(DEVICE_2_ID) device_2.name = DEVICE_2_NAME device_2.icon = "stove" device_2.is_on = False device_2.power_w = DEVICE_2_POWER + device_2.energy_kwh[Scale.DAY] = DEVICE_2_DAY_ENERGY type(gateway).devices = PropertyMock(return_value=[device_1, device_2]) yield gateway diff --git a/tests/components/sense/const.py b/tests/components/sense/const.py index 2f63d94eae9..d040c0bc38c 100644 --- a/tests/components/sense/const.py +++ b/tests/components/sense/const.py @@ -1,24 +1,29 @@ """Cosntants for the Sense integration tests.""" +MONITOR_ID = "456" + MOCK_CONFIG = { "timeout": 6, "email": "test-email", "password": "test-password", "access_token": "ABC", "user_id": "123", - "monitor_id": "456", + "monitor_id": MONITOR_ID, "device_id": "789", "refresh_token": "XYZ", } + DEVICE_1_NAME = "Car" DEVICE_1_ID = "abc123" DEVICE_1_ICON = "car-electric" DEVICE_1_POWER = 100.0 +DEVICE_1_DAY_ENERGY = 500 DEVICE_2_NAME = "Oven" DEVICE_2_ID = "def456" DEVICE_2_ICON = "stove" DEVICE_2_POWER = 50.0 +DEVICE_2_DAY_ENERGY = 42 MONITOR_ID = "12345" diff --git a/tests/components/sense/snapshots/test_binary_sensor.ambr b/tests/components/sense/snapshots/test_binary_sensor.ambr index f39c1e2450b..339830b16d3 100644 --- a/tests/components/sense/snapshots/test_binary_sensor.ambr +++ b/tests/components/sense/snapshots/test_binary_sensor.ambr @@ -1,5 +1,5 @@ # serializer version: 1 -# name: test_binary_sensors[binary_sensor.car-entry] +# name: test_binary_sensors[binary_sensor.car_power-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -11,8 +11,8 @@ 'disabled_by': None, 'domain': 'binary_sensor', 'entity_category': None, - 'entity_id': 'binary_sensor.car', - 'has_entity_name': False, + 'entity_id': 'binary_sensor.car_power', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -23,7 +23,7 @@ }), 'original_device_class': , 'original_icon': 'mdi:car-electric', - 'original_name': 'Car', + 'original_name': 'Power', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -32,23 +32,23 @@ 'unit_of_measurement': None, }) # --- -# name: test_binary_sensors[binary_sensor.car-state] +# name: test_binary_sensors[binary_sensor.car_power-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'power', - 'friendly_name': 'Car', + 'friendly_name': 'Car Power', 'icon': 'mdi:car-electric', }), 'context': , - 'entity_id': 'binary_sensor.car', + 'entity_id': 'binary_sensor.car_power', 'last_changed': , 'last_reported': , 'last_updated': , 'state': 'off', }) # --- -# name: test_binary_sensors[binary_sensor.oven-entry] +# name: test_binary_sensors[binary_sensor.oven_power-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -60,8 +60,8 @@ 'disabled_by': None, 'domain': 'binary_sensor', 'entity_category': None, - 'entity_id': 'binary_sensor.oven', - 'has_entity_name': False, + 'entity_id': 'binary_sensor.oven_power', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -72,7 +72,7 @@ }), 'original_device_class': , 'original_icon': 'mdi:stove', - 'original_name': 'Oven', + 'original_name': 'Power', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -81,16 +81,16 @@ 'unit_of_measurement': None, }) # --- -# name: test_binary_sensors[binary_sensor.oven-state] +# name: test_binary_sensors[binary_sensor.oven_power-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'power', - 'friendly_name': 'Oven', + 'friendly_name': 'Oven Power', 'icon': 'mdi:stove', }), 'context': , - 'entity_id': 'binary_sensor.oven', + 'entity_id': 'binary_sensor.oven_power', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/sense/snapshots/test_sensor.ambr b/tests/components/sense/snapshots/test_sensor.ambr index 1ba8a755f22..473c72d17f1 100644 --- a/tests/components/sense/snapshots/test_sensor.ambr +++ b/tests/components/sense/snapshots/test_sensor.ambr @@ -1,5 +1,5 @@ # serializer version: 1 -# name: test_sensors[sensor.bill_from_grid-entry] +# name: test_sensors[sensor.sense_12345_bill_from_grid-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -13,8 +13,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.bill_from_grid', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_bill_from_grid', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -34,25 +34,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.bill_from_grid-state] +# name: test_sensors[sensor.sense_12345_bill_from_grid-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Bill From Grid', + 'friendly_name': 'Sense 12345 Bill From Grid', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.bill_from_grid', + 'entity_id': 'sensor.sense_12345_bill_from_grid', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.bill_net_production-entry] +# name: test_sensors[sensor.sense_12345_bill_net_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -66,8 +66,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.bill_net_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_bill_net_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -87,25 +87,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.bill_net_production-state] +# name: test_sensors[sensor.sense_12345_bill_net_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Bill Net Production', + 'friendly_name': 'Sense 12345 Bill Net Production', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.bill_net_production', + 'entity_id': 'sensor.sense_12345_bill_net_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.bill_net_production_percentage-entry] +# name: test_sensors[sensor.sense_12345_bill_net_production_percentage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -117,8 +117,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.bill_net_production_percentage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_bill_net_production_percentage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -138,22 +138,22 @@ 'unit_of_measurement': '%', }) # --- -# name: test_sensors[sensor.bill_net_production_percentage-state] +# name: test_sensors[sensor.sense_12345_bill_net_production_percentage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', - 'friendly_name': 'Bill Net Production Percentage', + 'friendly_name': 'Sense 12345 Bill Net Production Percentage', 'unit_of_measurement': '%', }), 'context': , - 'entity_id': 'sensor.bill_net_production_percentage', + 'entity_id': 'sensor.sense_12345_bill_net_production_percentage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.bill_production-entry] +# name: test_sensors[sensor.sense_12345_bill_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -167,8 +167,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.bill_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_bill_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -188,25 +188,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.bill_production-state] +# name: test_sensors[sensor.sense_12345_bill_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Bill Production', + 'friendly_name': 'Sense 12345 Bill Production', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.bill_production', + 'entity_id': 'sensor.sense_12345_bill_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.bill_solar_powered_percentage-entry] +# name: test_sensors[sensor.sense_12345_bill_solar_powered_percentage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -218,8 +218,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.bill_solar_powered_percentage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_bill_solar_powered_percentage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -239,22 +239,22 @@ 'unit_of_measurement': '%', }) # --- -# name: test_sensors[sensor.bill_solar_powered_percentage-state] +# name: test_sensors[sensor.sense_12345_bill_solar_powered_percentage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', - 'friendly_name': 'Bill Solar Powered Percentage', + 'friendly_name': 'Sense 12345 Bill Solar Powered Percentage', 'unit_of_measurement': '%', }), 'context': , - 'entity_id': 'sensor.bill_solar_powered_percentage', + 'entity_id': 'sensor.sense_12345_bill_solar_powered_percentage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.bill_to_grid-entry] +# name: test_sensors[sensor.sense_12345_bill_to_grid-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -268,8 +268,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.bill_to_grid', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_bill_to_grid', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -289,25 +289,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.bill_to_grid-state] +# name: test_sensors[sensor.sense_12345_bill_to_grid-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Bill To Grid', + 'friendly_name': 'Sense 12345 Bill To Grid', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.bill_to_grid', + 'entity_id': 'sensor.sense_12345_bill_to_grid', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.bill_usage-entry] +# name: test_sensors[sensor.sense_12345_bill_energy-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -321,8 +321,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.bill_usage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_bill_energy', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -333,7 +333,7 @@ }), 'original_device_class': , 'original_icon': None, - 'original_name': 'Bill Usage', + 'original_name': 'Bill Energy', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -342,25 +342,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.bill_usage-state] +# name: test_sensors[sensor.sense_12345_bill_energy-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Bill Usage', + 'friendly_name': 'Sense 12345 Bill Energy', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.bill_usage', + 'entity_id': 'sensor.sense_12345_bill_energy', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.car_usage-entry] +# name: test_sensors[sensor.car_power-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -374,8 +374,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.car_usage', - 'has_entity_name': False, + 'entity_id': 'sensor.car_power', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -386,7 +386,7 @@ }), 'original_device_class': , 'original_icon': 'mdi:car-electric', - 'original_name': 'Car Usage', + 'original_name': 'Power', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -395,25 +395,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.car_usage-state] +# name: test_sensors[sensor.car_power-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'power', - 'friendly_name': 'Car Usage', + 'friendly_name': 'Car Power', 'icon': 'mdi:car-electric', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.car_usage', + 'entity_id': 'sensor.car_power', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '100.0', }) # --- -# name: test_sensors[sensor.daily_from_grid-entry] +# name: test_sensors[sensor.sense_12345_daily_from_grid-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -427,8 +427,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.daily_from_grid', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_daily_from_grid', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -448,25 +448,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.daily_from_grid-state] +# name: test_sensors[sensor.sense_12345_daily_from_grid-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Daily From Grid', + 'friendly_name': 'Sense 12345 Daily From Grid', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.daily_from_grid', + 'entity_id': 'sensor.sense_12345_daily_from_grid', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.daily_net_production-entry] +# name: test_sensors[sensor.sense_12345_daily_net_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -480,8 +480,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.daily_net_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_daily_net_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -501,25 +501,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.daily_net_production-state] +# name: test_sensors[sensor.sense_12345_daily_net_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Daily Net Production', + 'friendly_name': 'Sense 12345 Daily Net Production', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.daily_net_production', + 'entity_id': 'sensor.sense_12345_daily_net_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.daily_net_production_percentage-entry] +# name: test_sensors[sensor.sense_12345_daily_net_production_percentage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -531,8 +531,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.daily_net_production_percentage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_daily_net_production_percentage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -552,22 +552,22 @@ 'unit_of_measurement': '%', }) # --- -# name: test_sensors[sensor.daily_net_production_percentage-state] +# name: test_sensors[sensor.sense_12345_daily_net_production_percentage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', - 'friendly_name': 'Daily Net Production Percentage', + 'friendly_name': 'Sense 12345 Daily Net Production Percentage', 'unit_of_measurement': '%', }), 'context': , - 'entity_id': 'sensor.daily_net_production_percentage', + 'entity_id': 'sensor.sense_12345_daily_net_production_percentage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.daily_production-entry] +# name: test_sensors[sensor.sense_12345_daily_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -581,8 +581,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.daily_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_daily_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -602,25 +602,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.daily_production-state] +# name: test_sensors[sensor.sense_12345_daily_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Daily Production', + 'friendly_name': 'Sense 12345 Daily Production', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.daily_production', + 'entity_id': 'sensor.sense_12345_daily_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.daily_solar_powered_percentage-entry] +# name: test_sensors[sensor.sense_12345_daily_solar_powered_percentage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -632,8 +632,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.daily_solar_powered_percentage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_daily_solar_powered_percentage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -653,22 +653,22 @@ 'unit_of_measurement': '%', }) # --- -# name: test_sensors[sensor.daily_solar_powered_percentage-state] +# name: test_sensors[sensor.sense_12345_daily_solar_powered_percentage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', - 'friendly_name': 'Daily Solar Powered Percentage', + 'friendly_name': 'Sense 12345 Daily Solar Powered Percentage', 'unit_of_measurement': '%', }), 'context': , - 'entity_id': 'sensor.daily_solar_powered_percentage', + 'entity_id': 'sensor.sense_12345_daily_solar_powered_percentage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.daily_to_grid-entry] +# name: test_sensors[sensor.sense_12345_daily_to_grid-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -682,8 +682,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.daily_to_grid', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_daily_to_grid', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -703,25 +703,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.daily_to_grid-state] +# name: test_sensors[sensor.sense_12345_daily_to_grid-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Daily To Grid', + 'friendly_name': 'Sense 12345 Daily To Grid', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.daily_to_grid', + 'entity_id': 'sensor.sense_12345_daily_to_grid', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.daily_usage-entry] +# name: test_sensors[sensor.sense_12345_daily_energy-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -735,8 +735,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.daily_usage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_daily_energy', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -747,7 +747,7 @@ }), 'original_device_class': , 'original_icon': None, - 'original_name': 'Daily Usage', + 'original_name': 'Daily Energy', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -756,25 +756,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.daily_usage-state] +# name: test_sensors[sensor.sense_12345_daily_energy-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Daily Usage', + 'friendly_name': 'Sense 12345 Daily Energy', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.daily_usage', + 'entity_id': 'sensor.sense_12345_daily_energy', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.energy_production-entry] +# name: test_sensors[sensor.sense_12345_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -788,8 +788,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.energy_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -800,7 +800,7 @@ }), 'original_device_class': , 'original_icon': None, - 'original_name': 'Energy Production', + 'original_name': 'Production', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -809,24 +809,24 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.energy_production-state] +# name: test_sensors[sensor.sense_12345_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'power', - 'friendly_name': 'Energy Production', + 'friendly_name': 'Sense 12345 Production', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.energy_production', + 'entity_id': 'sensor.sense_12345_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '500', }) # --- -# name: test_sensors[sensor.energy_usage-entry] +# name: test_sensors[sensor.sense_12345_energy-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -840,8 +840,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.energy_usage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_energy', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -852,7 +852,7 @@ }), 'original_device_class': , 'original_icon': None, - 'original_name': 'Energy Usage', + 'original_name': 'Energy', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -861,24 +861,24 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.energy_usage-state] +# name: test_sensors[sensor.sense_12345_energy-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'power', - 'friendly_name': 'Energy Usage', + 'friendly_name': 'Sense 12345 Energy', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.energy_usage', + 'entity_id': 'sensor.sense_12345_energy', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '100', }) # --- -# name: test_sensors[sensor.l1_voltage-entry] +# name: test_sensors[sensor.sense_12345_l1_voltage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -892,8 +892,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.l1_voltage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_l1_voltage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -913,24 +913,24 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.l1_voltage-state] +# name: test_sensors[sensor.sense_12345_l1_voltage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'voltage', - 'friendly_name': 'L1 Voltage', + 'friendly_name': 'Sense 12345 L1 Voltage', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.l1_voltage', + 'entity_id': 'sensor.sense_12345_l1_voltage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '120', }) # --- -# name: test_sensors[sensor.l2_voltage-entry] +# name: test_sensors[sensor.sense_12345_l2_voltage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -944,8 +944,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.l2_voltage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_l2_voltage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -965,24 +965,24 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.l2_voltage-state] +# name: test_sensors[sensor.sense_12345_l2_voltage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'voltage', - 'friendly_name': 'L2 Voltage', + 'friendly_name': 'Sense 12345 L2 Voltage', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.l2_voltage', + 'entity_id': 'sensor.sense_12345_l2_voltage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '240', }) # --- -# name: test_sensors[sensor.monthly_from_grid-entry] +# name: test_sensors[sensor.sense_12345_monthly_from_grid-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -996,8 +996,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.monthly_from_grid', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_monthly_from_grid', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1017,25 +1017,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.monthly_from_grid-state] +# name: test_sensors[sensor.sense_12345_monthly_from_grid-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Monthly From Grid', + 'friendly_name': 'Sense 12345 Monthly From Grid', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.monthly_from_grid', + 'entity_id': 'sensor.sense_12345_monthly_from_grid', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.monthly_net_production-entry] +# name: test_sensors[sensor.sense_12345_monthly_net_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1049,8 +1049,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.monthly_net_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_monthly_net_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1070,25 +1070,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.monthly_net_production-state] +# name: test_sensors[sensor.sense_12345_monthly_net_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Monthly Net Production', + 'friendly_name': 'Sense 12345 Monthly Net Production', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.monthly_net_production', + 'entity_id': 'sensor.sense_12345_monthly_net_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.monthly_net_production_percentage-entry] +# name: test_sensors[sensor.sense_12345_monthly_net_production_percentage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1100,8 +1100,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.monthly_net_production_percentage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_monthly_net_production_percentage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1121,22 +1121,22 @@ 'unit_of_measurement': '%', }) # --- -# name: test_sensors[sensor.monthly_net_production_percentage-state] +# name: test_sensors[sensor.sense_12345_monthly_net_production_percentage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', - 'friendly_name': 'Monthly Net Production Percentage', + 'friendly_name': 'Sense 12345 Monthly Net Production Percentage', 'unit_of_measurement': '%', }), 'context': , - 'entity_id': 'sensor.monthly_net_production_percentage', + 'entity_id': 'sensor.sense_12345_monthly_net_production_percentage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.monthly_production-entry] +# name: test_sensors[sensor.sense_12345_monthly_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1150,8 +1150,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.monthly_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_monthly_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1171,25 +1171,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.monthly_production-state] +# name: test_sensors[sensor.sense_12345_monthly_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Monthly Production', + 'friendly_name': 'Sense 12345 Monthly Production', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.monthly_production', + 'entity_id': 'sensor.sense_12345_monthly_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.monthly_solar_powered_percentage-entry] +# name: test_sensors[sensor.sense_12345_monthly_solar_powered_percentage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1201,8 +1201,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.monthly_solar_powered_percentage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_monthly_solar_powered_percentage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1222,22 +1222,22 @@ 'unit_of_measurement': '%', }) # --- -# name: test_sensors[sensor.monthly_solar_powered_percentage-state] +# name: test_sensors[sensor.sense_12345_monthly_solar_powered_percentage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', - 'friendly_name': 'Monthly Solar Powered Percentage', + 'friendly_name': 'Sense 12345 Monthly Solar Powered Percentage', 'unit_of_measurement': '%', }), 'context': , - 'entity_id': 'sensor.monthly_solar_powered_percentage', + 'entity_id': 'sensor.sense_12345_monthly_solar_powered_percentage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.monthly_to_grid-entry] +# name: test_sensors[sensor.sense_12345_monthly_to_grid-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1251,8 +1251,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.monthly_to_grid', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_monthly_to_grid', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1272,25 +1272,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.monthly_to_grid-state] +# name: test_sensors[sensor.sense_12345_monthly_to_grid-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Monthly To Grid', + 'friendly_name': 'Sense 12345 Monthly To Grid', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.monthly_to_grid', + 'entity_id': 'sensor.sense_12345_monthly_to_grid', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.monthly_usage-entry] +# name: test_sensors[sensor.sense_12345_monthly_energy-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1304,8 +1304,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.monthly_usage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_monthly_energy', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1316,7 +1316,7 @@ }), 'original_device_class': , 'original_icon': None, - 'original_name': 'Monthly Usage', + 'original_name': 'Monthly Energy', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -1325,25 +1325,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.monthly_usage-state] +# name: test_sensors[sensor.sense_12345_monthly_energy-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Monthly Usage', + 'friendly_name': 'Sense 12345 Monthly Energy', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.monthly_usage', + 'entity_id': 'sensor.sense_12345_monthly_energy', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.oven_usage-entry] +# name: test_sensors[sensor.oven_power-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1357,8 +1357,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.oven_usage', - 'has_entity_name': False, + 'entity_id': 'sensor.oven_power', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1369,7 +1369,7 @@ }), 'original_device_class': , 'original_icon': 'mdi:stove', - 'original_name': 'Oven Usage', + 'original_name': 'Power', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -1378,25 +1378,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.oven_usage-state] +# name: test_sensors[sensor.oven_power-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'power', - 'friendly_name': 'Oven Usage', + 'friendly_name': 'Oven Power', 'icon': 'mdi:stove', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.oven_usage', + 'entity_id': 'sensor.oven_power', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '50.0', }) # --- -# name: test_sensors[sensor.weekly_from_grid-entry] +# name: test_sensors[sensor.sense_12345_weekly_from_grid-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1410,8 +1410,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.weekly_from_grid', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_weekly_from_grid', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1431,25 +1431,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.weekly_from_grid-state] +# name: test_sensors[sensor.sense_12345_weekly_from_grid-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Weekly From Grid', + 'friendly_name': 'Sense 12345 Weekly From Grid', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.weekly_from_grid', + 'entity_id': 'sensor.sense_12345_weekly_from_grid', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.weekly_net_production-entry] +# name: test_sensors[sensor.sense_12345_weekly_net_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1463,8 +1463,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.weekly_net_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_weekly_net_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1484,25 +1484,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.weekly_net_production-state] +# name: test_sensors[sensor.sense_12345_weekly_net_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Weekly Net Production', + 'friendly_name': 'Sense 12345 Weekly Net Production', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.weekly_net_production', + 'entity_id': 'sensor.sense_12345_weekly_net_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.weekly_net_production_percentage-entry] +# name: test_sensors[sensor.sense_12345_weekly_net_production_percentage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1514,8 +1514,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.weekly_net_production_percentage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_weekly_net_production_percentage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1535,22 +1535,22 @@ 'unit_of_measurement': '%', }) # --- -# name: test_sensors[sensor.weekly_net_production_percentage-state] +# name: test_sensors[sensor.sense_12345_weekly_net_production_percentage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', - 'friendly_name': 'Weekly Net Production Percentage', + 'friendly_name': 'Sense 12345 Weekly Net Production Percentage', 'unit_of_measurement': '%', }), 'context': , - 'entity_id': 'sensor.weekly_net_production_percentage', + 'entity_id': 'sensor.sense_12345_weekly_net_production_percentage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.weekly_production-entry] +# name: test_sensors[sensor.sense_12345_weekly_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1564,8 +1564,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.weekly_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_weekly_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1585,25 +1585,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.weekly_production-state] +# name: test_sensors[sensor.sense_12345_weekly_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Weekly Production', + 'friendly_name': 'Sense 12345 Weekly Production', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.weekly_production', + 'entity_id': 'sensor.sense_12345_weekly_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.weekly_solar_powered_percentage-entry] +# name: test_sensors[sensor.sense_12345_weekly_solar_powered_percentage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1615,8 +1615,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.weekly_solar_powered_percentage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_weekly_solar_powered_percentage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1636,22 +1636,22 @@ 'unit_of_measurement': '%', }) # --- -# name: test_sensors[sensor.weekly_solar_powered_percentage-state] +# name: test_sensors[sensor.sense_12345_weekly_solar_powered_percentage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', - 'friendly_name': 'Weekly Solar Powered Percentage', + 'friendly_name': 'Sense 12345 Weekly Solar Powered Percentage', 'unit_of_measurement': '%', }), 'context': , - 'entity_id': 'sensor.weekly_solar_powered_percentage', + 'entity_id': 'sensor.sense_12345_weekly_solar_powered_percentage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.weekly_to_grid-entry] +# name: test_sensors[sensor.sense_12345_weekly_to_grid-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1665,8 +1665,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.weekly_to_grid', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_weekly_to_grid', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1686,25 +1686,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.weekly_to_grid-state] +# name: test_sensors[sensor.sense_12345_weekly_to_grid-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Weekly To Grid', + 'friendly_name': 'Sense 12345 Weekly To Grid', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.weekly_to_grid', + 'entity_id': 'sensor.sense_12345_weekly_to_grid', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.weekly_usage-entry] +# name: test_sensors[sensor.sense_12345_weekly_energy-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1718,8 +1718,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.weekly_usage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_weekly_energy', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1730,7 +1730,7 @@ }), 'original_device_class': , 'original_icon': None, - 'original_name': 'Weekly Usage', + 'original_name': 'Weekly Energy', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -1739,25 +1739,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.weekly_usage-state] +# name: test_sensors[sensor.sense_12345_weekly_energy-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Weekly Usage', + 'friendly_name': 'Sense 12345 Weekly Energy', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.weekly_usage', + 'entity_id': 'sensor.sense_12345_weekly_energy', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.yearly_from_grid-entry] +# name: test_sensors[sensor.sense_12345_yearly_from_grid-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1771,8 +1771,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.yearly_from_grid', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_yearly_from_grid', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1792,25 +1792,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.yearly_from_grid-state] +# name: test_sensors[sensor.sense_12345_yearly_from_grid-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Yearly From Grid', + 'friendly_name': 'Sense 12345 Yearly From Grid', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.yearly_from_grid', + 'entity_id': 'sensor.sense_12345_yearly_from_grid', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.yearly_net_production-entry] +# name: test_sensors[sensor.sense_12345_yearly_net_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1824,8 +1824,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.yearly_net_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_yearly_net_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1845,25 +1845,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.yearly_net_production-state] +# name: test_sensors[sensor.sense_12345_yearly_net_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Yearly Net Production', + 'friendly_name': 'Sense 12345 Yearly Net Production', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.yearly_net_production', + 'entity_id': 'sensor.sense_12345_yearly_net_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.yearly_net_production_percentage-entry] +# name: test_sensors[sensor.sense_12345_yearly_net_production_percentage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1875,8 +1875,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.yearly_net_production_percentage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_yearly_net_production_percentage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1896,22 +1896,22 @@ 'unit_of_measurement': '%', }) # --- -# name: test_sensors[sensor.yearly_net_production_percentage-state] +# name: test_sensors[sensor.sense_12345_yearly_net_production_percentage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', - 'friendly_name': 'Yearly Net Production Percentage', + 'friendly_name': 'Sense 12345 Yearly Net Production Percentage', 'unit_of_measurement': '%', }), 'context': , - 'entity_id': 'sensor.yearly_net_production_percentage', + 'entity_id': 'sensor.sense_12345_yearly_net_production_percentage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.yearly_production-entry] +# name: test_sensors[sensor.sense_12345_yearly_production-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1925,8 +1925,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.yearly_production', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_yearly_production', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1946,25 +1946,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.yearly_production-state] +# name: test_sensors[sensor.sense_12345_yearly_production-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Yearly Production', + 'friendly_name': 'Sense 12345 Yearly Production', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.yearly_production', + 'entity_id': 'sensor.sense_12345_yearly_production', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.yearly_solar_powered_percentage-entry] +# name: test_sensors[sensor.sense_12345_yearly_solar_powered_percentage-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -1976,8 +1976,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.yearly_solar_powered_percentage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_yearly_solar_powered_percentage', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -1997,22 +1997,22 @@ 'unit_of_measurement': '%', }) # --- -# name: test_sensors[sensor.yearly_solar_powered_percentage-state] +# name: test_sensors[sensor.sense_12345_yearly_solar_powered_percentage-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', - 'friendly_name': 'Yearly Solar Powered Percentage', + 'friendly_name': 'Sense 12345 Yearly Solar Powered Percentage', 'unit_of_measurement': '%', }), 'context': , - 'entity_id': 'sensor.yearly_solar_powered_percentage', + 'entity_id': 'sensor.sense_12345_yearly_solar_powered_percentage', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.yearly_to_grid-entry] +# name: test_sensors[sensor.sense_12345_yearly_to_grid-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -2026,8 +2026,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.yearly_to_grid', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_yearly_to_grid', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -2047,25 +2047,25 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.yearly_to_grid-state] +# name: test_sensors[sensor.sense_12345_yearly_to_grid-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Yearly To Grid', + 'friendly_name': 'Sense 12345 Yearly To Grid', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.yearly_to_grid', + 'entity_id': 'sensor.sense_12345_yearly_to_grid', 'last_changed': , 'last_reported': , 'last_updated': , 'state': '15', }) # --- -# name: test_sensors[sensor.yearly_usage-entry] +# name: test_sensors[sensor.sense_12345_yearly_energy-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ }), @@ -2079,8 +2079,8 @@ 'disabled_by': None, 'domain': 'sensor', 'entity_category': None, - 'entity_id': 'sensor.yearly_usage', - 'has_entity_name': False, + 'entity_id': 'sensor.sense_12345_yearly_energy', + 'has_entity_name': True, 'hidden_by': None, 'icon': None, 'id': , @@ -2091,7 +2091,7 @@ }), 'original_device_class': , 'original_icon': None, - 'original_name': 'Yearly Usage', + 'original_name': 'Yearly Energy', 'platform': 'sense', 'previous_unique_id': None, 'supported_features': 0, @@ -2100,18 +2100,18 @@ 'unit_of_measurement': , }) # --- -# name: test_sensors[sensor.yearly_usage-state] +# name: test_sensors[sensor.sense_12345_yearly_energy-state] StateSnapshot({ 'attributes': ReadOnlyDict({ 'attribution': 'Data provided by Sense.com', 'device_class': 'energy', - 'friendly_name': 'Yearly Usage', + 'friendly_name': 'Sense 12345 Yearly Energy', 'last_reset': '2024-01-01T01:01:00+00:00', 'state_class': , 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.yearly_usage', + 'entity_id': 'sensor.sense_12345_yearly_energy', 'last_changed': , 'last_reported': , 'last_updated': , diff --git a/tests/components/sense/test_binary_sensor.py b/tests/components/sense/test_binary_sensor.py index f38c7ffff28..ae91b7a9a21 100644 --- a/tests/components/sense/test_binary_sensor.py +++ b/tests/components/sense/test_binary_sensor.py @@ -40,20 +40,20 @@ async def test_on_off_sensors( await setup_platform(hass, config_entry, BINARY_SENSOR_DOMAIN) device_1, device_2 = mock_sense.devices - state = hass.states.get(f"binary_sensor.{DEVICE_1_NAME.lower()}") + state = hass.states.get(f"binary_sensor.{DEVICE_1_NAME.lower()}_power") assert state.state == STATE_OFF - state = hass.states.get(f"binary_sensor.{DEVICE_2_NAME.lower()}") + state = hass.states.get(f"binary_sensor.{DEVICE_2_NAME.lower()}_power") assert state.state == STATE_OFF device_1.is_on = True async_fire_time_changed(hass, utcnow() + timedelta(seconds=ACTIVE_UPDATE_RATE)) await hass.async_block_till_done() - state = hass.states.get(f"binary_sensor.{DEVICE_1_NAME.lower()}") + state = hass.states.get(f"binary_sensor.{DEVICE_1_NAME.lower()}_power") assert state.state == STATE_ON - state = hass.states.get(f"binary_sensor.{DEVICE_2_NAME.lower()}") + state = hass.states.get(f"binary_sensor.{DEVICE_2_NAME.lower()}_power") assert state.state == STATE_OFF device_1.is_on = False @@ -61,8 +61,8 @@ async def test_on_off_sensors( async_fire_time_changed(hass, utcnow() + timedelta(seconds=ACTIVE_UPDATE_RATE)) await hass.async_block_till_done() - state = hass.states.get(f"binary_sensor.{DEVICE_1_NAME.lower()}") + state = hass.states.get(f"binary_sensor.{DEVICE_1_NAME.lower()}_power") assert state.state == STATE_OFF - state = hass.states.get(f"binary_sensor.{DEVICE_2_NAME.lower()}") + state = hass.states.get(f"binary_sensor.{DEVICE_2_NAME.lower()}_power") assert state.state == STATE_ON diff --git a/tests/components/sense/test_sensor.py b/tests/components/sense/test_sensor.py index 27eb5ba4e8b..8fcd1850036 100644 --- a/tests/components/sense/test_sensor.py +++ b/tests/components/sense/test_sensor.py @@ -7,7 +7,7 @@ import pytest from sense_energy import Scale from syrupy.assertion import SnapshotAssertion -from homeassistant.components.sense.const import ACTIVE_UPDATE_RATE, CONSUMPTION_ID +from homeassistant.components.sense.const import ACTIVE_UPDATE_RATE from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.const import Platform from homeassistant.core import HomeAssistant @@ -15,7 +15,7 @@ from homeassistant.helpers import entity_registry as er from homeassistant.util.dt import utcnow from . import setup_platform -from .const import DEVICE_1_NAME, DEVICE_1_POWER, DEVICE_2_NAME, DEVICE_2_POWER +from .const import DEVICE_1_NAME, DEVICE_2_NAME, DEVICE_2_POWER, MONITOR_ID from tests.common import MockConfigEntry, async_fire_time_changed, snapshot_platform @@ -46,31 +46,20 @@ async def test_device_power_sensors( await setup_platform(hass, config_entry, SENSOR_DOMAIN) device_1, device_2 = mock_sense.devices - state = hass.states.get(f"sensor.{DEVICE_1_NAME.lower()}_{CONSUMPTION_ID}") + state = hass.states.get(f"sensor.{DEVICE_1_NAME.lower()}_power") assert state.state == "0" - state = hass.states.get(f"sensor.{DEVICE_2_NAME.lower()}_{CONSUMPTION_ID}") + state = hass.states.get(f"sensor.{DEVICE_2_NAME.lower()}_power") assert state.state == "0" - device_1.power_w = DEVICE_1_POWER - async_fire_time_changed(hass, utcnow() + timedelta(seconds=ACTIVE_UPDATE_RATE)) - await hass.async_block_till_done() - - state = hass.states.get(f"sensor.{DEVICE_1_NAME.lower()}_{CONSUMPTION_ID}") - assert state.state == f"{DEVICE_1_POWER:.1f}" - - state = hass.states.get(f"sensor.{DEVICE_2_NAME.lower()}_{CONSUMPTION_ID}") - assert state.state == "0" - - device_1.power_w = 0 device_2.power_w = DEVICE_2_POWER async_fire_time_changed(hass, utcnow() + timedelta(seconds=ACTIVE_UPDATE_RATE)) await hass.async_block_till_done() - state = hass.states.get(f"sensor.{DEVICE_1_NAME.lower()}_{CONSUMPTION_ID}") + state = hass.states.get(f"sensor.{DEVICE_1_NAME.lower()}_power") assert state.state == "0" - state = hass.states.get(f"sensor.{DEVICE_2_NAME.lower()}_{CONSUMPTION_ID}") + state = hass.states.get(f"sensor.{DEVICE_2_NAME.lower()}_power") assert state.state == f"{DEVICE_2_POWER:.1f}" @@ -86,20 +75,20 @@ async def test_voltage_sensors( await setup_platform(hass, config_entry, SENSOR_DOMAIN) - state = hass.states.get("sensor.l1_voltage") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_l1_voltage") assert state.state == "120" - state = hass.states.get("sensor.l2_voltage") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_l2_voltage") assert state.state == "121" type(mock_sense).active_voltage = PropertyMock(return_value=[122, 123]) async_fire_time_changed(hass, utcnow() + timedelta(seconds=ACTIVE_UPDATE_RATE)) await hass.async_block_till_done() - state = hass.states.get("sensor.l1_voltage") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_l1_voltage") assert state.state == "122" - state = hass.states.get("sensor.l2_voltage") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_l2_voltage") assert state.state == "123" @@ -116,10 +105,10 @@ async def test_active_power_sensors( await setup_platform(hass, config_entry, SENSOR_DOMAIN) - state = hass.states.get("sensor.energy_usage") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_energy") assert state.state == "400" - state = hass.states.get("sensor.energy_production") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_production") assert state.state == "500" type(mock_sense).active_power = PropertyMock(return_value=600) @@ -127,10 +116,10 @@ async def test_active_power_sensors( async_fire_time_changed(hass, utcnow() + timedelta(seconds=ACTIVE_UPDATE_RATE)) await hass.async_block_till_done() - state = hass.states.get("sensor.energy_usage") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_energy") assert state.state == "600" - state = hass.states.get("sensor.energy_production") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_production") assert state.state == "700" @@ -153,19 +142,19 @@ async def test_trend_energy_sensors( await setup_platform(hass, config_entry, SENSOR_DOMAIN) - state = hass.states.get("sensor.daily_usage") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_daily_energy") assert state.state == "100" - state = hass.states.get("sensor.daily_production") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_daily_production") assert state.state == "200" - state = hass.states.get("sensor.daily_from_grid") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_daily_from_grid") assert state.state == "300" - state = hass.states.get("sensor.daily_to_grid") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_daily_to_grid") assert state.state == "400" - state = hass.states.get("sensor.daily_net_production") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_daily_net_production") assert state.state == "500" mock_sense.get_stat.side_effect = lambda sensor_type, variant: { @@ -180,17 +169,17 @@ async def test_trend_energy_sensors( async_fire_time_changed(hass, utcnow() + timedelta(seconds=600)) await hass.async_block_till_done() - state = hass.states.get("sensor.daily_usage") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_daily_energy") assert state.state == "1000" - state = hass.states.get("sensor.daily_production") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_daily_production") assert state.state == "2000" - state = hass.states.get("sensor.daily_from_grid") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_daily_from_grid") assert state.state == "3000" - state = hass.states.get("sensor.daily_to_grid") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_daily_to_grid") assert state.state == "4000" - state = hass.states.get("sensor.daily_net_production") + state = hass.states.get(f"sensor.sense_{MONITOR_ID}_daily_net_production") assert state.state == "5000"