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
863 stars 187 forks source link

Issues with AppDaemon 15 #1028

Closed robje closed 9 months ago

robje commented 9 months ago

PROBLEM DESCRIPTION

After upgrading AppDaemon (to 0.15.0 then 0.15.1 and finaly 0.15.2) nspanel-lovelace-ui fails to start properly.

in AppDaemon wui the state of NsPanelLovelaceUIManager is initialize_error

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!


kantoor_controllerx: module: controllerx class: HG06323LightController integration: z2m controller: sensor.kantoor_spots_afstandsbediening_action light: light.bureau_lamp

bedlamp_robje_controllerx: module: controllerx class: E2002LightController integration: z2m controller: sensor.bedlamp_robje_knop_action light: light.bedlamp_robje

bedlamp_francine_controllerx: module: controllerx class: E2002LightController integration: z2m controller: sensor.bedlamp_francine_knop_action light: light.bedlamp_francine

nsp01: module: nspanel-lovelace-ui class: NsPanelLovelaceUIManager config: panelRecvTopic: tele/nsp01/RESULT panelSendTopic: cmnd/nsp01/CustomSend model: eu locale: nl_NL screensaver: type: screensaver entities:

- [x] Go to Settings>Add-ons>AppDaemon>Log (or the output of your TS script) and then, provide the output of the log during your issue/bug occurs:

relevant log output:

2023-11-15 14:53:30.883813 WARNING nsp01: ------------------------------------------------------------ 2023-11-15 14:53:30.885295 WARNING nsp01: Unexpected error running initialize() for nsp01 2023-11-15 14:53:30.886526 WARNING nsp01: ------------------------------------------------------------ 2023-11-15 14:53:30.894033 WARNING nsp01: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 162, in initialize_app await utils.run_in_executor(self, init) File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 304, in run_in_executor response = future.result() ^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/apps/nspanel-lovelace-ui/nspanel-lovelace-ui.py", line 25, in initialize apis.mqtt_api.mqtt_publish(topic_send.replace("CustomSend", "GetDriverVersion"), "x") ^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'mqtt_publish'

2023-11-15 14:53:30.895261 WARNING nsp01: ------------------------------------------------------------



### TO REPRODUCE
_Steps to reproduce the behavior:_

Haven't reproduced. Probably upgrading AppDaemon to 0.15.2.

### EXPECTED BEHAVIOUR
_A clear and concise description of what you expected to happen._

nspanel-lovelace-ui loading and properly initializing

### SCREENSHOTS
_If applicable, add screenshots/pictures to help explain your problem._

### ADDITIONAL CONTEXT
_Add any other context about the problem here._
_Please note here in case you are using ioBroker_

### PANEL / FIRMWARE VERION
_Please add the Panel/Firmware Version you are using (EU, US-L or US-P)_
joBr99 commented 9 months ago

Did you pay attention to the release notes of the Update?

image

I didn't upgrade my AppDaemon Version yet so idk but I guess this is going to cause issues with HACS too.

randybb commented 9 months ago
joBr99 commented 9 months ago

I just did the upgrade and now it's entirely broken, still investigating but it looks like even my config is gone ... lol

Najihel commented 9 months ago

I just did the upgrade and now it's entirely broken, still investigating but it looks like even my config is gone ... lol

Same issue here, I restored the entire folder and downgrade to previous appdaemon version to recover

joBr99 commented 9 months ago

So in my case updating from 14.0 to 15.2 breaks appdaemon entirely:

[17:07:54] INFO: Starting AppDaemon...
s6-rc: info: service legacy-services successfully started
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/__main__.py", line 417, in main
ERROR Error loading secrets file: /config/secrets.yaml
    admain.main()
  File "/usr/lib/python3.11/site-packages/appdaemon/__main__.py", line 276, in main
    if "appdaemon" not in config:
       ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable
[17:07:55] INFO: Service AppDaemon exited with code 1 (by signal 0)

config/appdaemon is empty afterwards - it looks like the files have been moved to /addon_configs/a0d7b954_appdaemon/ (which you can acually open in the vscode addon)

To solve the error above I needed to change the line with the secrets (Even though I'm not using it so I could remove it aswell lol)

#secrets: /config/secrets.yaml
secrets: /homeassistant/secrets.yaml

Next issue that I got is related to the config files that I've included from apps.yaml.

    #hiddenCards: !include /config/appdaemon/apps/hiddenCards.yaml
    hiddenCards: !include /config/apps/hiddenCards.yaml
robje commented 9 months ago

If I recall correctly my config was moved to /addon_configs/a0d7b954_appdaemon/

Did you pay attention to the release notes of the Update?

I did not read all changelogs, except for 0.15.2

Critycal1 commented 9 months ago

So in my case updating from 14.0 to 15.2 breaks appdaemon entirely

Same here. I'm using AppDaemon only for NSPanel Lovelace UI, this is the literal only reason it exists on my HA server. The issue in the AppDaemon Github doesn't seem to be fully solved at the moment, I'll patiently wait for a guide here.

joBr99 commented 9 months ago

Ok, after I fixed the issue with my secrets files (and the config files I included) - everything is working fine.

@robje

AttributeError: 'NoneType' object has no attribute 'mqtt_publish'

This is happening if mqtt initialization doesn't work - so please check what your appdaemon addon is logging after restarting it. Maybe your mqtt password is no longer working, because it was in the secrets file or something like that.

joBr99 commented 9 months ago

@Critycal1 For the most people this is probably fixing it, because it's preventing appdaemon from starting up.

If you have this in your appdaemon.yaml file:

secrets: /config/secrets.yaml You will need to adjust this to:

secrets: /homeassistant/secrets.yaml

robje commented 9 months ago
AttributeError: 'NoneType' object has no attribute 'mqtt_publish'

This is happening if mqtt initialization doesn't work - so please check what your appdaemon addon is logging after restarting it. Maybe your mqtt password is no longer working, because it was in the secrets file or something like that.

at least one of the controllerx instances is working fine. I guess this means passwords are read.

secrets: /homeassistant/secrets.yaml

is in my /addon_configs/a0d7b954_appdaemon/appdaemon.yaml

Critycal1 commented 9 months ago

Thanks for the suggestion, but I'm in the same boat as the guys who have a complete empty AppDaemon folder. (/homeassistant/appdaemon/ was filled before). How would I start fixing this? Sorry for the inconvenience.

I have the exact same log output as you here:

[17:07:54] INFO: Starting AppDaemon... s6-rc: info: service legacy-services successfully started Traceback (most recent call last): File "/usr/bin/appdaemon", line 8, in sys.exit(main()) ^^^^^^ File "/usr/lib/python3.11/site-packages/appdaemon/main.py", line 417, in main ERROR Error loading secrets file: /config/secrets.yaml admain.main() File "/usr/lib/python3.11/site-packages/appdaemon/main.py", line 276, in main if "appdaemon" not in config: ^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: argument of type 'NoneType' is not iterable [17:07:55] INFO: Service AppDaemon exited with code 1 (by signal 0)

Edit:

Just saw your reply. I think my main problem is to find the new appdaemon.yaml and to access it. I have vscode installed, but the top level folder I can access seems to be only /homeassistant/ like in the usual file editor that ships with HA.

joBr99 commented 9 months ago

image image

Critycal1 commented 9 months ago

Thank you so much, this helped. I can confirm after accessing the folder you linked above and changed this:

@Critycal1 For the most people this is probably fixing it, because it's preventing appdaemon from starting up.

If you have this in your appdaemon.yaml file: secrets: /config/secrets.yaml You will need to adjust this to: secrets: /homeassistant/secrets.yaml

It works again without any problem.

joBr99 commented 9 months ago

So as HACS isn't able to access to the folder this is the workaround to still use the application from HACS in the home assistant folder:

rm -rf /config/apps/apps-from-hacs && cp -R /homeassistant/appdaemon/apps/ /config/apps/apps-from-hacs/

image

This will do the following things on every startup of the appdaemon container

  1. delete the folder /config/apps/apps-from-hacs
  2. copy /homeassistant/appdaemon/apps/ into /config/apps/apps-from-hacs/

You may need to delete the nspanel-lovelace-ui folder directly below /config/apps/ afterwards.

joBr99 commented 9 months ago

So summarized it in a new issue:

https://github.com/joBr99/nspanel-lovelace-ui/issues/1029

@robje Going to close this one, however if you still have issues with MQTT comment here.

joBr99 commented 9 months ago

okay found an even simpler solution see #1029

robje commented 9 months ago

MQTT: was gone from the moved appdaemon.yaml and I didn't spot it right away. After adding MQTT: section back things work as expected. Sorry for the not being sharp.

janprive commented 9 months ago

So in my case updating from 14.0 to 15.2 breaks appdaemon entirely:

[17:07:54] INFO: Starting AppDaemon...
s6-rc: info: service legacy-services successfully started
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/__main__.py", line 417, in main
ERROR Error loading secrets file: /config/secrets.yaml
    admain.main()
  File "/usr/lib/python3.11/site-packages/appdaemon/__main__.py", line 276, in main
    if "appdaemon" not in config:
       ^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable
[17:07:55] INFO: Service AppDaemon exited with code 1 (by signal 0)

config/appdaemon is empty afterwards - it looks like the files have been moved to /addon_configs/a0d7b954_appdaemon/ (which you can acually open in the vscode addon)

To solve the error above I needed to change the line with the secrets (Even though I'm not using it so I could remove it aswell lol)

#secrets: /config/secrets.yaml
secrets: /homeassistant/secrets.yaml

Next issue that I got is related to the config files that I've included from apps.yaml.

    #hiddenCards: !include /config/appdaemon/apps/hiddenCards.yaml
    hiddenCards: !include /config/apps/hiddenCards.yaml

This finally did the trick! All seems to work now… Thank you all for your work!!!