mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 15:04:24 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc2aea3ffc | ||
|
|
4af3449491 | ||
|
|
85d1de3c19 | ||
|
|
cdda0d9601 |
@@ -345,14 +345,19 @@ class NsPanelLovelaceUI:
|
|||||||
|
|
||||||
if item_type == "sensor":
|
if item_type == "sensor":
|
||||||
icon_id = 0
|
icon_id = 0
|
||||||
|
unit_of_measurement = ""
|
||||||
icon_mapping = {
|
icon_mapping = {
|
||||||
"temperature": 2,
|
"temperature": 2,
|
||||||
"power": 4
|
"power": 4
|
||||||
}
|
}
|
||||||
if entity.attributes.device_class in icon_mapping:
|
if "device_class" in entity.attributes:
|
||||||
icon_id = icon_mapping[entity.attributes.device_class]
|
if entity.attributes.device_class in icon_mapping:
|
||||||
|
icon_id = icon_mapping[entity.attributes.device_class]
|
||||||
|
|
||||||
value = entity.state + " " + entity.attributes.unit_of_measurement
|
if "unit_of_measurement" in entity.attributes:
|
||||||
|
unit_of_measurement = entity.attributes.unit_of_measurement
|
||||||
|
|
||||||
|
value = entity.state + " " + 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)
|
||||||
|
|
||||||
if item_type == "button" or item_type == "input_button":
|
if item_type == "button" or item_type == "input_button":
|
||||||
@@ -370,12 +375,14 @@ class NsPanelLovelaceUI:
|
|||||||
heading = entity.attributes.friendly_name
|
heading = entity.attributes.friendly_name
|
||||||
current_temp = int(entity.attributes.current_temperature*10)
|
current_temp = int(entity.attributes.current_temperature*10)
|
||||||
dest_temp = int(entity.attributes.temperature*10)
|
dest_temp = int(entity.attributes.temperature*10)
|
||||||
status = entity.attributes.hvac_action
|
status = ""
|
||||||
|
if "hvac_action" in entity.attributes:
|
||||||
|
status = entity.attributes.hvac_action
|
||||||
min_temp = int(entity.attributes.min_temp*10)
|
min_temp = int(entity.attributes.min_temp*10)
|
||||||
max_temp = int(entity.attributes.max_temp*10)
|
max_temp = int(entity.attributes.max_temp*10)
|
||||||
step_temp = int(0.5*10)
|
step_temp = int(0.5*10)
|
||||||
|
|
||||||
return "entityUpd,{0},{1},{2},{3},{4},{5},{6},{7}".format(item, heading, current_temp, dest_temp, status, min_temp, max_temp, step_temp)
|
return f"entityUpd,{item},{heading},{current_temp},{dest_temp},{status},{min_temp},{max_temp},{step_temp}"
|
||||||
|
|
||||||
def generate_media_page(self, item):
|
def generate_media_page(self, item):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user