mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2026-02-27 08:02:14 +01:00
start reworking navigation paramters (#644)
* modify cardGrid/cardEntities nav * rework backend nav for new style * fix some bugs * update other pages with new nav paramters * readd readme part
This commit is contained in:
@@ -5,43 +5,44 @@ from luibackend.controller import LuiController
|
||||
from luibackend.mqtt import LuiMqttListener, LuiMqttSender
|
||||
from luibackend.updater import Updater
|
||||
|
||||
import apis
|
||||
|
||||
class NsPanelLovelaceUIManager(hass.Hass):
|
||||
|
||||
def initialize(self):
|
||||
self.log('Starting')
|
||||
mqtt_api = self._mqtt_api = self.get_plugin_api("MQTT")
|
||||
apis.ha_api = self
|
||||
apis.mqtt_api = self.get_plugin_api("MQTT")
|
||||
|
||||
cfg = self._cfg = LuiBackendConfig(self, self.args["config"])
|
||||
|
||||
topic_send = cfg.get("panelSendTopic")
|
||||
mqttsend = LuiMqttSender(self, mqtt_api, topic_send)
|
||||
topic_recv = cfg.get("panelRecvTopic")
|
||||
|
||||
mqttsend = LuiMqttSender(self, topic_send)
|
||||
|
||||
# Request Tasmota Driver Version
|
||||
mqtt_api.mqtt_publish(topic_send.replace("CustomSend", "GetDriverVersion"), "x")
|
||||
apis.mqtt_api.mqtt_publish(topic_send.replace("CustomSend", "GetDriverVersion"), "x")
|
||||
|
||||
controller = LuiController(cfg, mqttsend.send_mqtt_msg)
|
||||
|
||||
desired_tasmota_driver_version = 8
|
||||
desired_display_firmware_version = 46
|
||||
version = "v3.7.0"
|
||||
|
||||
model = cfg.get("model")
|
||||
if model == "us-l":
|
||||
# us landscape version
|
||||
desired_display_firmware_url = f"http://nspanel.pky.eu/lovelace-ui/github/nspanel-us-l-{version}.tft"
|
||||
elif model == "us-p":
|
||||
# us portrait version
|
||||
desired_display_firmware_url = f"http://nspanel.pky.eu/lovelace-ui/github/nspanel-us-p-{version}.tft"
|
||||
else:
|
||||
# eu version
|
||||
desired_display_firmware_url = f"http://nspanel.pky.eu/lovelace-ui/github/nspanel-{version}.tft"
|
||||
|
||||
desired_tasmota_driver_version = 8
|
||||
match model:
|
||||
case "us-l":
|
||||
desired_display_firmware_url = f"http://nspanel.pky.eu/lovelace-ui/github/nspanel-us-l-{version}.tft"
|
||||
case "us-p":
|
||||
desired_display_firmware_url = f"http://nspanel.pky.eu/lovelace-ui/github/nspanel-us-p-{version}.tft"
|
||||
case _:
|
||||
desired_display_firmware_url = f"http://nspanel.pky.eu/lovelace-ui/github/nspanel-{version}.tft"
|
||||
desired_tasmota_driver_url = "https://raw.githubusercontent.com/joBr99/nspanel-lovelace-ui/main/tasmota/autoexec.be"
|
||||
|
||||
|
||||
mode = cfg.get("updateMode")
|
||||
topic_send = cfg.get("panelSendTopic")
|
||||
updater = Updater(self.log, mqttsend.send_mqtt_msg, topic_send, mode, desired_display_firmware_version, model, desired_display_firmware_url, desired_tasmota_driver_version, desired_tasmota_driver_url)
|
||||
|
||||
topic_recv = cfg.get("panelRecvTopic")
|
||||
LuiMqttListener(mqtt_api, topic_recv, controller, updater)
|
||||
LuiMqttListener(topic_recv, controller, updater)
|
||||
|
||||
self.log('Started')
|
||||
|
||||
Reference in New Issue
Block a user