limit chars for power on us-p

This commit is contained in:
joBr99
2023-02-01 23:14:30 +01:00
parent aab0f46b58
commit 7349a51194

View File

@@ -293,6 +293,13 @@ class LuiPagesGen(object):
device_class = entity.attributes.get("device_class", "")
unit_of_measurement = entity.attributes.get("unit_of_measurement", "")
value = entity.state
# limit value to 4 chars on us-p
if self._config.get("model") == "us-p":
value = entity.state[:4]
if value[-1] == ".":
value = value[:-1]
if device_class != "temperature":
value = value + " "
value = value + unit_of_measurement