mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Use device class enum in UptimeRobot (#60688)
This commit is contained in:
parent
79ebc1b79a
commit
bbd179200c
@ -2,7 +2,7 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_CONNECTIVITY,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
@ -27,7 +27,7 @@ async def async_setup_entry(
|
|||||||
BinarySensorEntityDescription(
|
BinarySensorEntityDescription(
|
||||||
key=str(monitor.id),
|
key=str(monitor.id),
|
||||||
name=monitor.friendly_name,
|
name=monitor.friendly_name,
|
||||||
device_class=DEVICE_CLASS_CONNECTIVITY,
|
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
||||||
),
|
),
|
||||||
monitor=monitor,
|
monitor=monitor,
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,7 @@ from unittest.mock import patch
|
|||||||
|
|
||||||
from pyuptimerobot import UptimeRobotAuthenticationException
|
from pyuptimerobot import UptimeRobotAuthenticationException
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import DEVICE_CLASS_CONNECTIVITY
|
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
|
||||||
from homeassistant.components.uptimerobot.const import (
|
from homeassistant.components.uptimerobot.const import (
|
||||||
ATTRIBUTION,
|
ATTRIBUTION,
|
||||||
COORDINATOR_UPDATE_INTERVAL,
|
COORDINATOR_UPDATE_INTERVAL,
|
||||||
@ -29,7 +29,7 @@ async def test_presentation(hass: HomeAssistant) -> None:
|
|||||||
entity = hass.states.get(UPTIMEROBOT_TEST_ENTITY)
|
entity = hass.states.get(UPTIMEROBOT_TEST_ENTITY)
|
||||||
|
|
||||||
assert entity.state == STATE_ON
|
assert entity.state == STATE_ON
|
||||||
assert entity.attributes["device_class"] == DEVICE_CLASS_CONNECTIVITY
|
assert entity.attributes["device_class"] == BinarySensorDeviceClass.CONNECTIVITY
|
||||||
assert entity.attributes["attribution"] == ATTRIBUTION
|
assert entity.attributes["attribution"] == ATTRIBUTION
|
||||||
assert entity.attributes["target"] == MOCK_UPTIMEROBOT_MONITOR["url"]
|
assert entity.attributes["target"] == MOCK_UPTIMEROBOT_MONITOR["url"]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user