fix thermo None values

This commit is contained in:
joBr99
2022-03-27 22:23:55 +02:00
parent 0f393345aa
commit e5054a3317
3 changed files with 19 additions and 14 deletions

View File

@@ -42,3 +42,7 @@ def rgb_dec565(rgb_color):
# take in the red, green and blue values (0-255) as 8 bit values and then combine
# 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 get_attr_safe(entity, attr, default):
res = entity.attributes.get(attr, default) if not None else default
return res