Add icon translations to Uptimerobot (#112336)
* Add icon translations to Uptimerobot * Add icon translations to Uptimerobot
This commit is contained in:
parent
4fcc446255
commit
dca7083026
5 changed files with 32 additions and 31 deletions
|
@ -1,8 +1,6 @@
|
|||
"""UptimeRobot sensor platform."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TypedDict
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
SensorDeviceClass,
|
||||
SensorEntity,
|
||||
|
@ -17,20 +15,12 @@ from .const import DOMAIN
|
|||
from .coordinator import UptimeRobotDataUpdateCoordinator
|
||||
from .entity import UptimeRobotEntity
|
||||
|
||||
|
||||
class StatusValue(TypedDict):
|
||||
"""Sensor details."""
|
||||
|
||||
value: str
|
||||
icon: str
|
||||
|
||||
|
||||
SENSORS_INFO = {
|
||||
0: StatusValue(value="pause", icon="mdi:television-pause"),
|
||||
1: StatusValue(value="not_checked_yet", icon="mdi:television"),
|
||||
2: StatusValue(value="up", icon="mdi:television-shimmer"),
|
||||
8: StatusValue(value="seems_down", icon="mdi:television-off"),
|
||||
9: StatusValue(value="down", icon="mdi:television-off"),
|
||||
0: "pause",
|
||||
1: "not_checked_yet",
|
||||
2: "up",
|
||||
8: "seems_down",
|
||||
9: "down",
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,9 +53,4 @@ class UptimeRobotSensor(UptimeRobotEntity, SensorEntity):
|
|||
@property
|
||||
def native_value(self) -> str:
|
||||
"""Return the status of the monitor."""
|
||||
return SENSORS_INFO[self.monitor.status]["value"]
|
||||
|
||||
@property
|
||||
def icon(self) -> str:
|
||||
"""Return the status of the monitor."""
|
||||
return SENSORS_INFO[self.monitor.status]["icon"]
|
||||
return SENSORS_INFO[self.monitor.status]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue