Some more Device_Classes and two digit CPU_Temp (#140)
* Added data["device_class"] = "temperature" to align with other temperature values.
* Device_Class = temperature also for device + "_temp"
* Added some more device_classes: voltage, frequency, duration, signal_strength
Changed 'check_cpu_temp' to work with locale "DE" and showing 2 digits
(maybe this needs to be double checked on different systems/hardware)
* Bugfix: changed unit_of_measurement from days to d
to suppress warning: ... using native unit of measurement 'days' which is not a valid unit for the device class ('duration') it is using; expected one of ['h', 'ms', 'd', 's', 'min']; in homeassistant log
This commit is contained in:
@@ -360,6 +360,7 @@ def config_json(what_config, device=0):
|
|||||||
data["icon"] = "mdi:flash"
|
data["icon"] = "mdi:flash"
|
||||||
data["name"] = "CPU Voltage"
|
data["name"] = "CPU Voltage"
|
||||||
data["unit_of_measurement"] = "V"
|
data["unit_of_measurement"] = "V"
|
||||||
|
data["device_class"] = "voltage"
|
||||||
data["state_class"] = "measurement"
|
data["state_class"] = "measurement"
|
||||||
elif what_config == "swap":
|
elif what_config == "swap":
|
||||||
data["icon"] = "mdi:harddisk"
|
data["icon"] = "mdi:harddisk"
|
||||||
@@ -375,11 +376,13 @@ def config_json(what_config, device=0):
|
|||||||
data["icon"] = "mdi:speedometer"
|
data["icon"] = "mdi:speedometer"
|
||||||
data["name"] = "CPU Clock Speed"
|
data["name"] = "CPU Clock Speed"
|
||||||
data["unit_of_measurement"] = "MHz"
|
data["unit_of_measurement"] = "MHz"
|
||||||
|
data["device_class"] = "frequency"
|
||||||
data["state_class"] = "measurement"
|
data["state_class"] = "measurement"
|
||||||
elif what_config == "uptime_days":
|
elif what_config == "uptime_days":
|
||||||
data["icon"] = "mdi:calendar"
|
data["icon"] = "mdi:calendar"
|
||||||
data["name"] = "Uptime"
|
data["name"] = "Uptime"
|
||||||
data["unit_of_measurement"] = "days"
|
data["unit_of_measurement"] = "d"
|
||||||
|
data["device_class"] = "duration"
|
||||||
data["state_class"] = "total_increasing"
|
data["state_class"] = "total_increasing"
|
||||||
elif what_config == "uptime_seconds":
|
elif what_config == "uptime_seconds":
|
||||||
data["icon"] = "mdi:timer-outline"
|
data["icon"] = "mdi:timer-outline"
|
||||||
@@ -396,6 +399,7 @@ def config_json(what_config, device=0):
|
|||||||
data["icon"] = "mdi:wifi"
|
data["icon"] = "mdi:wifi"
|
||||||
data["name"] = "Wifi Signal"
|
data["name"] = "Wifi Signal"
|
||||||
data["unit_of_measurement"] = "dBm"
|
data["unit_of_measurement"] = "dBm"
|
||||||
|
data["device_class"] = "signal_strength"
|
||||||
data["state_class"] = "measurement"
|
data["state_class"] = "measurement"
|
||||||
elif what_config == "rpi5_fan_speed":
|
elif what_config == "rpi5_fan_speed":
|
||||||
data["icon"] = "mdi:fan"
|
data["icon"] = "mdi:fan"
|
||||||
|
|||||||
Reference in New Issue
Block a user