Community Hass.io Add-on: AppDaemon 3

I guess port 5000 and 5001 are used by something else … strange, I haven’t touched them in the past, I put 5009 and now its working.

I don’t know what that port is for though … I always use 5050

:tada: Release v1.3.0

Full Changelog

Changed

  • Upgrades base image to v2.0.0
  • Upgrades Hadolint to the latest version
  • Upgrades gcc to 6.4.0-r8
  • Upgrades python to 3.6.4-r1
  • Upgrades base image to v2.0.1
1 Like

Appdaemon doesn’t work since yesterday. It seems like the same problem as on Node Red.

Home assistant says: "Login attempt failed

Login attempt or request with invalid authentication from 172.30.32.2"

One of the entries in the error log:
2018-07-24 21:39:14.264836 WARNING AppDaemon: ------------------------------------------------------------
2018-07-24 21:46:24.367466 WARNING AppDaemon: ------------------------------------------------------------
2018-07-24 21:46:24.368382 WARNING AppDaemon: Unexpected error in worker for App Motion_with_dimming:
2018-07-24 21:46:24.369280 WARNING AppDaemon: Worker Ags: {‘name’: ‘Motion_with_dimming’, ‘id’: UUID(‘796cace4-da6c-42cf-8954-b610ebfe83a5’), ‘type’: ‘attr’, ‘function’: <bound method motion_dimming.motion_on of <motion_dim.motion_dimming object at 0x746311d0>>, ‘attribute’: ‘state’, ‘entity’: ‘binary_sensor.sensor’, ‘new_state’: ‘on’, ‘old_state’: ‘off’, ‘kwargs’: {‘new’: ‘on’, ‘handle’: UUID(‘e35e7a6b-36f0-4190-a370-1a67092f66cd’)}}
2018-07-24 21:46:24.370021 WARNING AppDaemon: ------------------------------------------------------------
2018-07-24 21:46:24.373026 WARNING AppDaemon: Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py”, line 590, in worker
self.sanitize_state_kwargs(app, args[“kwargs”]))
File “/config/appdaemon/apps/motion_dim.py”, line 15, in motion_on
self.turn_on(self.args[“lightID”], brightness_pct = desired_dimval)
File “/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py”, line 22, in func_wrapper
return func(*args, **kwargs)
File “/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py”, line 330, in turn_on
self.call_service(“homeassistant/turn_on”, **rargs)
File “/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py”, line 22, in func_wrapper
return func(*args, **kwargs)
File “/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassapi.py”, line 457, in call_service
r.raise_for_status()
File “/usr/lib/python3.6/site-packages/requests/models.py”, line 939, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://hassio/homeassistant/api/services/homeassistant/turn_on
2018-07-24 21:46:24.373961 WARNING AppDaemon: ------------------------------------------------------------

I have basically the same problem with HADashboard

2018-07-23 19:44:40.639559 WARNING HADasboard: ------------------------------------------------------------
2018-07-23 19:44:40.640156 WARNING HADasboard: Unexpected error in call_service()
2018-07-23 19:44:40.641790 WARNING HADasboard: ------------------------------------------------------------
2018-07-23 19:44:40.644942 WARNING HADasboard: Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/appdaemon/rundash.py”, line 341, in call_service
await plugin.call_service (service, **args)
File “/usr/lib/python3.6/site-packages/appdaemon/plugins/hass/hassplugin.py”, line 360, in call_service
r.raise_for_status()
File “/usr/lib/python3.6/site-packages/aiohttp/client_reqrep.py”, line 718, in raise_for_status
headers=self.headers)
aiohttp.client_exceptions.ClientResponseError: 401, message=‘Unauthorized’

The issue has been identified and is with the Hass.io Supervisor.
A fix will be implemented asap.

Supervisor 120 has been release, addressing this issue.

image

Hit the reload button to trigger the refresh, hit update to install.

I’m running Hass.io on top of resinOS and everything was working great. Last night I tried upgrading Hass from 0.73.2 to 0.75.2 and AppDaemon stopped working. So I downgraded to 0.73.2 and kept getting the same errors. I even restored a snapshot of a working system and it’s still broken.

Here is the Supervisor log:

    18-08-09 14:50:51 ERROR (MainThread) [asyncio] Task exception was never retrieved
    future: <Task finished coro=<WebSocketWriter.ping() done, defined at /usr/local/lib/python3.7/site-packages/aiohttp/http_websocket.py:617> exception=RuntimeError('unable to perform operation on <TCPTransport closed=True reading=False 0x7197a030>; the handler is closed')>
    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/site-packages/aiohttp/http_websocket.py", line 621, in ping
        return await self._send_frame(message, WSMsgType.PING)
      File "/usr/local/lib/python3.7/site-packages/aiohttp/http_websocket.py", line 603, in _send_frame
        self.transport.write(header + message)
      File "uvloop/handles/stream.pyx", line 671, in uvloop.loop.UVStream.write
      File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
    RuntimeError: unable to perform operation on <TCPTransport closed=True reading=False 0x7197a030>; the handler is closed
    18-08-09 14:50:51 INFO (MainThread) [hassio.api.proxy] Home-Assistant Websocket API request initialze
    18-08-09 14:50:51 INFO (MainThread) [hassio.api.proxy] Websocket access from a0d7b954_appdaemon3
    18-08-09 14:50:52 ERROR (MainThread) [hassio.homeassistant] Can't update HomeAssistant access token!
    18-08-09 14:50:52 ERROR (MainThread) [hassio.api.proxy] Failed authentication to HomeAssistant websocket

Here is my appdaemon.yaml file:

log:
  logfile: /config/appdaemon/applogs/appdaemon.log
  log_size: 16384
  errorfile: /config/appdaemon/applogs/appdaemon.err
appdaemon:
  threads: 10
  app_dir: /config/appdaemon/apps
  api_port: 5000
  plugins:
    HASS:
      type: hass
      ha_url: http://192.168.0.3:8123
      ha_key: !secret home_assistant_key
hadashboard:
  dash_url: http://127.0.0.1:5050
  dash_dir: /config/appdaemon/dashboards

I am running behind an Apache reverse proxy, but like I said, this was working. This new authentication system is going to be the death of me.

did you change to the new user password authentication?
that isnt supported by AD yet.
but if i am correct you can change back to the old authentication way

I’ve tried it both ways.

Further checking shows that connections from my proxy machine into the Hass machine are being rejected by the Hass machine, so none of the reverse proxy authentication is working. I’m trying to figure out if resinOS (or Hass.io) has some kind of automatic IP blocking that would lock out my proxy machine. This is so strange. I’m about to nuke and pave, but I already did that about three weeks ago in response to problems I had with HassOS and Hass 0.74, so I’m not anxious to waste more time.

sorry i cant help you with that part.
i just wanted to make sure that you knew that the new authentication isnt supported by AD.(yet)
i never have worked with hassio, so i am not familiar with the problems that come with that.
i hope you find out what the problem is.

Today an update has been released for the Supervisor (125) and Home Assistant (0.75.3) to address authentication issues.

:tada: Release v1.4.0

Full Changelog

Fixed

  • Fixes YAMLlint error
  • Fixes incorrect processing of Hassio API token

Changed

  • Upgrades Base image to 2.1.1
  • Replaces Python yq with yq from base image
  • Sets default shell
  • Updates README and links

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

:tada: Release v1.4.1

Full Changelog

Changed

  • Upgrades base image to v2.1.2

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

1 Like

I’m not sure whether this is due to the latest update, or a change in the repo, but I’m using the python3-dev system package, which no longer seems to work due to version constraints elsewhere.

Config:

{
  "log_level": "info",
  "system_packages": [
    "linux-headers",
    "build-base",
    "python3-dev"
  ],
  "python_packages": [
    "bs4",
    "pychromecast"
  ]
}

This worked before, but now it results in this version constraint error:

ERROR: unsatisfiable constraints:
  python3-3.6.4-r1:
    breaks:
            python3-dev-3.6.6-r0[python3=3.6.6-r0]
    satisfies: world[python3=3.6.4-r1]
FATAL: Failed installing package python3-dev

@DarkFox

Python is installed in the container as well, but seems like a new version has been released between the last release of the add-on and now.

The version of python-dev you install now, does not match the Python installed in the container. Try adding the python3 package tot the system_packages. That will trigger the install of the matching Python version.

1 Like

That did the trick, thanks! :slight_smile:

1 Like

After update from 0.66.2 to HA 0.77.2 all sensors, switches etc. disappeared from all HADashboards.
I run Hassio on HassOS 2.2

AppDaemon log:

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing... 
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 20-init-configuration.sh: executing... 
[cont-init.d] 20-init-configuration.sh: exited 0.
[cont-init.d] 21-compiled-dir.sh: executing... 
[cont-init.d] 21-compiled-dir.sh: exited 0.
[cont-init.d] 30-auto-password.sh: executing... 
[cont-init.d] 30-auto-password.sh: exited 0.
[cont-init.d] 31-ha-url.sh: executing... 
[cont-init.d] 31-ha-url.sh: exited 0.
[cont-init.d] 50-compiled-symlink.sh: executing... 
[cont-init.d] 50-compiled-symlink.sh: exited 0.
[cont-init.d] 80-system-packages.sh: executing... 
[cont-init.d] 80-system-packages.sh: exited 0.
[cont-init.d] 81-python-packages.sh: executing... 
[cont-init.d] 81-python-packages.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2018-09-02 18:09:41.626196 INFO AppDaemon Version 3.0.1 starting
2018-09-02 18:09:41.627333 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2018-09-02 18:09:41.633815 INFO AppDaemon: Starting Apps
2018-09-02 18:09:41.652106 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-09-02 18:09:41.756655 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-09-02 18:09:41.759153 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-09-02 18:09:41.760999 INFO Starting Dashboards
2018-09-02 18:09:41.806596 INFO API is disabled
2018-09-02 18:09:41.855102 INFO AppDaemon: HASS: Connected to Home Assistant 0.77.2
2018-09-02 18:09:42.567794 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-09-02 18:09:47.600306 INFO AppDaemon: HASS: Connected to Home Assistant 0.77.2
2018-09-02 18:10:58.566735 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-09-02 18:11:03.597973 INFO AppDaemon: HASS: Connected to Home Assistant 0.77.2
2018-09-02 18:11:04.290430 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-09-02 18:11:09.325027 INFO AppDaemon: HASS: Connected to Home Assistant 0.77.2

Should be anything changed in settings?

did you use a password before? because now its needed to set an api password.

Appdaemon is 1 of the programs that needs the legacy password.

Yes, I use password, stored in secrets.yaml.
If I open HADashboard, it asks password after entering it dashboard opens, but instead of every single item is info “cannot find …”
The only items properly displayed and working are clock, iframes, navigate widgets and reload.

this is appdaemon.yaml

secrets: /config/secrets.yaml
log:
  logfile: STDOUT
  errorfile: STDERR
appdaemon:
  disable_apps: 1
  threads: 10
  app_dir: /config/appdaemon/apps
  plugins:
    HASS:
      type: hass
      ha_url: http://hassio/homeassistant
      ha_key: b7a78b1e4e35441c929dd5...................
hadashboard:
  dash_url: http://192.168.1.xxx:5050
  dash_dir: /config/appdaemon/dashboards
  dash_password: !secret dash_password

i didnt mean password in dashboard but in Homeassistant.
do you have

http:
  api_password: !secret http_password

in your home assistant configuration and is that the same as your ha_key in the appdaemon.yaml?