arthurdent75 / SimpleScheduler

An Home Assistant AddOn to schedule entities on/off on weekly base
183 stars 36 forks source link

Addon does not start - "example 2 crashed, halting add-on" #128

Closed amrit-venkatesh closed 1 year ago

amrit-venkatesh commented 1 year ago

My first ever issue submission on GitHub, apologies if there are expected additions/information that I've missed so please let me know. I'm facing the following error when running this addon on a new installation of Home Assistant.

The addon installs successfully but does not start. Clicking WebUI button gives a blank screen with this error: "502: Bad Gateway" Selecting the Configuration tab gives this message: "This add-on has no configuration."

Logs:


[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Simple Scheduler
 Simple timer on weekly base
-----------------------------------------------------------
 Add-on version: 2.11
 You are running the latest version of this add-on.
 System: Home Assistant OS 10.1  (amd64 / qemux86-64)
 Home Assistant Core: 2023.5.1
 Home Assistant Supervisor: 2023.04.1
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[18:30:44] INFO: Starting service.d [Scheduler]
[18:30:44] INFO: Starting service.d [Interface]
[18:30:44] INFO: Running scheduler.sh
[18:30:44] INFO: Running interface.sh
[2023-05-06 18:30:45] STATUS: Starting main program
Traceback (most recent call last):
  File "/simplescheduler/main.py", line 793, in <module>
    if options['MQTT']['enabled']:
KeyError: 'MQTT'
[18:30:48] WARNING: example 2 crashed, halting add-on
./finish: line 7: /run/s6/basedir/bin/halt: No such file or directory
[18:30:48] INFO: Starting service.d [Interface]
[18:30:48] INFO: Running interface.sh
[2023-05-06 18:30:49] STATUS: Starting main program
Traceback (most recent call last):
  File "/simplescheduler/main.py", line 793, in <module>
    if options['MQTT']['enabled']:
KeyError: 'MQTT'`

The lines from "WARNING: example 2 crashed..." to "KeyError: 'MQTT'" repeats indefinitely. 

Have attempted restarting and rebuilding the addon to no avail. 
amrit-venkatesh commented 1 year ago

I have another instance of Home Assistant where I've been using your addon for years and where I just updated from v0.3 to 2.11 and I'm facing the same issue there too.

arthurdent75 commented 1 year ago

Have you tried restarting the whole Home Assistant?

amrit-venkatesh commented 1 year ago

Yes I have restarted the Home Assistant server entirely, as well as the host machine that it's running on, and this issue it still persists.

Here's some more information/background that points to something weirder...

  1. This Home Assistant is part of my exercise to migrate Home Assistant from a different host.
  2. My old Home Assistant had v0.3 of your addon running for over a year, and it was running OK.
  3. To migrate things over to this new host I installed Home Assistant afresh on the new host and restored a back up of Home Assistant (including addons) from my old host.
  4. On the new host, even though I can't access the webUI, it looks like schedules previously configured are working. E.g. I had my geysers set to switch on/off on a schedule and they're getting triggered! I just don't have a way to edit them now. I have (obviously) tested this after switching off the old host.
  5. I upgraded the addon on my old HA host from v0.3 to v2.11 and I got the issue there too (which is my previous comment on this thread). While this point is related, I'm not bothered about a resolution on the old host as that's slated to be wiped clean. Penning this here for information.
arthurdent75 commented 1 year ago

Try this:

  1. backup the /share/simplescheduler folder somewhere on your PC
  2. uninstall the addon
  3. delete all the files from the folder (you can leave the empty folder)
  4. install the addon and start it

Verify if you are able to open the front end. Should be empty. That's normal.

If the frontend loads, you can restore the schedulers: copy ONLY the JSON files from the backup to the /share/simplescheduler folder and restart the addon.

amrit-venkatesh commented 1 year ago

Worked like a charm! Thank you so much! I was wondering how one can go about reinstalling the addon without losing existing schedules and this is it.

Just one question though. The 'Configuration' tab of this addon is still empty with a message - "This add-on has no configuration". Is that normal? I recall the old v0.3 had definitions for days of the week or thereabouts.