How to install HA on QNAP

Out of curiosity, why do you need to run NGINX?

Great question. All the guides say I need to have this running to route external SSL traffic to regular internal traffic if I want to control my HA setup from my Google Home.
This is how I work now under HASSIO on my RPi.
Is there an alternative?

Hi xaguzman, I am getting the same error, did you find a solution for "Access denied "?

Unfortunately, no, I havent been able to solve it, I moved away from installing HA while I do other things, I hope to revisit this in the future and find a solution

Managed to install HA on my new QNAP using the Docker image.
Also managed to set up SSL cert on Qnap using QTS SSL certificate and Lets encrypt, but how do I get it to work with Home assistant in Docker ?

Please help!

find a tutorial
Integrating Home Assistant into your QNAP NAS

My qnap(ts-412u) doesn’t have the container system is there another way to insall hass?

no solution for this?

I need help! can I install any container that I find on docker hub? because I installed one randomly, under “CONSOLE” starts the writing “starting version 3.2.4” but then if I go to enter my IP: 8123 tells me that it is impossible to reach the site !! how can I do???

hello,

i got the error:
[~] # docker run -d --name=“hass” -v /share/Docker/HASS:/config --privileged -v /dev/ttyACM0:/dev/ttyACM0 -v>
container-station/docker: Error response from daemon: Conflict. The container name “/hass” is already in use by container “3fd9db14c8b49b1b40c79a646e5a2c27a82645b2cbf76c4c0fbe328d9cd6ab77”. You have to remove (or rename) that container to be able to reuse that name.

when i do that, is there a solution?

You already have a Docker container named “hass” so either name the new container something else or delete the “hass” container first.

Starting a couple of days ago I am unable to get my USB devices active in HA anymore running in containerstation. It has been running very smoothly for a couple of months but started to throw errors on enabling my DSMR and RFXTRX devices with error 21 referring to a directory.
Both devices are listed when using “dmesg | grep tty” as ttyUSB0 and ttyUSB1. When looking at the dev directory there are indeed two folders created, rights look ok.

I create my containers using the following command:

docker run -d -e TZ=Europe/Amsterdam --name=“hass-0-67-1” --restart=always --privileged --net=host -p 8123:8123 -v /share/HomeAssistant/hass/config:/config -v /dev/ttyUSB0:/dev/ttyUSB0 -v /dev/ttyUSB1:/dev/ttyUSB1 homeassistant/home-assistant:0.67.1 python -m homeassistant --config /config

Anyone else got the same problems? Tried reverting back to working docker image 0.67.1 and safestored config.

The errors thrown are:

DSMR:
2018-05-03 12:05:30 ERROR (MainThread) [homeassistant.components.sensor.dsmr] Error connecting to DSMR
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/serial/serialposix.py”, line 244, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
IsADirectoryError: [Errno 21] Is a directory: ‘/dev/ttyUSB1’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/app/homeassistant/components/sensor/dsmr.py”, line 116, in connect_and_reconnect
reader_factory())
File “/usr/local/lib/python3.6/asyncio/coroutines.py”, line 212, in coro
res = func(*args, **kw)
File “/usr/local/lib/python3.6/site-packages/serial_asyncio/init.py”, line 410, in create_serial_connection
ser = serial.serial_for_url(*args, **kwargs)
File “/usr/local/lib/python3.6/site-packages/serial/init.py”, line 88, in serial_for_url
instance.open()
File “/usr/local/lib/python3.6/site-packages/serial/serialposix.py”, line 247, in open
raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 21] could not open port /dev/ttyUSB1: [Errno 21] Is a directory: ‘/dev/ttyUSB1’
2018-05-03 12:05:30 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: timestamp=1525341930.030945, level=ERROR, message=Error connecting to DSMR, exception=Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/serial/serialposix.py”, line 244, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
IsADirectoryError: [Errno 21] Is a directory: ‘/dev/ttyUSB1’

RFXTRX:
2018-05-03 12:07:57 ERROR (MainThread) [homeassistant.setup] Error during setup of component rfxtrx
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/serial/serialposix.py”, line 244, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
IsADirectoryError: [Errno 21] Is a directory: ‘/dev/ttyUSB0’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/RFXtrx/init.py”, line 601, in connect
self.serial = serial.Serial(self.port, 38400, timeout=0.1)
File “/usr/local/lib/python3.6/site-packages/serial/serialutil.py”, line 182, in init
self.open()
File “/usr/local/lib/python3.6/site-packages/serial/serialposix.py”, line 247, in open
raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 21] could not open port /dev/ttyUSB0: [Errno 21] Is a directory: ‘/dev/ttyUSB0’

Update: problem solved.

It appears the ttyUSB0 and ttyUSB1 files aren’t automatically created in /dev/ after restart of the NAS, especially when you have enabled the HA docker with autostart.
As a result starting the docker container resulted in creation of folders in /dev/ instead. Because there cannot be both folders and files of the same name in /dev/ these files were not created even after unplugging and replugging the USB devices.

Solution:

  1. Stop HA container via Container station or command line "docker stop
  2. Login via Putty or WinSCP using admin account
  3. Check if folders ttyUSB0, ttyUSB1 or ttyUSB2 are present in /dev/. if so delete them
  4. Unplug USB devices
  5. Replug USB devices
  6. Check if ttyUSB0, ttyUSB1 or ttyUSB2 files are created in /dev/
  7. Start HA container

I am planning to buy a TS128 to run HA, have you fixed your problem and get HA running with you TS128?

If you don’t have convenient physical access to unplug and replug the USB devices, you can remove and re-add the necessary modules using rmmod and insmod respectively after deleting the folders.

No, I haven’t fixed.

I have plugged in a Bluetooth dongle in a USB port on the back of my TS453Bmini but no tty files shows up (as I expected), so I will try this method later today.

So this means that it is the docker command that creates the tty files (or pushes the OS to create the files)?

Tried the procedure suggested by @PeterTje and yes the docker command created directory /dev/ttyUSB0 as mentioned.

Thus when enabling the bluetrooth tracker in HA config i get error at startup:

Error setting up platform bluetooth_tracker
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/device_tracker/__init__.py", line 183, in async_setup_platform
    disc_info)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/device_tracker/bluetooth_tracker.py", line 35, in setup_scanner
    import bluetooth
ModuleNotFoundError: No module named 'bluetooth'

Doing lsusb gives me this:

[~] # lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 1005:b155 Apacer Technology, Inc. 
Bus 001 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[~] #                                                                                                    

So I get the impression that Linux is recognizing the dongle…or what am I missing?

Seems like I did not miss anything.

After a reboot today of the NAS, the bluetooth part seems fine and there was new devices found and added to known_devices.yaml (having mac address with prefixed with BT_).

Just hope this is stable…

Anybody here had issues with the HASS/QNAP container crashing randomly (no error in the logs)? I suspect it has something to do with the ZWave component (I have ca. 20 devices).