mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Add Matter tests for BatVoltage attribute from PowerSource cluster (#125645)
* Add BatVoltage Attribute from PowerSource Cluster * Update sensor.py Remove comment * Update homeassistant/components/matter/sensor.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Fixture for a Eve Door & Window node Fixture for a Eve Door & Window node to check BatVoltage attribute from PowerSource cluster * Test battery voltage sensor * Update test_sensor.py * ruff-format * Update test_sensor.py * Update test_sensor.py battery_voltage attribute test * Update test_sensor.py * Update test_sensor.py * Update tests/components/matter/test_sensor.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Update test_sensor.py * Adjust values --------- Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
e9364f4c3a
commit
e08a94fe1c
@ -251,6 +251,33 @@ async def test_battery_sensor(
|
|||||||
assert entry.entity_category == EntityCategory.DIAGNOSTIC
|
assert entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||||
|
|
||||||
|
|
||||||
|
# This tests needs to be adjusted to remove lingering tasks
|
||||||
|
@pytest.mark.parametrize("expected_lingering_tasks", [True])
|
||||||
|
async def test_battery_sensor_voltage(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
matter_client: MagicMock,
|
||||||
|
eve_contact_sensor_node: MatterNode,
|
||||||
|
) -> None:
|
||||||
|
"""Test battery voltage sensor."""
|
||||||
|
entity_id = "sensor.eve_door_voltage"
|
||||||
|
state = hass.states.get(entity_id)
|
||||||
|
assert state
|
||||||
|
assert state.state == "3.558"
|
||||||
|
|
||||||
|
set_node_attribute(eve_contact_sensor_node, 1, 47, 11, 4234)
|
||||||
|
await trigger_subscription_callback(hass, matter_client)
|
||||||
|
|
||||||
|
state = hass.states.get(entity_id)
|
||||||
|
assert state
|
||||||
|
assert state.state == "4.234"
|
||||||
|
|
||||||
|
entry = entity_registry.async_get(entity_id)
|
||||||
|
|
||||||
|
assert entry
|
||||||
|
assert entry.entity_category == EntityCategory.DIAGNOSTIC
|
||||||
|
|
||||||
|
|
||||||
# This tests needs to be adjusted to remove lingering tasks
|
# This tests needs to be adjusted to remove lingering tasks
|
||||||
@pytest.mark.parametrize("expected_lingering_tasks", [True])
|
@pytest.mark.parametrize("expected_lingering_tasks", [True])
|
||||||
async def test_energy_sensors_custom_cluster(
|
async def test_energy_sensors_custom_cluster(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user