mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-23 07:54:25 +01:00
removed fahrenheit conversion
This commit is contained in:
@@ -43,12 +43,12 @@ 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):
|
||||
def convert_temperature(temp, unit):
|
||||
if unit == "fahrenheit":
|
||||
temp = round(((c * 1.8) + 32), 1)
|
||||
#temp = round(((c * 1.8) + 32), 1)
|
||||
return f"{temp}°F"
|
||||
else:
|
||||
return f"{c}°C"
|
||||
return f"{temp}°C"
|
||||
|
||||
def get_attr_safe(entity, attr, default):
|
||||
res = entity.attributes.get(attr, default)
|
||||
|
||||
@@ -3,7 +3,7 @@ import datetime
|
||||
|
||||
from icon_mapping import get_icon_id
|
||||
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
|
||||
|
||||
# check Babel
|
||||
@@ -71,7 +71,7 @@ class LuiPagesGen(object):
|
||||
return
|
||||
|
||||
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 = ""
|
||||
for i in range(1,5):
|
||||
@@ -84,7 +84,7 @@ class LuiPagesGen(object):
|
||||
else:
|
||||
up = up.strftime("%a")
|
||||
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:
|
||||
LOGGER.info(f"Forecast {i} is overriden with {wOF}")
|
||||
icon = None
|
||||
|
||||
@@ -36,6 +36,7 @@ class Updater:
|
||||
def send_message_page(self, id, heading, msg, b1, b2):
|
||||
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")
|
||||
|
||||
def check_updates(self):
|
||||
# return's true if a notification was send to the panel
|
||||
|
||||
Reference in New Issue
Block a user