Unable to connect to HA
Running docker on Ubuntu 16.04 server. HA 0.64.1 as a docker container. Trying to create an appdaemon container using the appdaemon Docker Tutorial. I tried to run the test command and I cannot get it to connect to my running HA instance. If I try to run the command to give persistance it ends up as a restart loop.
Here is the command I use straight out of the appdaemon docker tutorial.
docker run --rm -it -p 5050:5050 -e HA_URL="192.168.1.203:8123" -e EXTRA_CMD="-D DEBUG" -e DASH_URL="192.168.1.203:5050" acockburn/appdaemon:latest
Below is the error I receive in both attempts.
cp: cannot stat ‘/usr/src/app/conf/apps.yaml.example’: No such file or directory
2018-03-02 03:45:47.199814 INFO AppDaemon Version 3.0.0b3 starting
2018-03-02 03:45:47.200030 INFO Configuration read from: /conf/appdaemon.yaml
2018-03-02 03:45:47.200112 DEBUG AppDaemon Section: None
2018-03-02 03:45:47.200180 DEBUG HADashboard Section: None
2018-03-02 03:45:47.200760 INFO AppDaemon: Starting Apps
2018-03-02 03:45:47.201037 DEBUG AppDaemon: Creating worker threads ...
2018-03-02 03:45:47.206438 DEBUG AppDaemon: Done
2018-03-02 03:45:47.206680 DEBUG AppDaemon: Entering run()
2018-03-02 03:45:47.206863 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-03-02 03:45:47.296178 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-03-02 03:45:47.296542 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-03-02 03:45:47.296714 DEBUG AppDaemon: Starting utility loop
2018-03-02 03:45:47.296855 INFO Dashboards are disabled
2018-03-02 03:45:47.296933 INFO API is disabled
2018-03-02 03:45:47.297000 DEBUG Start Loop
2018-03-02 03:45:47.297408 DEBUG AppDaemon: Event type:ha_disconnected:
2018-03-02 03:45:47.297549 DEBUG AppDaemon: {}
2018-03-02 03:45:47.297631 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-02 03:45:47.297701 WARNING AppDaemon: HASS: ------------------------------------------------------------
2018-03-02 03:45:47.297771 WARNING AppDaemon: HASS: Unexpected error:
2018-03-02 03:45:47.297842 WARNING AppDaemon: HASS: ------------------------------------------------------------
2018-03-02 03:45:47.298409 WARNING AppDaemon: HASS: Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/appdaemon/plugins/hass/hassplugin.py", line 178, in get_updates
if url.startswith('https://'):
AttributeError: 'NoneType' object has no attribute 'startswith'
2018-03-02 03:45:47.298585 WARNING AppDaemon: HASS: ------------------------------------------------------------
2018-03-02 03:45:52.301367 DEBUG AppDaemon: Event type:ha_disconnected:
2018-03-02 03:45:52.301796 DEBUG AppDaemon: {}
2018-03-02 03:45:52.302096 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-02 03:45:52.302351 WARNING AppDaemon: HASS: ------------------------------------------------------------
2018-03-02 03:45:52.302592 WARNING AppDaemon: HASS: Unexpected error:
2018-03-02 03:45:52.302832 WARNING AppDaemon: HASS: ------------------------------------------------------------
2018-03-02 03:45:52.303402 WARNING AppDaemon: HASS: Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/appdaemon/plugins/hass/hassplugin.py", line 178, in get_updates
if url.startswith('https://'):
AttributeError: 'NoneType' object has no attribute 'startswith'
Try qualifying your ha_url with with http:// or https:// if your system is secure and specify the ha_key if you have one. The beta doc snippet says:
“Before you start, you need to know the following:
HA_URL: The URL of your running Home Assistant, in the form of http://[name]:[port]. Port is usually 8123. HA_KEY: If your Home Assistant requires an API key, you’ll need that Now, on your Docker host, for linux users, run the following command, substituting the values above in the quotes below. (Note, if you do not need an HA_KEY, you can omit the entire -e HA_KEY line)
docker run --rm -it -p 5050:5050
-e HA_URL="
-e HA_KEY="
-e DASH_URL="http://$HOSTNAME:5050"
acockburn/appdaemon:latest
”
Thanks @grewhit25 - exactly right. Let us know if that works.
This was the exact resource I used to create the command above the error message. I have tried it adding the "http://" to both HA_URL and DASH_URL and I get the same errors.
@acockburn Do I need to have python3.6 loaded as a system resource or does the dockerfile install it inside the container?
So re-configured my HASS boot script to include binding the port 8123. The original command from HA did not bind the port in the command, so I added it.
No changes so far.
The docker image installs python 3.6.
What error are you getting now?
Same thing, unable to connect to HA...and I cant get a container in the background to be "up" long enough to check if it is installing everything correctly.
I can get api info from HA by using curl on the host machine...just for whatever reason, the appdaemon container wont reach hass.
Is it usual to get this as the first error in the debug?
cp: cannot stat ‘/usr/src/app/conf/apps.yaml.example’: No such file or directory
Okay, so an update. I removed the latest image and installed 2.1.12 instead. Up and running now after having to manually create the compiled, compiled/css, and compiled/javascript directories.
So the question lies, why could I not use the latest version but can use the 2.1.12 version?
Ensure you are using the beta version of appdaemon.yaml, example at: conf/appdaemon.yaml.example
log: logfile: STDOUT errorfile: STDERR appdaemon: threads: 10 plugins: HASS: type: hass ha_url: ha_key:
Note the introduction of the idea of plugins.
On Sat, 3 Mar 2018 at 04:59, jkvalence [email protected] wrote:
Okay, so an update. I removed the latest image and installed 2.1.12 instead. Up and running now after having to manually create the compiled, compiled/css, and compiled/javascript directories.
So the question lies, why could I not use the latest version but can use the 2.1.12 version?
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/home-assistant/appdaemon/issues/248#issuecomment-370118850, or mute the thread https://github.com/notifications/unsubscribe-auth/Ah9vY_cmnaYCVeezopawPMF3w0PBpK2Lks5taiMSgaJpZM4SZXQS .
I have faced the same problem and I have found the solution in altering dockerStart.sh.
I guess the fault lays in the fact, that it assumes the old layout of appdaemon configuration in appdaemon.yaml file. - "the idea of plugins"
The docker startup script does not correctly propagate HA_URL and HA_KEY environmental variables to appdaemon.yaml any more.
The change required to be made in dockerStart.sh is: Line 28: sed -i "s/^ ha_url:.*/ ha_url: $(echo $HA_URL | sed -e 's/\/\\/g; s///\//g; s/&/\&/g')/" $CONF/appdaemon.yaml add four spaces before both occurrences of "ha_url:"
line 33: sed -i "s/^ ha_key:.*/ ha_key: $(echo $HA_KEY | sed -e 's/\/\\/g; s///\//g; s/&/\&/g')/" $CONF/appdaemon.yaml add four spaces before both occurrences of "ha_key:"
namely it lays in adding the correct number of spaces before ha_* keywords
I've tried to add pull request to solve it, but I faced the problem of lack of CLA signature - I'll try to progress through it further.
Does anyone here knows what I need to do to get CLA signature?
heh formatting kicked it out.
Line 28: remove: sed -i "s/^ ha_url:./ ha_url: $(echo $HA_URL | sed -e 's//\/g; s/////g; s/&/&/g')/" $CONF/appdaemon.yaml
add: sed -i "s/^ ha_url:./ ha_url: $(echo $HA_URL | sed -e 's//\/g; s/////g; s/&/&/g')/" $CONF/appdaemon.yaml
Line 33:
remove: sed -i "s/^ ha_key:./ ha_key: $(echo $HA_KEY | sed -e 's//\/g; s/////g; s/&/&/g')/" $CONF/appdaemon.yaml add: sed -i "s/^ ha_key:./ ha_key: $(echo $HA_KEY | sed -e 's//\/g; s/////g; s/&/&/g')/" $CONF/appdaemon.yaml
@mradziwo - thanks for this, and the PR, I'l merge it and it will be in the next beta - the fix above should work in the meantime.
just tried to install and running in to the same issue. How do I edit the dockerStart.sh file? I'm not sure which directory it is stored in.