Trying to get started AD up and running

Trying to get AD running for the first time and keep getting a Unicode error when running the “sudo appdaemon -c /home/homeassistant/conf”

Hoping to get:

2016-08-22 10:08:16,575 INFO Got initial state
2016-08-22 10:08:16,576 INFO Loading Module: /home/homeassistant/conf/apps/hello.py
2016-08-22 10:08:16,578 INFO Loading Object hello_world using class HelloWorld from module hello
2016-08-22 10:08:16,580 INFO Hello from AppDaemon
2016-08-22 10:08:16,584 INFO You are now ready to run Apps!

Instead I get:

pi@HomeAssistant:~ $ sudo appdaemon -c /home/homeassistant/.homeassistant/conf
Traceback (most recent call last):
File “/usr/local/bin/appdaemon”, line 11, in
sys.exit(main())
File “/usr/local/lib/python3.5/dist-packages/appdaemon/admain.py”, line 335, in main
admain.main()
File “/usr/local/lib/python3.5/dist-packages/appdaemon/admain.py”, line 331, in main
self.run(appdaemon, hadashboard)
File “/usr/local/lib/python3.5/dist-packages/appdaemon/admain.py”, line 58, in run
self.AD = ad.AppDaemon(self.logger, self.error, loop, **appdaemon)
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appdaemon.py”, line 214, in init
self.app_config = self.read_config()
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appdaemon.py”, line 1324, in read_config
config = self.read_config_file(os.path.join(root, file))
File “/usr/local/lib/python3.5/dist-packages/appdaemon/appdaemon.py”, line 1352, in read_config_file
config_file_contents = yamlfd.read()
File “/usr/lib/python3.5/codecs.py”, line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xb0 in position 37: invalid start byte

Any ideas? Help would be appreciated

appdaemon 3.0.0b4
hassbian 64.3

Running AD with sudo does not seem like a good idea, why are you doing that?

If I run without sudo I get this:

Traceback (most recent call last):
File “/usr/local/bin/appdaemon”, line 11, in
sys.exit(main())
File “/home/pi/.local/lib/python3.5/site-packages/appdaemon/admain.py”, line 365, in main
admain.main()
File “/home/pi/.local/lib/python3.5/site-packages/appdaemon/admain.py”, line 279, in main
fh = RotatingFileHandler(logfile, maxBytes=log_size, backupCount=log_generations)
File “/usr/lib/python3.5/logging/handlers.py”, line 150, in init
BaseRotatingHandler.init(self, filename, mode, encoding, delay)
File “/usr/lib/python3.5/logging/handlers.py”, line 57, in init
logging.FileHandler.init(self, filename, mode, encoding, delay)
File “/usr/lib/python3.5/logging/init.py”, line 1009, in init
StreamHandler.init(self, self._open())
File “/usr/lib/python3.5/logging/init.py”, line 1038, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: ‘/home/homeassistant/.homeassistant/conf/logfile.log’

so it seems that the user that runs appdaemon doesnt have writing access to your conf directory.
that user needs to have full access to the complete directory and all its subdirectories.

Thanks, apart from the permissions issue, what do you think explains the Unicode error when running as Sudo?

That could be explained by a non-ascii character in the config file, such as an accented character. IF that is the case, sometimes surrounding the whole string in quotes can help.

besides that a readable yaml can have trouble with strings with characters like é ö ä, etc (in that case its mostly the pythoncode that has trouble with it)
also characters like é ö ä, etc are not always saved the right way by different fileeditors, leaving you with an invalid or unreadable yaml.

i try to avoid such characters in the yaml, but if you cant then make sure you use an editor that can work with them.

So I have done new install of Hassbian and just wanted to confirm the best install method

  1. Hassbian script process
  2. pip 3 install process.

There does not seem to be a Hassbian/Appdaemon config install process documented anywhere.

hasbian is a “normal” linux environment, so a normal pip3 install will be fine.
to make yourself secure you can create a venv for appdaemon to install it in.

Thanks Rene