mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-21 05:34:45 +01:00
implements #259
This commit is contained in:
@@ -287,15 +287,19 @@ class LuiPagesGen(object):
|
|||||||
icon_id = get_icon_id_ha(entityType, state=entity.state, overwrite=icon)
|
icon_id = get_icon_id_ha(entityType, state=entity.state, overwrite=icon)
|
||||||
return f"~fan~{entityId}~{icon_id}~{icon_color}~{name}~{switch_val}"
|
return f"~fan~{entityId}~{icon_id}~{icon_color}~{name}~{switch_val}"
|
||||||
if entityType in ["sensor", "binary_sensor"]:
|
if entityType in ["sensor", "binary_sensor"]:
|
||||||
device_class = entity.attributes.get("device_class", "")
|
device_class = entity.attributes.get("device_class", "_")
|
||||||
unit_of_measurement = entity.attributes.get("unit_of_measurement", "")
|
if entityType == "sensor":
|
||||||
value = entity.state + " " + unit_of_measurement
|
unit_of_measurement = entity.attributes.get("unit_of_measurement", "")
|
||||||
|
value = entity.state + " " + unit_of_measurement
|
||||||
|
if entityType == "binary_sensor":
|
||||||
|
value = get_translation(self._locale, f"backend.component.binary_sensor.state.{device_class}.{entity.state}")
|
||||||
if cardType == "cardGrid" and entityType == "sensor":
|
if cardType == "cardGrid" and entityType == "sensor":
|
||||||
icon_id = entity.state[:4]
|
icon_id = entity.state[:4]
|
||||||
if icon_id[-1] == ".":
|
if icon_id[-1] == ".":
|
||||||
icon_id = icon_id[:-1]
|
icon_id = icon_id[:-1]
|
||||||
else:
|
else:
|
||||||
icon_id = get_icon_id_ha("sensor", state=entity.state, device_class=device_class, overwrite=icon)
|
icon_id = get_icon_id_ha("sensor", state=entity.state, device_class=device_class, overwrite=icon)
|
||||||
|
|
||||||
icon_color = self.get_entity_color(entity, overwrite=colorOverride)
|
icon_color = self.get_entity_color(entity, overwrite=colorOverride)
|
||||||
return f"~text~{entityId}~{icon_id}~{icon_color}~{name}~{value}"
|
return f"~text~{entityId}~{icon_id}~{icon_color}~{name}~{value}"
|
||||||
if entityType in ["button", "input_button"]:
|
if entityType in ["button", "input_button"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user