removed fahrenheit conversion

This commit is contained in:
Johannes
2022-04-01 20:53:36 +02:00
parent 64b3f45705
commit 9fe9f6b5cc
3 changed files with 8 additions and 7 deletions

View File

@@ -43,12 +43,12 @@ def rgb_dec565(rgb_color):
# and shift them to make them a 16 bit dec value in 565 format. # 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))) return ((int(red / 255 * 31) << 11) | (int(green / 255 * 63) << 5) | (int(blue / 255 * 31)))
def convert_temperature_from_celsius(c, unit): def convert_temperature(temp, unit):
if unit == "fahrenheit": if unit == "fahrenheit":
temp = round(((c * 1.8) + 32), 1) #temp = round(((c * 1.8) + 32), 1)
return f"{temp}°F" return f"{temp}°F"
else: else:
return f"{c}°C" return f"{temp}°C"
def get_attr_safe(entity, attr, default): def get_attr_safe(entity, attr, default):
res = entity.attributes.get(attr, default) res = entity.attributes.get(attr, default)

View File

@@ -3,7 +3,7 @@ import datetime
from icon_mapping import get_icon_id from icon_mapping import get_icon_id
from icons import get_icon_id_ha from icons import get_icon_id_ha
from helper import scale, rgb_dec565, rgb_brightness, get_attr_safe, convert_temperature_from_celsius from helper import scale, rgb_dec565, rgb_brightness, get_attr_safe, convert_temperature
from localization import get_translation from localization import get_translation
# check Babel # check Babel
@@ -71,7 +71,7 @@ class LuiPagesGen(object):
return return
icon_cur = get_icon_id_ha("weather", state=we.state) icon_cur = get_icon_id_ha("weather", state=we.state)
text_cur = convert_temperature_from_celsius(we.attributes.temperature, unit) text_cur = convert_temperature(we.attributes.temperature, unit)
weather_res = "" weather_res = ""
for i in range(1,5): for i in range(1,5):
@@ -84,7 +84,7 @@ class LuiPagesGen(object):
else: else:
up = up.strftime("%a") up = up.strftime("%a")
icon = get_icon_id_ha("weather", state=we.attributes.forecast[i-1]['condition']) icon = get_icon_id_ha("weather", state=we.attributes.forecast[i-1]['condition'])
down = convert_temperature_from_celsius(we.attributes.forecast[i-1]['temperature'], unit) down = convert_temperature(we.attributes.forecast[i-1]['temperature'], unit)
else: else:
LOGGER.info(f"Forecast {i} is overriden with {wOF}") LOGGER.info(f"Forecast {i} is overriden with {wOF}")
icon = None icon = None

View File

@@ -36,6 +36,7 @@ class Updater:
def send_message_page(self, id, heading, msg, b1, b2): def send_message_page(self, id, heading, msg, b1, b2):
self._send_mqtt_msg(f"pageType,popupNotify") self._send_mqtt_msg(f"pageType,popupNotify")
self._send_mqtt_msg(f"entityUpdateDetail~{id}~{heading}~65535~{b1}~65535~{b2}~65535~{msg}~65535~0") self._send_mqtt_msg(f"entityUpdateDetail~{id}~{heading}~65535~{b1}~65535~{b2}~65535~{msg}~65535~0")
self._send_mqtt_msg(f"entityUpdateDetail,|{id}|{heading}|65535|{b1}|65535|{b2}|65535|{msg}|65535|0")
def check_updates(self): def check_updates(self):
# return's true if a notification was send to the panel # return's true if a notification was send to the panel