Use EntityDescription - logi_circle (#54429)
This commit is contained in:
parent
0abcfb42b3
commit
38a210292f
3 changed files with 81 additions and 68 deletions
|
@ -1,4 +1,7 @@
|
|||
"""Constants in Logi Circle component."""
|
||||
from __future__ import annotations
|
||||
|
||||
from homeassistant.components.sensor import SensorEntityDescription
|
||||
from homeassistant.const import PERCENTAGE
|
||||
|
||||
DOMAIN = "logi_circle"
|
||||
|
@ -12,15 +15,40 @@ DEFAULT_CACHEDB = ".logi_cache.pickle"
|
|||
LED_MODE_KEY = "LED"
|
||||
RECORDING_MODE_KEY = "RECORDING_MODE"
|
||||
|
||||
# Sensor types: Name, unit of measure, icon per sensor key.
|
||||
LOGI_SENSORS = {
|
||||
"battery_level": ["Battery", PERCENTAGE, "battery-50"],
|
||||
"last_activity_time": ["Last Activity", None, "history"],
|
||||
"recording": ["Recording Mode", None, "eye"],
|
||||
"signal_strength_category": ["WiFi Signal Category", None, "wifi"],
|
||||
"signal_strength_percentage": ["WiFi Signal Strength", PERCENTAGE, "wifi"],
|
||||
"streaming": ["Streaming Mode", None, "camera"],
|
||||
}
|
||||
SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
SensorEntityDescription(
|
||||
key="battery_level",
|
||||
name="Battery",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:battery-50",
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="last_activity_time",
|
||||
name="Last Activity",
|
||||
icon="mdi:history",
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="recording",
|
||||
name="Recording Mode",
|
||||
icon="mdi:eye",
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="signal_strength_category",
|
||||
name="WiFi Signal Category",
|
||||
icon="mdi:wifi",
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="signal_strength_percentage",
|
||||
name="WiFi Signal Strength",
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
icon="mdi:wifi",
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key="streaming",
|
||||
name="Streaming Mode",
|
||||
icon="mdi:camera",
|
||||
),
|
||||
)
|
||||
|
||||
SIGNAL_LOGI_CIRCLE_RECONFIGURE = "logi_circle_reconfigure"
|
||||
SIGNAL_LOGI_CIRCLE_SNAPSHOT = "logi_circle_snapshot"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue