mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Fix Shelly n_current
sensor removal condition (#148740)
This commit is contained in:
parent
f65fa38429
commit
c476500c49
@ -868,8 +868,8 @@ RPC_SENSORS: Final = {
|
||||
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
|
||||
device_class=SensorDeviceClass.CURRENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
available=lambda status: (status and status["n_current"]) is not None,
|
||||
removal_condition=lambda _config, status, _key: "n_current" not in status,
|
||||
removal_condition=lambda _config, status, key: status[key].get("n_current")
|
||||
is None,
|
||||
entity_registry_enabled_default=False,
|
||||
),
|
||||
"total_current": RpcSensorDescription(
|
||||
|
@ -151,7 +151,7 @@
|
||||
"c_pf": 0.72,
|
||||
"c_voltage": 230.2,
|
||||
"id": 0,
|
||||
"n_current": null,
|
||||
"n_current": 3.124,
|
||||
"total_act_power": 2413.825,
|
||||
"total_aprt_power": 2525.779,
|
||||
"total_current": 11.116,
|
||||
|
@ -4303,6 +4303,62 @@
|
||||
'state': '230.2',
|
||||
})
|
||||
# ---
|
||||
# name: test_shelly_pro_3em[sensor.test_name_phase_n_current-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.test_name_phase_n_current',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.CURRENT: 'current'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Phase N current',
|
||||
'platform': 'shelly',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': '123456789ABC-em:0-n_current',
|
||||
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_shelly_pro_3em[sensor.test_name_phase_n_current-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'current',
|
||||
'friendly_name': 'Test name Phase N current',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': <UnitOfElectricCurrent.AMPERE: 'A'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.test_name_phase_n_current',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '3.124',
|
||||
})
|
||||
# ---
|
||||
# name: test_shelly_pro_3em[sensor.test_name_rssi-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
|
Loading…
x
Reference in New Issue
Block a user