mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-20 14:37:01 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc2aea3ffc | ||
|
|
4af3449491 | ||
|
|
85d1de3c19 | ||
|
|
cdda0d9601 |
@@ -345,14 +345,19 @@ class NsPanelLovelaceUI:
|
||||
|
||||
if item_type == "sensor":
|
||||
icon_id = 0
|
||||
unit_of_measurement = ""
|
||||
icon_mapping = {
|
||||
"temperature": 2,
|
||||
"power": 4
|
||||
}
|
||||
if entity.attributes.device_class in icon_mapping:
|
||||
icon_id = icon_mapping[entity.attributes.device_class]
|
||||
if "device_class" in entity.attributes:
|
||||
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)
|
||||
|
||||
if item_type == "button" or item_type == "input_button":
|
||||
@@ -370,12 +375,14 @@ class NsPanelLovelaceUI:
|
||||
heading = entity.attributes.friendly_name
|
||||
current_temp = int(entity.attributes.current_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)
|
||||
max_temp = int(entity.attributes.max_temp*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):
|
||||
|
||||
@@ -484,4 +491,4 @@ class NsPanelLovelaceUI:
|
||||
sat = r
|
||||
hsv = (math.degrees(math.atan2(y, x))%360/360, sat, 1)
|
||||
rgb = self.hsv2rgb(hsv[0],hsv[1],hsv[2])
|
||||
return rgb
|
||||
return rgb
|
||||
|
||||
Reference in New Issue
Block a user