mirror of
https://github.com/home-assistant/core.git
synced 2026-09-28 02:18:10 -04:00
Use entity category and state class in devolo Home Network (#59071)
* Use entity category and state class * Add tests
This commit is contained in:
@@ -8,9 +8,10 @@ from homeassistant.components.devolo_home_network.const import (
|
||||
LONG_UPDATE_INTERVAL,
|
||||
SHORT_UPDATE_INTERVAL,
|
||||
)
|
||||
from homeassistant.components.sensor import DOMAIN
|
||||
from homeassistant.const import STATE_UNAVAILABLE
|
||||
from homeassistant.components.sensor import DOMAIN, STATE_CLASS_MEASUREMENT
|
||||
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC, STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry
|
||||
from homeassistant.util import dt
|
||||
|
||||
from . import configure_integration
|
||||
@@ -46,6 +47,7 @@ async def test_update_connected_wifi_clients(hass: HomeAssistant):
|
||||
state = hass.states.get(state_key)
|
||||
assert state is not None
|
||||
assert state.state == "1"
|
||||
assert state.attributes["state_class"] == STATE_CLASS_MEASUREMENT
|
||||
|
||||
# Emulate device failure
|
||||
with patch(
|
||||
@@ -86,6 +88,9 @@ async def test_update_neighboring_wifi_networks(hass: HomeAssistant):
|
||||
assert state is not None
|
||||
assert state.state == "1"
|
||||
|
||||
er = entity_registry.async_get(hass)
|
||||
assert er.async_get(state_key).entity_category == ENTITY_CATEGORY_DIAGNOSTIC
|
||||
|
||||
# Emulate device failure
|
||||
with patch(
|
||||
"devolo_plc_api.device_api.deviceapi.DeviceApi.async_get_wifi_neighbor_access_points",
|
||||
@@ -125,6 +130,9 @@ async def test_update_connected_plc_devices(hass: HomeAssistant):
|
||||
assert state is not None
|
||||
assert state.state == "1"
|
||||
|
||||
er = entity_registry.async_get(hass)
|
||||
assert er.async_get(state_key).entity_category == ENTITY_CATEGORY_DIAGNOSTIC
|
||||
|
||||
# Emulate device failure
|
||||
with patch(
|
||||
"devolo_plc_api.plcnet_api.plcnetapi.PlcNetApi.async_get_network_overview",
|
||||
|
||||
Reference in New Issue
Block a user