Closed jmsuomal closed 5 months ago
My guess what is happening because I don't have MQTT server installed. Thus I don't have "MQTT enabled" parameter set. This causes the code to crash.
It is very unlikely. Every time I publish a new release, I deploy (and run) the addon on a HA fresh installation with nothing else in it.
The real (inexplicable) issue here is that the MQTT key in the configuration file is missing. But in a fresh install, the configuration file is created from a template. And the key is in the template.
Please try the following: (you should have "SAMBA" addon installed)
Thank you for fast reply! This problem is probably then related to the fact that I have not done a clean install but I have updated from version 0.35 -> 2.5.
As you suggested, I did the following:
/share/simplescheduler
->/share/simplescheduler_backup
On the first start, the Line 882 in main.py (os.makedirs()
) gave "FileExistsError: /share/simplescheduler". Strangely this should not happen as on the line above it there is a test for folder existence, but still this error came up. Are there multiple threads running, so that both of them would attempt to create the folder simultaneusly?
Anyway, the add-on seems to work for me now. However, I am not certain if all files were created to the /share/simplescheduler/
as expected. In the old folder I renamed, there were all these files:
2023-12-11 18.35 161 6224953416e42.json
2023-10-30 23.32 154 62249599b0204.json
2023-12-11 18.37 163 62249643701d3.json
2023-10-30 23.33 176 62249692b14b4.json
2023-10-28 20.46 154 623b60989b4ab.json
2023-12-11 18.36 161 62437caf096cf.json
2024-04-02 22.20 681 options.dat
2024-04-01 00.00 635 235 scheduler.log
2024-04-02 22.21 1 933 680 simplescheduler.log
2024-04-01 00.28 351 sun.dat
While the new folder was created with only single file simplescheduler.log
in it. Most remarkably there is no options.dat
file there at all, which I would assume should have been created. Should the sun.dat
also still be there? Maybe that "FileExistsError" interrupted the file creation process?
I re-read your instructions and noticed that you instructed to remove files in folder /share/simplescheduler
instead of removing the folder. I did the reinstallation again but this removed the files instead of folder. Resulting folder content is still exactly the same with single log file, but now there was no crash on first start.
However, I during this installation I noticed that after very long time the Home Assistant web page gave pop-up "Installation failed, see supervisor logs for details". This may have happened also last time, but I may not have noticed it. This popup is strange as the add-on seems to be successfully installed and the supervisor log does not show any problems:
2024-04-03 11:14:03.212 INFO (MainThread) [supervisor.addons.addon] Creating Home Assistant add-on data folder /data/addons/data/00185a40_simplescheduler
2024-04-03 11:14:03.234 INFO (MainThread) [supervisor.docker.addon] Starting build for 00185a40/aarch64-addon-simplescheduler:2.5
2024-04-03 11:21:55.639 INFO (MainThread) [supervisor.resolution.check] Starting system checks with state running
2024-04-03 11:21:55.641 INFO (MainThread) [supervisor.resolution.checks.base] Run check for dns_server_failed/dns_server
2024-04-03 11:21:56.085 INFO (MainThread) [supervisor.resolution.checks.base] Run check for trust/supervisor
2024-04-03 11:21:56.167 INFO (MainThread) [supervisor.resolution.checks.base] Run check for security/core
2024-04-03 11:21:56.171 INFO (MainThread) [supervisor.resolution.checks.base] Run check for docker_config/system
2024-04-03 11:21:56.176 INFO (MainThread) [supervisor.resolution.checks.base] Run check for ipv4_connection_problem/system
2024-04-03 11:21:56.179 INFO (MainThread) [supervisor.resolution.checks.base] Run check for dns_server_ipv6_error/dns_server
2024-04-03 11:21:56.184 INFO (MainThread) [supervisor.resolution.checks.base] Run check for multiple_data_disks/system
2024-04-03 11:21:56.187 INFO (MainThread) [supervisor.resolution.checks.base] Run check for pwned/addon
2024-04-03 11:21:56.193 INFO (MainThread) [supervisor.resolution.checks.base] Run check for free_space/system
2024-04-03 11:21:56.196 INFO (MainThread) [supervisor.resolution.check] System checks complete
2024-04-03 11:21:56.198 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state running
2024-04-03 11:21:58.997 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
2024-04-03 11:21:58.000 INFO (MainThread) [supervisor.resolution.fixup] Starting system autofix at state running
2024-04-03 11:21:58.002 INFO (MainThread) [supervisor.resolution.fixup] System autofix complete
2024-04-03 11:24:19.699 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
2024-04-03 11:25:01.300 INFO (MainThread) [supervisor.updater] Fetching update data from https://version.home-assistant.io/stable.json
2024-04-03 11:25:22.269 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/michelebossa/HA-Scheduler repository
2024-04-03 11:25:22.325 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/arthurdent75/SimpleScheduler repository
2024-04-03 11:25:22.382 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/esphome/home-assistant-addon repository
2024-04-03 11:25:22.407 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/home-assistant/addons repository
2024-04-03 11:25:22.458 INFO (MainThread) [supervisor.store.git] Update add-on https://github.com/hassio-addons/repository repository
2024-04-03 11:25:48.685 INFO (MainThread) [supervisor.store] Loading add-ons from store: 79 all - 0 new - 0 remove
2024-04-03 11:25:48.688 INFO (MainThread) [supervisor.store] Loading add-ons from store: 79 all - 0 new - 0 remove
2024-04-03 11:31:58.955 INFO (MainThread) [supervisor.docker.addon] Build 00185a40/aarch64-addon-simplescheduler:2.5 done
2024-04-03 11:31:58.958 INFO (MainThread) [supervisor.addons.manager] Add-on '00185a40_simplescheduler' successfully installed
Could the issue be that something old has been left in the /data/addons/data/00185a40_simplescheduler
folder from the earlier add-on version? I think that folder is not easily accessible for me to check(?).
I think I managed to get the addon to work again perfectly fine. In my tests the scheduler works now as expected. The options.data was created only once I pressed save button on the console webpage. Probably there should not be any more files created in the /share/simplescheduler
folder.
However, it seems to me that there might be some things that there are three issues that might have call for to improve smooth updating and installation:
/share/simplescheduler/options.dat
has ever been installed before. Uninstall & reinstall of the add-on does not help.
/share/simplescheduler
does not exist on first start, the Line 882 in main crashed due to "FileExistsError".
First of all, thank you @jmsuomal for all your effort in debugging. The real issue here is due to the upgrade from a version before 2.0
The 2.0 version was completely rewritten from scratch: I migrated to Python from PHP, so even the docker images have changed. This is the cause of the issues 1 and 3 you listed. There is no real fix for this. Further, it is a very rare condition nowadays. I managed this kind of issue one year ago when the 2.0 was released. I definitely will add a note in the documentation about how to manage this scenario.
I am aware of the issue n.2 . Onestly, it is a self-fixing problem because the process automatically restarts itself on crash, so usually no one sees it. This process took a couple of seconds, only on the first installation, so no one is really bothered. Anyway, I have this on my to-do list.
Thanks again for all your effort! 😃 I think this issue can be closed.
I would like to report an error.
I have been able to successfully install SimpleScheduler, but its interface fails to run. See below the log with Python traceback. I have tried to uninstall and reinstall the SimpleScheduler add-on, but the problem remains.
My guess what is happening because I don't have MQTT server installed. Thus I don't have "MQTT enabled" parameter set. This causes the code to crash.
If this is correct diagnosis, it might be solved by simply adding extra check to the problematic line 925 in
main.py
:...but I am not sure if this problem would arise also elsewhere.