Announcement: Appdaemon v4.0.0

I am now getting the same errors as sbmlat. Also running on Docker Ubuntu.
Anyone else seeing the same thing? or could it be with the docker image?

In my case, it’s this directory

/conf -> /mnt/user/appdata/appdaemon

It’s definitely not the docker image, works fine here. Can you please show your appdaemon.yaml file?

@sbmlat and @berniebl
you both have errors in the log setup.
please read here how to setup logging:

https://appdaemon.readthedocs.io/en/latest/CONFIGURE.html#log-configuration

1 Like

I have to say … I am at a loss with this setup. I had no issues getting the previous version running but now I can’t get anything to show in my web page with the error: Safari can’t open the page “192.168.xx.xx:/dashboard?skin=minim” because Safari can’t connect to the server “192.168.xx.xx”.

Here are some of my issues:

  • I can’t figure out how to get the logs to work, I have tried different paths from full qualified path to local to appdeamon and I always get the “file or directory does not exist” even if I have a directory and blank file created. Since it’s optional, I commented it to bypass it for now, but wouldn’t mind having logs available at some point.
  • Disabled app with “disable_apps: 1” even though I would like to have apps at some point. I looked at the example apps on github and did not see a direct replacement for HelloWorld so copied the alexa.py app. This is what I am getting for an error, seems like I need to define it somewhere, I can look at this later on. My main objective is to get my dashboard running.

DOCKER LOG:
2020-01-28 08:39:54.873113 INFO HASS: Connected to Home Assistant 0.104.3
2020-01-28 08:39:54.891873 INFO AppDaemon: App ‘hello_world’ added
2020-01-28 08:39:54.893659 INFO AppDaemon: Found 1 total apps
2020-01-28 08:39:54.894688 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2020-01-28 08:39:55.196999 INFO HASS: Evaluating startup conditions
2020-01-28 08:39:55.461201 INFO AppDaemon: Got initial state from namespace default
2020-01-28 08:39:56.899862 INFO AppDaemon: Scheduler running in realtime
2020-01-28 08:39:56.906643 INFO AppDaemon: Adding /conf/apps to module import path
2020-01-28 08:39:56.910431 WARNING AppDaemon: No app description found for: /conf/apps/alexa.py - ignoring
2020-01-28 08:39:56.912463 INFO AppDaemon: App initialization complete

DOCKER-COMPOSE

  appdaemon:
    container_name: homeassistant_appdaemon
    image: acockburn/appdaemon:latest
    restart: unless-stopped
    labels:
      com.centurylinklabs.watchtower.enable: "true"
    depends_on:
      - homeassistant
    links:
      - homeassistant    
    ports:
      - 5050:5050
    volumes:
      - ${USERDIR}/docker/homeassistant/appdaemon:/conf
      - /etc/localtime:/etc/localtime:ro
    environment:
#      - HA_URL="http://192.168.xx.xx:8123"
#      - HA_KEY="LongStringTokenInsertedHere"
#      - DASH_URL="http://192.168.xx.xx:5050"
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}

APPDAEMON.YAML

# logs:
#   main_log:
#     filename: /home/hass/docker/homeassistant/appdaemon/logs/appdaemon.log
#   error_log:
#     filename: /home/hass/docker/homeassistant/appdaemon/logs/error.log
appdaemon:
  latitude: !secret latitude
  longitude: !secret longitude
  elevation: 70
  time_zone: America/New_York
  threads: '10'
  disable_apps: 1
  plugins:
    HASS:
      type: hass
      ha_url: "http://192.168.xx.xx:8123"
      token: !secret token
hadashboard:
#  dash_url: "http://192.168.xx.vv:5050"

I have tried the URLs with and without quotes as I have seen some examples that didn’t have the quotes in the online manual.

Is there anyone one that could point me to a solution? I have never used apps in the past, but wouldn’t mind trying some at some point, but I really like the dashboard and would like to keep this feature in my setup. Thanks

to get dashboard working you need the http section now:
https://appdaemon.readthedocs.io/en/latest/CONFIGURE.html#configuring-the-http-component
that replaces the dashurl.

an app is always 2 parts.
first its py file, and secondly its accompanying yaml in the same dir (can be in apps.yaml or any yaml file, as long as it is in the apps dir

from your logs you can see that the hello_world app is there.

if you create a dir for the logs, then make sure that the filerights are correct.
the user that starts appdaemon needs reading and writing rights in thar dir.
the docker log shows you if the directory you use has the right filerights or not.

i have no clue about docker (never used it) but i believe the urls need to be in the environment, but i am not sure if dash_url stayed as dash_url, if that doesnt work then try url instead

Thank you, @ReneTode

I added those entries but still, it’s failing to start. I don’t have appdaemon.cfg file.

2020-01-28 08:20:23.571287 INFO AppDaemon: AppDaemon Version 4.0.1 starting
2020-01-28 08:20:23.571431 INFO AppDaemon: Python version is 3.8.1
2020-01-28 08:20:23.571643 INFO AppDaemon: Configuration read from: /conf/appdaemon.yaml
2020-01-28 08:20:23.571793 INFO AppDaemon: Added log: AppDaemon
2020-01-28 08:20:23.571906 INFO AppDaemon: Added log: Error
2020-01-28 08:20:23.572010 INFO AppDaemon: Added log: Access
2020-01-28 08:20:23.572112 INFO AppDaemon: Added log: Diag
2020-01-28 08:20:23.572220 ERROR AppDaemon: time_zone not specified in appdaemon.cfg 
logs:
  main_log:
    filename: /conf/logs/appdaemon.log
    logsize: 100000
    log_generations: 3
  error_log:
    filename: /conf/logs/appdaemonerr.log
    logsize: 100000
    log_generations: 3

From Docker log:

Traceback (most recent call last):
File "/usr/local/bin/appdaemon", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
admain.main()
File "/usr/local/lib/python3.8/site-packages/appdaemon/__main__.py", line 330, in main
self.logging = logging.Logging(logs, args.debug)
File "/usr/local/lib/python3.8/site-packages/appdaemon/logging.py", line 244, in __init__
for arg in config[log]:
TypeError: 'int' object is not iterable

appdaemon.cfg is from the past (needs to be changed)
that is now appdaemon.yaml

so you need to add time_zone

That’s already defined in appdaemon.yaml file.

appdaemon:
  latitude: !secret lati
  longitude: !secret long
  elevation: 224
  time_zone: America/Chicago

shows that appdaemon didnt see it.
so or that logline is from before, or there is something else wrong in appdaemon.yaml

Every time when I try to restart the container, I notice this error in the docker log file. There are no entries logged to AD log files. I think ‘time_zone’ entry error was before I added that to appdaemon.yaml file.

Traceback (most recent call last):
File "/usr/local/bin/appdaemon", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/appdaemon/__main__.py", line 384, in main
admain.main()
File "/usr/local/lib/python3.8/site-packages/appdaemon/__main__.py", line 330, in main
self.logging = logging.Logging(logs, args.debug)
File "/usr/local/lib/python3.8/site-packages/appdaemon/logging.py", line 244, in __init__
for arg in config[log]:
TypeError: 'int' object is not iterable

So getting a little closer. Seems like my log location is working, I just had to preface the path with “/conf”.

I am not sure if the 2 files that I have for apps are working or causing me issues.
I am getting some error messages in my docker log:

/usr/local/lib/python3.8/site-packages/appdaemon/main.py:134: DeprecationWarning: Task.all_tasks() is deprecated, use asyncio.all_tasks() instead
pending = asyncio.Task.all_tasks()
/usr/local/lib/python3.8/site-packages/aiohttp/connector.py:964: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
hosts = await asyncio.shield(self._resolve_host(
/usr/local/lib/python3.8/asyncio/events.py:81: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
self._context.run(self._callback, *self._args)
/usr/local/lib/python3.8/asyncio/events.py:81: DeprecationWarning: The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.
self._context.run(self._callback, *self._args)

I can somewhat launch a dashboard, the main panel works and so is hello.dash but any other examples that I am copying from the site does not work such as test.dash and single.dash and so is my custom panel.

I get the error “Error Getting state, check Java Console for Details” .
I have cleared the cache on both Safari and Chrome as one of the treads pointed to, but that didn’t help

What errors do you get in the javascript console? Just press F12 on most browsers to open the console.

It doesn’t seem like I can get to it by pressing F12 as the error message is persistant even when I try to press “OK” it just pops back up again.

It should “give up” after the page has gone through all errors so keep pressing ok for a while.

Yes you are right,
I pressed a number of times is this is what I got:

Failed to load resource: the server responded with a status of 404 (Not Found)
api/appdaemon/state/…ow_temperature_1d:1 Failed to load resource: the server

So would it be safe to say that I am not getting a connection to my Home Assistant instance (on the same server)?
If so, should my references in my configuration to the HA URL be within quotes or not?
I see it both ways in the documentation.

Currently this is what I have in my appdaemon.yaml

logs:
  main_log:
    filename: /conf/logs/appdaemon.log
  error_log:
    filename: /conf/logs/error.log
appdaemon:
  latitude: !secret latitude
  longitude: !secret longitude
  elevation: 70
  time_zone: America/New_York
  threads: '10'
  disable_apps: 1
  plugins:
    HASS:
      type: hass
      ha_url: "http://192.168.xx.xx:8123"
      token: !secret token
http:
  url: "http://192.168.xx.xx:5050"
hadashboard:

Yes, it appears that you can’t connect to Home Assistant. Some things to check: is your secrets file named secrets.yaml and placed in the config folder?
Are you using a valid long-lived access token? I am not using any quotes whatsoever in my appdamon.yaml file, but qoutes or not shouldn’t make any difference.
Do you get any login errors in your Home Assistant log?

2 Likes

Also, what browser are you using? If Chrome, you can click on network in the console and then click XHR and hover over the list of requests. You should then be able to see what url the page is trying to call, and also see the server response if you click on one of the requests.

1 Like

Not really any progress, but do have some answers for you.
Yes, secrets.yaml file is in the config folder (same folder as appdaemon.yaml)
Yes, I still have a long-lived token that I have been using for a while now and haven’t changed it in my config file.
Errors in my HA log are currently related to either Dark Sky or Zigate, so I have removed any reference to weather in my dashboard.

Restarted Appdaemon a few times and was still seeing the error above, so I decided to comment out the following lines in my docker-compose file:

#      - HA_URL="http://192.168.xx.xx:8123"
#      - HA_KEY="LongStringTokenInsertedHere"
#      - DASH_URL="http://192.168.xx.xx:5050"

I don’t see any errors in the docker logs
I have checked the Network XHR and do see that it’s stopping on all entities in my dashboard. (Keep in mind that some of my dashboard is a copy of examples on github and I don’t have any corresponding in HA, but still the entities that I have in HA is causing errors)

The issues that I see in XHR is the following
404: Not Found
http://192.168.xx.xx:5050/api/appdaemon/state/default/light.kitchen_right
This entity is currently in my HA

Just for reference, this is my docker-compose part for appdaemon. Maybe this will help you:

  appdaemon_4:
    container_name: appdaemon_4
    image: acockburn/appdaemon:4.0.0
    depends_on:
      - hass
    ports:
      - 5050:5050
    restart: unless-stopped
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./volumes/appdaemon_4:/conf

And my appdaemon.yaml file:

secrets: /conf/secrets.yaml
logs:
  main_log:
    filename: /conf/logs/appdaemon.log
  error_log:
    filename: /conf/logs/error.log
  access_log:
    filename: /conf/logs/access.log
appdaemon:
  time_zone: 'Europe/Zurich'
  latitude: !secret latitude
  longitude: !secret longitude
  elevation: !secret elevation
  missing_app_warnings: 1
  production_mode: False
  app_dir: /conf/apps
  plugins:
    HASS:
      type: hass
      namespace: hass
      token: !secret appdaemon_token
      ha_url: http://192.168.0.5:8123
    MQTT:
      type: mqtt
      namespace: mqtt
      client_id: AD_4
      client_host: 192.168.0.5
      client_user: !secret mqtt_user
      client_password: !secret mqtt_password
http:
  url: http://192.168.0.5:5050
api:
hadashboard:
admin:
  title: AppDaemon
  stats_update: realtime
1 Like