joBr99 / nspanel-lovelace-ui

Custom Firmware for NsPanel with the design of HomeAssistant's lovelace UI in mind, works with Tasmota.
GNU General Public License v3.0
873 stars 189 forks source link

Rewrite of HomeAssistant Backend without AppDaemon #1058

Open joBr99 opened 10 months ago

joBr99 commented 10 months ago

This Issue is an (incomplete) list of stuff that is missing and not missing in the rewrite of the backend as homeassistant addon without appdaemon.

In case you want to try this version, do not expect anything this is pretty much an alpha version!

  1. Flash development TFT to your panel (only eu and us-l) see faq
  2. Add this repo to your repositories of the add-on store in homeassistant.
  3. Start the addon
  4. Open the folder /addon_configs/279653eb_nspanel-lovelace-ui/ in vscode, the config file is similarly structured than the old one.

Cards

Detail Pages

Misc

Actions

soyxan commented 10 months ago

Just one concern about the addon, what about the HA users which do not use HA OS (for instance, docker deployment) and therefore cannot install HA addons directly? Are you planning to maintain both de AppDaemon script and the HA addon? Are you planning to release an standalone dockerized version of your addon (in fact HA addons are docker containers)? Thanks!

joBr99 commented 10 months ago

you can just run the docker container and configure homeassistant/mqtt credentials manually in the configuration file

soyxan commented 10 months ago

Great! I suggest to add an specific section to the docs when you release the addon related to this standalone docker deployment configuration. Thanks a lot!

soyxan commented 10 months ago

BTW, I am willing to test, what would be the docker command and/or compose file to pull the docker image from your repository? Related to the configuration example you posted, what is expected to include in the nspanels parameter?

joBr99 commented 10 months ago

untested compose file:

version: "3.5"
services:
  nspanel-lovelace-ui-mqtt-manager:
    image: ghcr.io/jobr99/amd64-nspanel-lovelace-ui:latest
    volumes:
      - ./config:/config
    restart: unless-stopped

It should automatically place an example config file in ./config on the first startup.

add these lines to the start of the file

mqtt_server: "192.168.75.28"
mqtt_port: 1883
mqtt_username: "mqttuser"
mqtt_password: "xxx"
home_assistant_address: "http://192.168.75.28:8123"
home_assistant_token: "xxx"
soyxan commented 10 months ago

Reading the compose file I miss the HA connection settings (URL and TOKEN). Any way I tested the compose file you provided and I got the following errors in the container log:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
curl: (6) Could not resolve host: supervisor
[19:43:43] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
curl: (6) Could not resolve host: supervisor
[19:43:48] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service mqtt-manager: starting
s6-rc: info: service mqtt-manager successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
curl: (6) Could not resolve host: supervisor
[19:43:53] ERROR: Something went wrong contacting the API
INFO:root:Watching for changes in config file
Traceback (most recent call last):
  File "/usr/bin/mqtt-manager/main.py", line 220, in <module>
    connect()
  File "/usr/bin/mqtt-manager/main.py", line 121, in connect
    mqtt_port = int(settings["mqtt_port"])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
joBr99 commented 10 months ago

you need to add them to the config file

soyxan commented 10 months ago

what are the name of the parameters? home_assistant_addressand home_assistant_token?

joBr99 commented 10 months ago

yes, I've written the config parameters here:

https://github.com/joBr99/nspanel-lovelace-ui/issues/1058#issuecomment-1826151837

joBr99 commented 10 months ago

Also I don't now how the the MQTT envoniment variables behave. They could be required for the container to startup and it's also possible that they don't do anything. This is untested.

Please add all of the config like in my example. If you can test how the environment variables behave that would be useful. Only the config though the config file is tested.

soyxan commented 10 months ago

This is my compose file (my test MQTT server has no password):

version: "3.5"
services:
  nspanel-lovelace-ui-mqtt-manager:
    image: ghcr.io/jobr99/amd64-nspanel-lovelace-ui:latest
    environment:
      #- MQTT_USER="mqttuser"
      #- MQTT_PASS="mqttpass"
      - mqtt_server="192.168.0.10"
      - mqtt_port=1883
      - home_assistant_address="http://192.168.0.10:8123"
      - home_assistant_token="XXXXX"
    volumes:
      - /docker/stacks/tests/nspanel-lovelace-ui-mqtt-manager/config:/config
    restart: unless-stopped

And this is what is shown in the logs. At least now (after adding the HA url and token) the sample config file is created:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
curl: (6) Could not resolve host: supervisor
[19:56:15] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
curl: (6) Could not resolve host: supervisor
[19:56:20] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service mqtt-manager: starting
s6-rc: info: service mqtt-manager successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
curl: (6) Could not resolve host: supervisor
[19:56:25] ERROR: Something went wrong contacting the API
/config/panels.yaml exists.
INFO:root:Watching for changes in config file
Traceback (most recent call last):
  File "/usr/bin/mqtt-manager/main.py", line 220, in <module>
    connect()
  File "/usr/bin/mqtt-manager/main.py", line 121, in connect
    mqtt_port = int(settings["mqtt_port"])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
Exception in thread Thread-1 (config_watch):
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/threading.py", line 1052, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 989, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/bin/mqtt-manager/main.py", line 207, in config_watch
    observer.start()
  File "/usr/local/lib/python3.12/site-packages/watchdog/observers/api.py", line 263, in start
    super().start()
  File "/usr/local/lib/python3.12/site-packages/watchdog/utils/__init__.py", line 93, in start
    threading.Thread.start(self)
  File "/usr/local/lib/python3.12/threading.py", line 971, in start
    _start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown
[19:56:26] INFO: Service NsPanel Lovelace UI MQTT Manager exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service mqtt-manager: stopping
s6-rc: info: service mqtt-manager successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
curl: (6) Could not resolve host: supervisor
[19:56:35] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service mqtt-manager: starting
s6-rc: info: service mqtt-manager successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
/config/panels.yaml exists.
INFO:root:Watching for changes in config file
Traceback (most recent call last):
  File "/usr/bin/mqtt-manager/main.py", line 220, in <module>
    connect()
  File "/usr/bin/mqtt-manager/main.py", line 121, in connect
    mqtt_port = int(settings["mqtt_port"])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
joBr99 commented 10 months ago

no, please go to the config folder there should be a panels.yaml add the config there

soyxan commented 10 months ago

Ok, now I follow you.

This is my panel.yaml file now:

mqtt_server:"192.168.0.10"
mqtt_port:1883
home_assistant_address:"http://192.168.0.10:8123"
home_assistant_token:"XXXX"

nspanels:
  name_of_your_panel:
    panelRecvTopic: "tele/tasmota_topic/RESULT"
    panelSendTopic: "cmnd/tasmota_topic/CustomSend"
    timeFormat: "%H:%M"
    timeZone: "Europe/Berlin"
...

And now the log says:

Error while parsing YAML file:
  parser says
  in "/config/panels.yaml", line 6, column 9
  mapping values are not allowed here
Please correct data and retry.
joBr99 commented 10 months ago

you always need a : and a (space) between a key and a value in yaml

soyxan commented 10 months ago

Yes, sorry about that :)

Now according to the logs it seems to work, although there are 3 failed attempts after restarting the container and then the connection is established:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
curl: (6) Could not resolve host: supervisor
[20:14:54] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
curl: (6) Could not resolve host: supervisor
[20:14:59] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service mqtt-manager: starting
s6-rc: info: service mqtt-manager successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
curl: (6) Could not resolve host: supervisor
[20:15:04] ERROR: Something went wrong contacting the API
/config/panels.yaml exists.
INFO:root:Watching for changes in config file
INFO:root:Connecting to 192.168.0.10:1883 as NSPanelLovelaceManager_2485377957890
INFO:root:Connecting to Home Assistant at ws://192.168.0.10:8123/api/websocket
INFO:root:Connected to MQTT Server
INFO:root:WebSocket connection to Home Assistant opened.
INFO:root:Sending auth to Home Assistant
INFO:root:Home Assistant auth OK. Requesting existing states.
DEBUG:root:Sent Message to NsPanel (cmnd/tasmota_topic/CustomSend): pageType~pageStartup
DEBUG:root:Sent Message to NsPanel (cmnd/tasmota_topic/CustomSend): time~21:16~

I am open to do further tests if you need.

joBr99 commented 10 months ago

well, without a panel it's not going to do anything

soyxan commented 10 months ago

My next step is to add the config from my apps.yaml (AppDaemon) to the panel.yaml, shutdown AppDaemon and see if my panels work, but I will do it tomorrow :)

soyxan commented 10 months ago

I have adapted my configuration from AppDaemon to the new format (mainly removing the config: section):

mqtt_server: "192.168.0.10"
mqtt_port: 1883
home_assistant_address: "http://192.168.0.10:8123"
home_assistant_token: "XXXXXX"

nspanels:
  nspanel_salon:
    panelRecvTopic: "tele/tasmota_FA4CA8/RESULT"
    panelSendTopic: "cmnd/tasmota_FA4CA8/CustomSend"
    model: eu
    sleepTimeout: 20
    sleepBrightness:
      - time: "sunrise"
        value: 20
      - time: "sunset"
        value: 1
    sleepOverride:
      entity: light.luces_salon
      brightness: 10
    locale: "es_ES"
    screensaver:
      entities:
        - entity: weather.aemet_daily
          value: '{{states("sensor.ewelink_th01_a6451925_temperature")}} º'
        - entity: weather.aemet_daily
          type: 0
          value: "{{state_attr('weather.aemet_daily', 'forecast')[0].temperature|round(0)}}º/{{state_attr('weather.aemet_daily', 'forecast')[0].templow|round(0)}}º"
        - entity: weather.aemet_daily
          type: 1
          value: "{{state_attr('weather.aemet_daily', 'forecast')[1].temperature|round(0)}}º/{{state_attr('weather.aemet_daily', 'forecast')[1].templow|round(0)}}º"
        - entity: weather.aemet_daily
          type: 2
          value: "{{state_attr('weather.aemet_daily', 'forecast')[2].temperature|round(0)}}º/{{state_attr('weather.aemet_daily', 'forecast')[2].templow|round(0)}}º"
        - entity: delete
        - entity: sensor.nspanel_salon_thermostat_temperature
          value: '{{states("sensor.nspanel_salon_thermostat_temperature")}} º'
          icon: mdi:home-thermometer-outline
      theme:
        autoWeather: true
        bar: [0, 0, 0]
      statusIcon1:
        entity: sensor.pending_notifications
        color: "{{iif((states('sensor.pending_notifications')|int>0), '[255,0,0]', '[0,0,0]') }}"
        icon: "ha:{{iif((states('sensor.pending_notifications')|int>0), '<I>mdi:alarm-light</I>', '<I>mdi:alarm-light-off</I>') + states('sensor.pending_notifications')}}"
        altFont: True
      statusIcon2:
        entity: switch.nspanel_salon_switch1
        icon: "ha:{{iif(is_state('climate.termostato_salon', 'cool'), '<I>mdi:snowflake</I>', '<I>mdi:fire</I>') }}"
        altFont: True
    cards:
      - type: cardGrid
        title: Salón
        entities:
          - entity: light.shellyrgbw2_8075b9_channel_4
          - entity: light.tz3000_jl7qyupf_ts0012_095738d2_on_off
          - entity: switch.tz3000_cphmq0q7_ts011f_switch
            icon: mdi:pine-tree
          - entity: light.tz3000_jl7qyupf_ts0012_light
          - entity: light.tz3000_jl7qyupf_ts0012_light_3
          - entity: scene.peli
            icon: mdi:movie
      - type: cardGrid
        title: Cocina
        entities:
          - entity: light.tz3000_ypgri8yz_ts0013_ccc3c4aa_on_off
          - entity: light.tz3000_ypgri8yz_ts0013_ccc3c4aa_on_off_2
          - entity: light.tz3000_ypgri8yz_ts0013_ccc3c4aa_on_off_3
          - entity: cover.tz3000_1dd0d5yi_ts130f_cover
          - entity: automation.toldo_cocina_auto
            name: Toldo auto
            icon: mdi:refresh-auto
          - entity: automation.aviso_lavadora
            icon: mdi:washing-machine-alert
          - entity: scene.cena
            icon: mdi:pasta
      - type: cardGrid
        title: Terraza
        entities:
          - entity: light.tz3000_jl7qyupf_ts0012_4118771c_on_off
          - entity: light.tz3210_dbilpfqk_ts0501b_7c217494_level_light_color_on_off
      - type: cardThermo
        title: Clima
        entity: climate.termostato_salon
      - type: cardMedia
        entity: media_player.nest_mini

And I get the following error in the log:

INFO:root:Modification detected. Reloading panels.
INFO:root:Received signal 15. Initiating restart...
INFO:root:Watching for changes in config file
INFO:root:Connecting to 192.168.0.10:1883 as NSPanelLovelaceManager_2485377957890
INFO:root:Connecting to Home Assistant at ws://192.168.0.10:8123/api/websocket
INFO:root:Connected to MQTT Server
INFO:root:WebSocket connection to Home Assistant opened.
INFO:root:Sending auth to Home Assistant
INFO:root:Home Assistant auth OK. Requesting existing states.
DEBUG:root:Sent Message to NsPanel (cmnd/tasmota_FA4CA8/CustomSend): pageType~pageStartup
Exception in thread Thread-6 (panel_thread_target):
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/threading.py", line 1052, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 989, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/bin/mqtt-manager/main.py", line 177, in panel_thread_target
    panel.ha_event_callback(msg[1])
  File "/usr/bin/mqtt-manager/panel.py", line 140, in ha_event_callback
    involved_entities = ha_control.calculate_dim_values(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/mqtt-manager/ha_control.py", line 20, in calculate_dim_values
    elif libs.home_assistant.is_existent(sleepBrightness):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/mqtt-manager/libs/home_assistant.py", line 252, in is_existent
    if entity_id in home_assistant_entity_state_cache:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'list'
ERROR:scheduler:Unhandled exception `'timeFormat'` in `scheduler.Job(<JobType.MINUTELY: 2>, [datetime.time(0, 0)], <bound method LovelaceUIPanel.update_time of <panel.LovelaceUIPanel object at 0x7fdb1f533800>>, (), {}, 0, 1, True, datetime.datetime(2023, 11, 27, 9, 39, 32, 21758), None, False, None, None)`!
joBr99 commented 10 months ago

this isn't implemented so far, you have to use a static number or an entity name (use an input_number from home assistant or a template sensor)

    sleepBrightness:
      - time: "sunrise"
        value: 20
      - time: "sunset"
        value: 1

A template sensor would probably do the trick for you. (Config > Device & Servers > Helpers > Template / Template Sensor)

image

{{iif(is_state('sun.sun', 'above_horizon'), 20, 0, 0)}}

and then you can use your new sensor as a value for the brightness

sleepBrightness: sensor.nspanel_brightness

Note for all of the other templates in your config, it's required to start them with ha: now otherwise they won't get rendered as template.

soyxan commented 10 months ago

Ok, I think that with the tests done so far I am confident that I will be able to use your addon as an standalone docker container. The issues with my configuration yaml are not related to the docker deployment so I think I will wait till you fully release the new addon and do the migration.

Just a suggestion: Define the MQTT/HA variables not in the config yaml but in the docker compose file, similar to what is done with other addons, like AppDaemon for instance: https://appdaemon.readthedocs.io/en/latest/DOCKER_TUTORIAL.html#first-steps

freitas666 commented 10 months ago

Ok, I think that with the tests done so far I am confident that I will be able to use your addon as an standalone docker container. The issues with my configuration yaml are not related to the docker deployment so I think I will wait till you fully release the new addon and do the migration.

Just a suggestion: Define the MQTT/HA variables not in the config yaml but in the docker compose file, similar to what is done with other addons, like AppDaemon for instance: https://appdaemon.readthedocs.io/en/latest/DOCKER_TUTORIAL.html#first-steps

This works?

joBr99 commented 10 months ago

follow this in case you want to use a bare docker container, you currently need to configure everything in the config file

https://github.com/joBr99/nspanel-lovelace-ui/issues/1058#issuecomment-1826845292

Jaegerstefan commented 10 months ago

Addon works generally, but it seems to have an issue with binary sensors on the screensaver(2):

DEBUG:root:Recv Message from NsPanel (nspanelkellerbuero): event,renderCurrentPage
Exception in thread Thread-8 (panel_thread_target):
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/threading.py", line 1052, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.12/threading.py", line 989, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/bin/mqtt-manager/main.py", line 104, in panel_thread_target
    panel.customrecv_event_callback(msg[1])
  File "/usr/bin/mqtt-manager/panel.py", line 224, in customrecv_event_callback
    self.render_current_page(requested=True)
  File "/usr/bin/mqtt-manager/panel.py", line 170, in render_current_page
    self.current_card.render()
  File "/usr/bin/mqtt-manager/ha_cards.py", line 589, in render
    result += e.render(cardType=self.type)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/mqtt-manager/ha_cards.py", line 191, in render
    value = get_translation(self.locale, f"backend.component.binary_sensor.state.{device_class}.{entity.state}")
                                                                                                 ^^^^^^
NameError: name 'entity' is not defined. Did you mean: 'HAEntity'?
joBr99 commented 10 months ago

fixed, keep testing :)

Jaegerstefan commented 10 months ago

I can confirm the fix, works! Thanks for the fast response!

Another issue is the not working weather forecast.

    - entity: weather.home 
       type: 1 

No error logged but icon and temperature are zero.

joBr99 commented 10 months ago

Syntax changed, please have a look at the example config:

https://github.com/joBr99/nspanel-lovelace-ui/blob/main/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/panels.yaml.example

Jaegerstefan commented 10 months ago

Thank you, works with the new syntax!

Llntrvr commented 10 months ago

@joBr99 trying all of this out but looks like using the !include function is not supported. Is there a way to make that work

cards: !include cards.yaml hidenCards: !include hiddencards.yaml screensaver: !include screensaver.yaml

joBr99 commented 10 months ago

I don't know, didn't try so far. I'm using pyyaml to parse the file - need to check if appdaemon is doing something different.

However with the new addon you can configure hiddenCards on the top level and it will be passed though each panel. (Not sure if this is implemented for cards aswell)

nspanels:
  nsp1:
    panelRecvTopic: "tele/tasmota_nsp1/RESULT"
...
  nspanel-kbad:
    panelRecvTopic: "tele/nspbad_0C8C00/RESULT"
...

hiddenCards:
  - type: cardMedia
freitas666 commented 10 months ago

I don't know, didn't try so far. I'm using pyyaml to parse the file - need to check if appdaemon is doing something different.

However with the new addon you can configure hiddenCards on the top level and it will be passed though each panel. (Not sure if this is implemented for cards aswell)


nspanels:

  nsp1:

    panelRecvTopic: "tele/tasmota_nsp1/RESULT"

...

  nspanel-kbad:

    panelRecvTopic: "tele/nspbad_0C8C00/RESULT"

...

hiddenCards:

  - type: cardMedia

So.. its really necessary start appdaemon on docker? :( I dont know how to do this good... i tried sometimes but give up... Maybe could be a procedure in your website to help us :-)

joBr99 commented 10 months ago

I don't understand your question, this issue is about the rewrite of the addon without appdaemon, which isn't released yet.

Please see the documentation for the appdaemon backend:

https://docs.nspanel.pky.eu/stable/prepare_ha/#installing-appdaemon

freitas666 commented 10 months ago

Ah sorry... its because i am following some issues... I thought was about weather problem...etc...

joBr99 commented 10 months ago

If you have an issue, please open an issue and explain your issue including requested information in the issue template like your configuration and logs.

leacho73 commented 9 months ago

Not sure if I'm missing something in with trying to get the Development version running - I've re-flashed my panel using the Dev URL (http://nspanel.pky.eu/lui.tft) as per the FAQs - and I've installed the Add-On in the Add-On store - yet the panel will only update from my old AppDeamon apps.yaml, and not the new panels.yaml.

joBr99 commented 9 months ago

you need to disable the old appdaemon app and enable/start the new addon

leacho73 commented 9 months ago

you need to disable the old appdaemon app and enable/start the new addon

Spot on, thank you

jacekowski commented 9 months ago

Data on screensaver is incorrect, it looks like update_date is only called on startup and never called again.

joBr99 commented 9 months ago

That's not true, please post the log.

jacekowski commented 9 months ago

The only reference to update_date in new addon is in here https://github.com/joBr99/nspanel-lovelace-ui/blob/723ecde4cd2faf6d5f2666ba368e26205fa60f6b/apps/nspanel-lovelace-ui/luibackend/controller.py#L34

I think it could be a typo here as it looks like it should be update_date called every hour (like in the old addon)

https://github.com/joBr99/nspanel-lovelace-ui/blob/723ecde4cd2faf6d5f2666ba368e26205fa60f6b/nspanel-lovelace-ui/rootfs/usr/bin/mqtt-manager/panel.py#L70

joBr99 commented 9 months ago

you are right! didn't notice so far - fixed

sjampeter commented 9 months ago

in the new backend, i get the folowing error

image

joBr99 commented 9 months ago

Yep, they changed the name of the endpoint with the last release.

Jaegerstefan commented 9 months ago

Is there also a syntax change for navigation overrides? The example from https://docs.nspanel.pky.eu/stable/subpages/ does not work for me with the new backend.

joBr99 commented 9 months ago

No, should work - only the old way with navigate.cardType_key does no longer work.

leacho73 commented 9 months ago

is there any difference when showing daily weather forecasts vs hourly? I've just tried to display the next 6 hours forecast using the example linked above:

entities:

I've tried both 'day: #' and 'type: #' but I just get the same forecast repeated for each entry. Attributes for both the daily and hourly forecasts are the same when I check Dev Tools in HA - wondering if its an issue with the date being the same, as daily forecasts work ok.

joBr99 commented 9 months ago

not documented so far, thy this:

      entities:
        - entity: weather.k3ll3r
          attr: temperature
        - entity: weather.k3ll3r
          hour: 1
        - entity: weather.k3ll3r
          hour: 2
        - entity: weather.k3ll3r
          hour: 3
leacho73 commented 9 months ago

not documented so far, thy this:

      entities:
        - entity: weather.k3ll3r
          attr: temperature
        - entity: weather.k3ll3r
          hour: 1
        - entity: weather.k3ll3r
          hour: 2
        - entity: weather.k3ll3r
          hour: 3

Once again, spot on, thank you - Happy New Year and thanks for all your help with this amazing add-on!

Grrzzz commented 9 months ago

Hi!

I am getting the following error when starting my container: ` AttributeError: 'datetime.date' object has no attribute 'microsecond' DEBUG:root:Recv Message from NsPanel (nspanel-dach): event,startup,53,eu Exception in thread Thread-10 (panel_thread_target): Traceback (most recent call last): File "/usr/local/lib/python3.12/threading.py", line 1052, in _bootstrap_inner self.run() File "/usr/local/lib/python3.12/threading.py", line 989, in run self._target(*self._args, **self._kwargs) File "/usr/bin/mqtt-manager/main.py", line 104, in panel_thread_target panel.customrecv_event_callback(msg[1]) File "/usr/bin/mqtt-manager/panel.py", line 210, in customrecv_event_callback self.update_date() File "/usr/bin/mqtt-manager/panel.py", line 119, in update_date date_string = babel.dates.format_date( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/babel/dates.py", line 685, in format_date return pattern.apply(date, locale) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/babel/dates.py", line 1318, in apply return self % DateTimeFormat(datetime, locale, reference_date)


  File "/usr/local/lib/python3.12/site-packages/babel/dates.py", line 1310, in __mod__
    return self.format % other
           ~~~~~~~~~~~~^~~~~~~
  File "/usr/local/lib/python3.12/site-packages/babel/dates.py", line 1380, in __getitem__
    return self.format_milliseconds_in_day(num)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/babel/dates.py", line 1547, in format_milliseconds_in_day
    msecs = self.value.microsecond // 1000 + self.value.second * 1000 + \
            ^^^^^^^^^^^^^^^^^^^^^^
`

Consequently my panel is stuck in "Getting data". 
joBr99 commented 9 months ago

looks like there is something wrong with the date format you've configured - note that you have to use the notation from babel for the date in the new backend.

https://babel.pocoo.org/en/latest/dates.html

Grrzzz commented 9 months ago

Thank you! That was it. Perfect!