mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-20 05:04:44 +01:00
Update helper.py
This commit is contained in:
@@ -40,9 +40,7 @@ def rgb_dec565(rgb_color):
|
|||||||
red = rgb_color[0]
|
red = rgb_color[0]
|
||||||
green = rgb_color[1]
|
green = rgb_color[1]
|
||||||
blue = rgb_color[2]
|
blue = rgb_color[2]
|
||||||
# take in the red, green and blue values (0-255) as 8 bit values and then combine
|
return ((int(red >> 3) << 11) | (int(green >> 2) << 5) | (int(blue >> 3)))
|
||||||
# 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(temp, unit):
|
def convert_temperature(temp, unit):
|
||||||
if unit == "fahrenheit":
|
if unit == "fahrenheit":
|
||||||
@@ -55,4 +53,4 @@ def get_attr_safe(entity, attr, default):
|
|||||||
res = entity.attributes.get(attr, default)
|
res = entity.attributes.get(attr, default)
|
||||||
if res is None:
|
if res is None:
|
||||||
res = default
|
res = default
|
||||||
return res
|
return res
|
||||||
|
|||||||
Reference in New Issue
Block a user