Appdaemon and the new Authentication method

After I enable api_key - errors and exits.

2018-08-27 16:53:58.467084 INFO AppDaemon: HASS: Connected to Home Assistant 0.77.0b2

2018-08-27 16:53:58.479243 WARNING AppDaemon: HASS: Error in authentication

2018-08-27 16:53:58.479687 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds

2018-08-27 16:54:00.091065 INFO SIGTERM Recieved

2018-08-27 16:54:03.483450 INFO AppDaemon: HASS: Disconnecting from Home Assistant

2018-08-27 16:54:03.483945 INFO AppDeamon Exited

how and where did you set the password?

how does your appdaemon.yaml look?

log:

logfile: /home/homeassistant/.homeassistant/appdaemon/logfile.log
errorfile: /home/homeassistant/.homeassistant/appdaemon/error.log
accessfile: /home/homeassistant/.homeassistant/appdaemon/access.log
logsize: 10000
log_generations: 5
appdaemon:
logfile: STDOUT
errorfile: STDERR
threads: 10
app_dir: /home/homeassistant/.homeassistant/appdaemon/apps
api_key: !secret api_key
utility_delay: 5
utility_skew: 4
plugins:
HASS:
type: hass

your appdaemon.yaml is wrong.

you shouldnt set the api_key. that is for the api from appdaemon.

the plugin part should look like:

  plugins:
    HASS:
      type: hass
      ha_key: your ha api key
      ha_url: http://your ha ip:8123
      timeout: 60

and please present your yaml right. its hard to see if something else is wrong.

For whatever reason I cannot post it correctly - same error with the ha_key enabled.

so that has now worked, but it did not like the !secrets line -instead it seems to need the password directly in the appdaemon.yaml file

the secrets line only works if you create a secrets file for appdaemon. in the same dir as your appdaemon.yaml

and to post code use

` 3 times and then an enter
on an empty line before and after the code.

not a quote like this ’ but a `

Thanks Rene

I too am having problems with the new HASS (0.77.1) and appdaemon. I previously was NOT using authentication anywhere. After reading some of the threads here and the release notes for HASS, I made a bunch of changes but still can’t get appdaemon logged into HASS.

Here is my appdaemon.yaml file:

log:
  accessfile: /home/homeassistant/.appdaemon/log/access.log
  errorfile:  /home/homeassistant/.appdaemon/log/error.log
  logfile:    /home/homeassistant/.appdaemon/log/appdaemon.log
  log_generations: 5
  log_size: 65536
appdaemon:
  api_port: 5000
  threads: 10
  plugins:
    HASS:
      type: hass
      ha_url: http://localhost:8123
      ha_key: !secret home_assistant_key
hadashboard:
  dash_url: http://localhost:5050
  rss_feeds:
    - feed: http://rss.cnn.com/rss/cnn_topstories.rss
      target: news
  rss_update: 300

Here is the relevant portion of my configuraton.yaml file:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: ***
  longitude: ****
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 157
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/Chicago
  # Customization file
  customize: !include customize.yaml

  auth_providers:
    - type: homeassistant
    - type: legacy_api_password

# Show links to resources in log and frontend
#introduction:

# Enables the frontend
frontend:

# Enables configuration UI
config:

# Enables Python script processing
python_script:

auth:

http:
  api_password: !secret http_password

I still get these errors in the appdaemon.log file:

2018-08-31 08:26:29.356869 INFO AppDaemon: HASS: Connected to Home Assistant 0.77.1
2018-08-31 08:26:29.362443 WARNING AppDaemon: HASS: Error in authentication
2018-08-31 08:26:29.363735 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-08-31 08:26:34.393145 INFO AppDaemon: HASS: Connected to Home Assistant 0.77.1
2018-08-31 08:26:34.399790 WARNING AppDaemon: HASS: Error in authentication
2018-08-31 08:26:34.402093 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds

and these errors in the home assistant log:

2018-08-31 08:27:14 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 127.0.0.1
2018-08-31 08:27:19 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 127.0.0.1
2018-08-31 08:27:24 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 127.0.0.1

Can I just roll back HASS to an older version to get going again?

I was in this situation, and I managed to get it to work (at least on my test configuration) with

  auth_providers:
    - type: trusted_networks
http:
  # Uncomment this to add a password (recommended!)
  api_password: PASSWORD
  trusted_networks:
    - 127.0.0.1
    - ::1
    - 192.168.0.0/24
    - fd00::/8

obviously, you may need to adjust the network address for your network.

Are you using hassIO or some other install?

I have used

pip3 install homeassistant==0.70.0

as a roll back before.

Works for me just the api password set under http. Needed to restart appdaemon for some reason though

i hope you did create a new secret file for that?
you cant expect AD to know where your HA secret file is.
so AD expects a sercet file inside the appdaemon conficuration directory.

Yes, I did. Thanks for the idea.

did you try to put in the api password directly ( i know others who have had problems with the secret file)?
and what system do you use? hassio, docker, hassbian with venv?

with a docker i believe you need to change somethings else (but i dont know what because im not using it)
with hassio localhost could be the problem

the ha_url normally is the url that you can use in a browser to reach HA.

I’m using hassbian with a venv for both hass and appdaemon.

I got it working by rebooting the rPi. At least there are no login errors now. We’ll see if everything else works.

Thanks for all of the help.

1 Like