it needs to be noticed.
any change in an app needs to restart an app, so if a py file is changed it needs to be loaded to see if something has changed.
so a stray file gets noticed (in case its going to be an app) but it isnt starting anything untill its in the yaml.
Sure. My overall goal is to be able to have a subdirectory with my app containing the app.yaml, app.py along with other yaml and .py files. The goal is to create an app that other people can drop in, customize some settings in app.yaml and have it work. My app does things like search and launch tv and music media, and sends custom tts responses back.
For yaml files, I’d like to use them for things like different speech options for one. So in app.yaml you could specify a variably pointing to speech_en,yaml or speech_de.yml. Would allow other people to contribute or add their own speech responses. Another is I have a 3k line yaml holding tv show names to netflix and amazon contentIds so they can be searched and launched from my app.
For .py files that is just for things that might be helper files (to generate the tv.yaml for example) or perhaps custom imported methods or classes.
And to be fair, it all actually works like that now, it’s just I get a bunch of exceptions in the log for any extra files. Which to me says I am breaking things when I get exceptions in my log.
OK, makes sense, and I do have a goal of wanting to package apps up and make them more self contained and installable, e.g. via github.
I’ve just put some changes in that will improve this, at least on the yaml side. Making that work for the .py files may be a bit trickier but I’ll take a look since I’m already working in the area. If I can figure out an easy way to do it I’ll put it in the next beta.
I was thinking something like in appdaemon.py move the code that looks for the app config ~1473 above the importlib part. So if it isn’t in an app config just log that you are skippng it.
Right - without checking the code I’m not sure if I have a list of all the apps I am actually expecting at that point so it might need some additional work, but I’ll have to look at the code and see.
You can add your own modules to appdaemon by defining PYTHONPATH to include a new directory in your systemd startup file. I have a module in /home/homeassistant/.homeassistant/python_modules
and add this to my PYTHONPATH
$ cat /etc/systemd/system/[email protected]
#
# Sample unit file for systemd
#
# Edit top suit your environment, then copy to /etc/systemd/system
#
# run "systemd enable appdaemon" to make it start at boottime
#
[Unit]
Description=AppDaemon service for homeassistant
After=network.target
[Service]
Type=simple
User=homeassistant
Environment=PYTHONPATH=/home/homeassistant/.homeassistant/python_modules:${PYTHONPATH}
ExecStart=/srv/homeassistant/bin/appdaemon -c /home/homeassistant/.homeassistant
Restart=on-failure
#
# If you are not using a default path for the config file use this:
#
#ExecStart=/usr/local/bin/appdaemon -c <path to config file>
#
[Install]
WantedBy=multi-user.target
It was easier than I thought - this will be in the next beta
2018-01-23 12:25:54.913489 INFO AppDaemon Version 3.0.0b1 starting
2018-01-23 12:25:54.913965 INFO Configuration read from: /export/pegasus/hass/appdaemon_test/appdaemon.yaml
2018-01-23 12:25:54.915539 INFO AppDaemon: Starting Apps
2018-01-23 12:25:54.939528 WARNING AppDaemon: App 'State' missing 'class' or 'module' entry - ignoring
2018-01-23 12:25:54.955293 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-01-23 12:25:55.130045 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-01-23 12:25:55.130395 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-01-23 12:25:55.131462 INFO Starting Dashboards
2018-01-23 12:25:55.141652 INFO Starting API
2018-01-23 12:25:55.166086 INFO AppDaemon: HASS: Connected to Home Assistant 0.61.0
2018-01-23 12:25:55.307983 INFO AppDaemon: Got initial state from namespace default
2018-01-23 12:25:57.265744 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/two_class.py - ignoring
2018-01-23 12:25:57.266388 INFO AppDaemon: Loading Module: /export/pegasus/hass/appdaemon_test/apps/event.py
2018-01-23 12:25:57.279174 INFO AppDaemon: Loading Object event using class Event from module event
2018-01-23 12:25:57.280008 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/thread_starve.py - ignoring
2018-01-23 12:25:57.280466 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/mirror_light.py - ignoring
2018-01-23 12:25:57.280907 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/sun.py - ignoring
2018-01-23 12:25:57.281332 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/sound.py - ignoring
2018-01-23 12:25:57.281770 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/service.py - ignoring
2018-01-23 12:25:57.282156 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/log.py - ignoring
2018-01-23 12:25:57.282558 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/terminate.py - ignoring
2018-01-23 12:25:57.283085 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/trackers.py - ignoring
2018-01-23 12:25:57.283477 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/battery.py - ignoring
2018-01-23 12:25:57.283905 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/api.py - ignoring
2018-01-23 12:25:57.284290 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/global.py - ignoring
2018-01-23 12:25:57.284697 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/alexa.py - ignoring
2018-01-23 12:25:57.285100 WARNING AppDaemon: No app description found for: /export/pegasus/hass/appdaemon_test/apps/state.py - ignoring
2018-01-23 12:25:57.285527 INFO AppDaemon: Loading Module: /export/pegasus/hass/appdaemon_test/apps/motion/motion_lights.py
2018-01-23 12:25:57.286985 INFO AppDaemon: Loading Object motion_lights using class MotionLights from module motion_lights
2018-01-23 12:25:57.287702 INFO AppDaemon: Loading Module: /export/pegasus/hass/appdaemon_test/apps/schedule.py
2018-01-23 12:25:57.289456 INFO AppDaemon: Loading Object schedule using class Schedule from module schedule
2018-01-23 12:25:57.291663 INFO AppDaemon: App initialization complete
EDIT: I also created config file directives to hide the errors to further clean up the log file
Just did some testing and reproduced the issue - I’ll work on a fix for 3.0 beta 2.
OK, I tracked it down - it’s now fixed in the dev branch and will be in 3.0beta2.
@ReneTode Here is a modified version of the appdaemon add-on for hassio.
Appdaemon5
I haven’t had chance to set up as a repo so you need to copy the appdaemonmatt folder to /addons
Once installed you need to change the version configuration option to 3.0.0b1
This will install the beta, it will reinstall on each restart.
You will need to manually fix the appdaemon config and apps.
@matt2005 How would i go about changing the version config option when installing your addon? and how to fix config and apps. I want to test the 3.0 beta but i’m currently running HA using Hass.io.
Hi Guys,
I’m running on Win 10 and Appdaemon installed fine
However on running it after editing appdaemon.yaml …
log:
accessfile: C:\Users\MyPc\AppData\Roaming\.homeassistant\conf\access.log
errorfile: C:\Users\MyPc\AppData\Roaming\.homeassistant\conf\error.log
logfile: C:\Users\MyPc\AppData\Roaming\.homeassistant\conf\appdaemon.log
log_generations: 3
log_size: 1024
appdaemon:
logfile: STDOUT
errorfile: STDERR
threads: 10
time_zone: <time zone>
api_port: 5000
# api_key: !secret api_key
# api_ssl_certificate: <path/to/root/CA/cert>
# api_ssl_key: <path/to/root/CA/key>
plugins:
HASS:
type: hass
ha_url: http://192.168.1.56:8123
ha_key: xxxxxxxx
# cert_path: <path/to/root/CA/cert>
# cert_verify: True
namespace: default
hadashboard:
dash_url: http://192.168.1.254:6050
dash_force_compile: 1
I get the following error…
C:\Users\MyPc\AppData\Roaming\.homeassistant\conf>appdaemon -c C:\Users\MyPc\AppData\Roaming\.homeassistant\conf
Traceback (most recent call last):
File "c:\users\mypc\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\mypc\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\MyPc\AppData\Local\Programs\Python\Python36\Scripts\appdaemon.exe\__main__.py", line 9, in <module>
File "c:\users\mypc\appdata\local\programs\python\python36\lib\site-packages\appdaemon\admain.py", line 230, in main
conf.logfile = config['AppDaemon'].get("logfile")
KeyError: 'AppDaemon'
Looks like you are running version 2.1.12, and using the instructions for the 3.0 beta - some things have changed. So, either use the “stable” branch in ReadTheDocs, or upgrade to 3.0 beta, by running:
$ pip3 install --upgrade --pre appdaemon
Thanks @aimc, will give it a try
OK, it fails with a few permission errors but after 3 tries it installs successfully
after upgrading to python 3.6.4 i cannot uninstall previous version of appdaemon… should i just remove the exceutable? I have a service script which starts appdaemon on boot
It’s probably installed in the old 3.5 site packages - yo can safely ignore it or delete it if you want.
exactly ok… but imight have to adapt the appdaemon.service right?
I wouldn’t think so, the new AD will install in the same way and have a link to run it in the same place, probably either /usr/local/bin. If you are using a virtual environment you will have to change it to match the bin in the venv if it is different.
i don’t use appdaemon in venv so i will see. hopefully it will work… need to setup the cam again and wanna try some apps
dashboard need refactoring complete so i will start from zero