mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Add tests for Shelly Flood gen4 (#137246)
This commit is contained in:
parent
628e1ffb84
commit
2682f4a323
@ -180,6 +180,7 @@ MOCK_CONFIG = {
|
|||||||
"xcounts": {"expr": None, "unit": None},
|
"xcounts": {"expr": None, "unit": None},
|
||||||
"xfreq": {"expr": None, "unit": None},
|
"xfreq": {"expr": None, "unit": None},
|
||||||
},
|
},
|
||||||
|
"flood:0": {"id": 0, "name": "Test name"},
|
||||||
"light:0": {"name": "test light_0"},
|
"light:0": {"name": "test light_0"},
|
||||||
"light:1": {"name": "test light_1"},
|
"light:1": {"name": "test light_1"},
|
||||||
"light:2": {"name": "test light_2"},
|
"light:2": {"name": "test light_2"},
|
||||||
@ -326,6 +327,7 @@ MOCK_STATUS_RPC = {
|
|||||||
"em1:1": {"act_power": 123.3},
|
"em1:1": {"act_power": 123.3},
|
||||||
"em1data:0": {"total_act_energy": 123456.4},
|
"em1data:0": {"total_act_energy": 123456.4},
|
||||||
"em1data:1": {"total_act_energy": 987654.3},
|
"em1data:1": {"total_act_energy": 987654.3},
|
||||||
|
"flood:0": {"id": 0, "alarm": False, "mute": False},
|
||||||
"thermostat:0": {
|
"thermostat:0": {
|
||||||
"id": 0,
|
"id": 0,
|
||||||
"enable": True,
|
"enable": True,
|
||||||
|
@ -46,3 +46,96 @@
|
|||||||
'state': 'off',
|
'state': 'off',
|
||||||
})
|
})
|
||||||
# ---
|
# ---
|
||||||
|
# name: test_rpc_flood_entities[binary_sensor.test_name_flood-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'binary_sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'binary_sensor.test_name_flood',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <BinarySensorDeviceClass.MOISTURE: 'moisture'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Test name flood',
|
||||||
|
'platform': 'shelly',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '123456789ABC-flood:0-flood',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_rpc_flood_entities[binary_sensor.test_name_flood-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'moisture',
|
||||||
|
'friendly_name': 'Test name flood',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'binary_sensor.test_name_flood',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'off',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_rpc_flood_entities[binary_sensor.test_name_mute-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'binary_sensor',
|
||||||
|
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||||
|
'entity_id': 'binary_sensor.test_name_mute',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Test name mute',
|
||||||
|
'platform': 'shelly',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '123456789ABC-flood:0-mute',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_rpc_flood_entities[binary_sensor.test_name_mute-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'friendly_name': 'Test name mute',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'binary_sensor.test_name_mute',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'off',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
@ -496,3 +496,22 @@ async def test_blu_trv_binary_sensor_entity(
|
|||||||
|
|
||||||
entry = entity_registry.async_get(entity_id)
|
entry = entity_registry.async_get(entity_id)
|
||||||
assert entry == snapshot(name=f"{entity_id}-entry")
|
assert entry == snapshot(name=f"{entity_id}-entry")
|
||||||
|
|
||||||
|
|
||||||
|
async def test_rpc_flood_entities(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
mock_rpc_device: Mock,
|
||||||
|
entity_registry: EntityRegistry,
|
||||||
|
snapshot: SnapshotAssertion,
|
||||||
|
) -> None:
|
||||||
|
"""Test RPC flood sensor entities."""
|
||||||
|
await init_integration(hass, 4)
|
||||||
|
|
||||||
|
for entity in ("flood", "mute"):
|
||||||
|
entity_id = f"{BINARY_SENSOR_DOMAIN}.test_name_{entity}"
|
||||||
|
|
||||||
|
state = hass.states.get(entity_id)
|
||||||
|
assert state == snapshot(name=f"{entity_id}-state")
|
||||||
|
|
||||||
|
entry = entity_registry.async_get(entity_id)
|
||||||
|
assert entry == snapshot(name=f"{entity_id}-entry")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user