Use enum sensor device class in UptimeRobot (#83111)

This commit is contained in:
Franck Nijhof 2022-12-05 10:36:16 +01:00 committed by GitHub
parent c7a6b5983f
commit 40d337479e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 13 deletions

View file

@ -3,7 +3,11 @@ from __future__ import annotations
from typing import TypedDict
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
@ -44,7 +48,9 @@ async def async_setup_entry(
key=str(monitor.id),
name=monitor.friendly_name,
entity_category=EntityCategory.DIAGNOSTIC,
device_class="uptimerobot__monitor_status",
device_class=SensorDeviceClass.ENUM,
options=["down", "not_checked_yet", "pause", "seems_down", "up"],
translation_key="monitor_status",
),
monitor=monitor,
)