mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-07 13:58:56 +01:00
fixed sensors
This commit is contained in:
@@ -275,9 +275,12 @@ class NsPanelLovelanceUI:
|
|||||||
|
|
||||||
if item_type == "sensor":
|
if item_type == "sensor":
|
||||||
icon_id = 0
|
icon_id = 0
|
||||||
icon_id = {
|
icon_mapping = {
|
||||||
"temperature": 2
|
"temperature": 2
|
||||||
}[entity.attributes.device_class]
|
"power": 4
|
||||||
|
}
|
||||||
|
if entity.attributes.device_class in icon_mapping:
|
||||||
|
icon_id = icon_mapping[entity.attributes.device_class]
|
||||||
|
|
||||||
value = entity.state + " " + entity.attributes.unit_of_measurement
|
value = entity.state + " " + entity.attributes.unit_of_measurement
|
||||||
return "entityUpd,{0},{1},{2},{3},{4},{5}".format(item_nr, "text", item, icon_id, name, value)
|
return "entityUpd,{0},{1},{2},{3},{4},{5}".format(item_nr, "text", item, icon_id, name, value)
|
||||||
@@ -314,7 +317,7 @@ class NsPanelLovelanceUI:
|
|||||||
author = entity.attributes.media_artist
|
author = entity.attributes.media_artist
|
||||||
if "volume_level" in entity.attributes:
|
if "volume_level" in entity.attributes:
|
||||||
volume = int(entity.attributes.volume_level*100)
|
volume = int(entity.attributes.volume_level*100)
|
||||||
|
|
||||||
if entity.state == "playing":
|
if entity.state == "playing":
|
||||||
iconplaypause = 8
|
iconplaypause = 8
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user