How to solve the no latitude, longitude & elevation startup fail

Hey. I am new to the appdaemon topic and after I understand that the appdaemon.yaml need the old api-authentification to run I came to the point that it does not start with some error that it can not retrieve the vars from HA.

2018-10-30 10:11:49.788738 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: latitude
2018-10-30 10:11:49.789670 ERROR AppDaemon: AppDaemon is terminating
2018-10-30 10:11:49.796862 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: longitude
2018-10-30 10:11:49.797772 ERROR AppDaemon: AppDaemon is terminating
2018-10-30 10:11:49.798736 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: elevation
2018-10-30 10:11:49.799426 ERROR AppDaemon: AppDaemon is terminating
2018-10-30 10:11:49.800878 DEBUG AppDaemon: Event type:ha_stop:
2018-10-30 10:11:49.801668 DEBUG AppDaemon: None
2018-10-30 10:11:49.804180 INFO AppDaemon: HASS: Disconnecting from Home Assistant
2018-10-30 10:11:49.805711 DEBUG End Loop
2018-10-30 10:11:49.806469 INFO AppDeamon Exited

Nothing changed when I start it with or without sudo. My command is: “sudo appdaemon -c /home/homeassistant/.homeassistant/conf/ -D DEBUG”

I thought it could be something with the folder owner. I run my HA within python virtual-environment with the user and group ‘homeassistant’. So I changed all rights of the conf folder (under the root user with chmod -R conf) and within the conf folder:
> pi@raspberrypi:/home/homeassistant/.homeassistant $ ls -la

insgesamt 307680
drwxr-xr-x 8 homeassistant homeassistant      4096 Okt 30 10:20 .
drwxr-xr-x 5 homeassistant homeassistant      4096 Sep 11 17:17 ..
drwxr-xr-x 2 root          root               4096 Okt 29 10:27 appdaemonLogs
-rw-r--r-- 1 homeassistant homeassistant       272 Okt 28 16:04 automations.yaml
drwxr-xr-x 2 homeassistant homeassistant      4096 Sep 10 11:04 .cloud
drwxr-xr-x 5 homeassistant homeassistant      4096 Okt 29 10:48 conf
-rw-r--r-- 1 homeassistant homeassistant      2096 Okt 28 21:27 configuration.ya                                                                                                 ml
-rw-r--r-- 1 homeassistant homeassistant        71 Sep 21 19:30 customize.yaml
drwxr-xr-x 2 homeassistant homeassistant      4096 Sep 10 10:56 deps
-rw-r--r-- 1 homeassistant homeassistant         0 Sep 10 10:56 groups.yaml
-rw-r--r-- 1 homeassistant homeassistant         6 Okt 28 13:33 .HA_VERSION
-rw-r--r-- 1 homeassistant homeassistant      1999 Okt 30 06:47 home-assistant.l                                                                                                 og
-rw-r--r-- 1 homeassistant homeassistant 314998784 Okt 30 10:20 home-assistant_v                                                                                                 2.db
-rw-r--r-- 1 homeassistant homeassistant         0 Sep 10 10:56 scripts.yaml
-rw-r--r-- 1 homeassistant homeassistant       157 Sep 10 10:56 secrets.yaml
drwxr-xr-x 2 homeassistant homeassistant      4096 Okt 29 06:58 .storage
drwxr-xr-x 2 homeassistant homeassistant      4096 Sep 19 16:15 tts
-rw-r--r-- 1 homeassistant homeassistant        44 Sep 10 10:57 .uuid

and:

pi@raspberrypi:/home/homeassistant/.homeassistant/conf $ ls -la
insgesamt 24
drwxr-xr-x 5 homeassistant homeassistant 4096 Okt 29 10:48 .
drwxr-xr-x 8 homeassistant homeassistant 4096 Okt 30 10:21 …
-rw-r–r-- 1 homeassistant homeassistant 173 Okt 29 10:48 appdaemon.yaml
drwxr-xr-x 2 homeassistant homeassistant 4096 Okt 29 10:13 apps
-rw-r–r-- 1 homeassistant homeassistant 0 Okt 28 19:12 apps.yaml
drwxr-xr-x 4 homeassistant homeassistant 4096 Okt 28 19:14 compiled
drwxr-xr-x 2 homeassistant homeassistant 4096 Okt 29 10:44 dashboards

Here is a tree:

pi@raspberrypi:/home/homeassistant/.homeassistant/conf $ tree
.
|-- appdaemon.yaml
|-- apps
|-- apps.yaml
|-- compiled
| |-- css
| -- javascript – dashboards

apps.yaml is still empty. Content of appdaemon.yaml :

appdaemon:
threads: 10
plugins:
HASS:
type: hass
ha_url: http://10.0.0.52:8122
ha_key: myPasswordWithoudSpecialCharacters

Can anybody tell me here, what could be wrong?

Greetings by JamieMe

first things first.
there is no way to tell if your yaml is correct if you dont present it as codeblock.

  • apps.yaml should be inside the apps directory.
  • the ha url needs to be an url that you can use in a browser to show your HA normal GUI
  • the ha_key should be the api pasword from HA that you set in the HTTP section from HA. (and you need to be able to login to HA with that)
  • you shouldnt use sudo with appdaemon
  • it helps if you share the complete log from appdaemon, from the moment of starting (not just a part)

okay. I move the empty apps.yaml back to the apps folder. :ballot_box_with_check:

Here is the full output+cmd: :ballot_box_with_check:

pi@raspberrypi:~ $ appdaemon -c /home/homeassistant/.homeassistant/conf/ -D DEBUG
2018-10-30 21:40:38.998139 INFO AppDaemon Version 3.0.1 starting
2018-10-30 21:40:38.998773 INFO Configuration read from: /home/homeassistant/.homeassistant/conf/appdaemon.yaml
2018-10-30 21:40:38.999179 DEBUG AppDaemon Section: None
2018-10-30 21:40:38.999550 DEBUG HADashboard Section: None
2018-10-30 21:40:39.004510 WARNING config_file: /home/homeassistant/.homeassistant/conf/appdaemon.yaml is owned by homeassistant but appdaemon is running as pi
2018-10-30 21:40:39.006852 INFO AppDaemon: Starting Apps
2018-10-30 21:40:39.008594 WARNING config_dir: /home exists, but is not writeable, owner: root
2018-10-30 21:40:39.009273 WARNING config_dir: /home/homeassistant exists, but is not writeable, owner: homeassistant
2018-10-30 21:40:39.009924 WARNING config_dir: /home/homeassistant/.homeassistant exists, but is not writeable, owner: homeassistant
2018-10-30 21:40:39.010584 WARNING config_dir: /home/homeassistant/.homeassistant/conf exists, but is not writeable, owner: homeassistant
2018-10-30 21:40:39.013260 WARNING appdir: /home/homeassistant/.homeassistant/conf/apps is owned by homeassistant but appdaemon is running as pi
2018-10-30 21:40:39.013903 DEBUG AppDaemon: Creating worker threads …
2018-10-30 21:40:39.018546 DEBUG AppDaemon: Done
2018-10-30 21:40:39.019117 DEBUG AppDaemon: Entering run()
2018-10-30 21:40:39.019944 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-10-30 21:40:39.968964 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-10-30 21:40:39.970037 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-10-30 21:40:39.970677 DEBUG AppDaemon: Starting utility loop
2018-10-30 21:40:39.971248 INFO Dashboards are disabled
2018-10-30 21:40:39.971621 INFO API is disabled
2018-10-30 21:40:39.971958 DEBUG Start Loop
2018-10-30 21:40:39.988387 INFO AppDaemon: HASS: Connected to Home Assistant 0.81.1
2018-10-30 21:40:39.997145 DEBUG AppDaemon: HASS: get_ha_config()
2018-10-30 21:40:39.997684 DEBUG AppDaemon: HASS: get_ha_config: url is http://10.0.0.52:8123/api/config
2018-10-30 21:40:40.011899 DEBUG AppDaemon: HASS: get_ha_state: url is http://10.0.0.52:8123/api/states
2018-10-30 21:40:40.032265 DEBUG AppDaemon: HASS: Got state
2018-10-30 21:40:40.035291 INFO AppDaemon: Got initial state from namespace default
2018-10-30 21:40:41.990776 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: latitude
2018-10-30 21:40:41.991656 ERROR AppDaemon: AppDaemon is terminating
2018-10-30 21:40:41.998495 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: longitude
2018-10-30 21:40:41.999345 ERROR AppDaemon: AppDaemon is terminating
2018-10-30 21:40:42.000148 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: elevation
2018-10-30 21:40:42.000822 ERROR AppDaemon: AppDaemon is terminating
2018-10-30 21:40:42.002112 DEBUG AppDaemon: Event type:ha_stop:
2018-10-30 21:40:42.002900 DEBUG AppDaemon: None
2018-10-30 21:40:42.005415 INFO AppDaemon: HASS: Disconnecting from Home Assistant
2018-10-30 21:40:42.006870 DEBUG End Loop
2018-10-30 21:40:42.007617 INFO AppDeamon Exited

And here is my appdaemon.yaml in yaml-codeblock: :ballot_box_with_check:

appdaemon:
  threads: 10
  plugins:
    HASS:
      type: hass
      ha_url: http://10.0.0.52:8123
      ha_key: 16character_api_pass_like_this_G4Jsn4d2Sgj2D9Ds

Yes, I can enter the internal ip from this appdaemon.yaml with the api-password with my browser. :ballot_box_with_check:
Here the last 12 lines from my home-assistant configuration.yaml:

# Zeug um appdaemon nutzbar zu machen
http:
  api_password: 16character_api_pass_like_this_G4Jsn4d2Sgj2D9Ds

# brauch man angeblich
homeassistant:
  auth_providers:
   - type: legacy_api_password

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

I hope that helps to get closer to a solution. I dont care (actually) about the dashboard but the apps could be really usefull. I really want to check the possibilities of appdaemon with HA. I was searching withing the other threads but found no solution.

Greetings by JamieMe

EDIT:
I regocnized that within my normal HA-Dashboard I got a message that says something about “sun” config


But I can not find anything is wrong in my configuration.yaml
Perhaps it because “auth_providers”. Here is a post about it: Authenticating AppDaemon - #12 by andrey18

Look… really dumb question… have you configured these in config.yaml? Right at the top is there a latitude, longitude entered?

I think this is the root of your problem. You need to run appdaemon as user homeassistant if you config files are all in the homeassistant directory.

@DavidFW1960
No problem. :smile:
Here is my whole config (I change some data but keep the schematic):

#THIS IS THE RIGHT CONFIG
homeassistant:
  # Name of the location where Home Assistant is running
  name: My Home Assi
  # Location required to calculate the time the sun rises and sets
  latitude: 52.5096646
  longitude: 13.37283
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 1.0
  # metric for Metric, imperial for Imperial
  unit_system: metric
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: Europe/Berlin
  # Customization file
  customize: !include customize.yaml

# Show links to resources in log and frontend
introduction:

# Enables the frontend
frontend:

# Enables configuration UI
config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
  # Optional, allows Home Assistant developers to focus on popular components.
    include_used_components: true

# Discover some devices automatically
discovery:

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

# Track the sun
sun:

# Weather prediction
sensor:
  - platform: yr

# Text to speech
tts:
  - platform: google
    language: 'de'

# Cloud
cloud:

# Homematic Funk bzw. HomeGear anbindung
homematic:
  interfaces:
    wireless:
      host: 127.0.0.1

# Player
media_player:
  - platform: samsungtv
    host: 10.0.0.39

# Zeug um appdaemon nutzbar zu machen
http:
  api_password: 16character_api_pass_like_this_G4Jsn4d2Sgj2D9Ds

# brauch man angeblich
homeassistant:
  auth_providers:
   - type: legacy_api_password

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

@gpbenton
Jep, I read that while doing research what could be the problem in another thread here. I try it many times with sudo, pi or homeassistant user. Here the output, some minutes ago:

pi@raspberrypi:/home/homeassistant/.homeassistant $ sudo -u homeassistant -H -s
homeassistant@raspberrypi:~/.homeassistant $ appdaemon -c /home/homeassistant/.homeassistant/conf -D DEBUG
2018-10-31 10:29:01.910400 INFO AppDaemon Version 3.0.1 starting
2018-10-31 10:29:01.911042 INFO Configuration read from: /home/homeassistant/.homeassistant/conf/appdaemon.yaml
2018-10-31 10:29:01.911602 DEBUG AppDaemon Section: None
2018-10-31 10:29:01.911978 DEBUG HADashboard Section: None
2018-10-31 10:29:01.917253 INFO AppDaemon: Starting Apps
2018-10-31 10:29:01.919112 WARNING config_dir: /home exists, but is not writeable, owner: root
2018-10-31 10:29:01.922497 DEBUG AppDaemon: Creating worker threads …
2018-10-31 10:29:01.927403 DEBUG AppDaemon: Done
2018-10-31 10:29:01.927934 DEBUG AppDaemon: Entering run()
2018-10-31 10:29:01.928640 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-10-31 10:29:02.839239 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-10-31 10:29:02.840251 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-10-31 10:29:02.840888 DEBUG AppDaemon: Starting utility loop
2018-10-31 10:29:02.841454 INFO Dashboards are disabled
2018-10-31 10:29:02.841829 INFO API is disabled
2018-10-31 10:29:02.842163 DEBUG Start Loop
2018-10-31 10:29:02.860286 INFO AppDaemon: HASS: Connected to Home Assistant 0.81.1
2018-10-31 10:29:02.869465 DEBUG AppDaemon: HASS: get_ha_config()
2018-10-31 10:29:02.870477 DEBUG AppDaemon: HASS: get_ha_config: url is http://10.0.0.52:8123/api/config
2018-10-31 10:29:02.886011 DEBUG AppDaemon: HASS: get_ha_state: url is http://10.0.0.52:8123/api/states
2018-10-31 10:29:02.907693 DEBUG AppDaemon: HASS: Got state
2018-10-31 10:29:02.911124 INFO AppDaemon: Got initial state from namespace default
2018-10-31 10:29:04.863063 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: latitude
2018-10-31 10:29:04.864081 ERROR AppDaemon: AppDaemon is terminating
2018-10-31 10:29:04.870993 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: longitude
2018-10-31 10:29:04.872636 ERROR AppDaemon: AppDaemon is terminating
2018-10-31 10:29:04.874227 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: elevation
2018-10-31 10:29:04.875640 ERROR AppDaemon: AppDaemon is terminating
2018-10-31 10:29:04.877985 DEBUG AppDaemon: Event type:ha_stop:
2018-10-31 10:29:04.879414 DEBUG AppDaemon: None
2018-10-31 10:29:04.882133 INFO AppDaemon: HASS: Disconnecting from Home Assistant
2018-10-31 10:29:04.884039 DEBUG End Loop
2018-10-31 10:29:04.885145 INFO AppDeamon Exited
homeassistant@raspberrypi:~/.homeassistant $

Greetings by JamieMe

somehow the state from longtitude, latitude and elevation cant be get from HA.
at this point i got no idea why.

you seem to have HA running already at that point, so it cant be a race thing.
you use HA 0.81
i dont know if they changed something that causes this, but i dont think so.

but we can work around it untill we find out what is the trouble.

just set the latitude, longtitude, elevation and time_zone in the appdaemon.yaml (in the appdaemon section as described in the docs)
https://appdaemon.readthedocs.io/en/dev/CONFIGURE.html#appdaemon

I do not understand this line. The config_dir seems to be specified in the command line, but not as /home.

since 3.0.1 AD checks the whole path to the config and some needed dirs inside the config for the right filerights. and it reports where AD doesnt have access, so that reading the logs immediatly show problems.
config_dir is the part from AD that does that (like the appname that you normally see at that place)

since we know the whole path to the config we can say that this warning is unimportant.

1 Like

okay, I will do this.

Is there perhaps a problem with my api?
I try to open this mentioned url’s from the bash output in my chrome brwoser and got this:

&


Then I go to my HA default dashboard (http://10.0.0.52:8123/states) and found this error:

10.0.0.13 is my current internal ip from the device I try to connect to the api-link with my browser.

by JamieMe

if you go to http://10.0.0.52:8123 do you get your homeassistant gui?
when you do that in a browser that you didnt use before, can you login with api? (or remove password from the browser so that it asks it again)

and i notice tou got this

homeassistant:
  auth_providers:
   - type: legacy_api_password

in your HA config.
from reading the docs i thought it was needed too, but it seems that it can cause more trouble when its in and its not needed anyway. so please remove it, and restart HA.

It seems a restart of my pi solve everything! :smiley: :smiley: :smiley:

Okay, I remove this too from my configuration.yaml:

homeassistant:
  auth_providers:
   - type: legacy_api_password

THX to:
@ReneTode
@gpbenton
@DavidFW1960

Greetings by JamieMe

2 Likes

so now go create some awsome apps and blow us from our feet :wink:

1 Like