mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-24 02:02:15 +01:00
implemented conversion of temperature
This commit is contained in:
@@ -43,6 +43,13 @@ def rgb_dec565(rgb_color):
|
||||
# and shift them to make them a 16 bit dec value in 565 format.
|
||||
return ((int(red / 255 * 31) << 11) | (int(green / 255 * 63) << 5) | (int(blue / 255 * 31)))
|
||||
|
||||
def convert_temperature_from_celsius(c, unit):
|
||||
if unit == "celsius":
|
||||
temp = (c * 1.8) + 32
|
||||
return f"{temp}°F"
|
||||
else:
|
||||
return f"{temp}°C"
|
||||
|
||||
def get_attr_safe(entity, attr, default):
|
||||
res = entity.attributes.get(attr, default)
|
||||
if res is None:
|
||||
|
||||
Reference in New Issue
Block a user