Please post the script so we can have a look.
Here is the script I have been using:
frontdoor_hadashboard:
alias: Navigate
sequence:
- event: hadashboard
event_data:
command: navigate
timeout: 20
target: Hello3Test
Looks like it has stopped working. You can use an Appdaemon app until it is fixed:
Create a file named navigate.py
with the following content and place in the apps
folder:
import appdaemon.plugins.hass.hassapi as hass
class Navigate(hass.Hass):
def initialize(self):
# Listen for the hadashboard event to be fired.
self.listen_event(self.navigate,"hadashboard")
def navigate(self, event_name, data, kwargs):
# Get the target from the event data.
target = data['event_data']['target']
# Get the timeout from the event data, if supplied.
if 'timeout' in data['event_data']:
timeout = data['event_data']['timeout']
self.dash_navigate("/" + target, timeout=timeout)
else:
self.dash_navigate("/" + target)
Create a file named apps.yaml
in the same folder and add the following to the file:
Nav:
module: navigate
class: Navigate
You might need to restart Appdaemon now.
Fire the event from the developer page in HA or trigger your script.
Thanks for this! I will give it a shot in the morning.
Hi Tomas - I have created the two files, cut and pasted your code, and placed them in my appdaemon\apps directory, but when I try to trigger the script nothing happens. I have rebooted HASSIO as well, but not change. Is there a way to test the py code directly or some other troubleshooting I could try? Could there be an authentication issue with the code? I seem to be getting some attempted login errors from HA that have popped up once I added this py code.
Are you running any other Appdaemon apps? You might have apps disabled in your appdaemon.yaml file. Please post your appdaemon.yaml file so I can have a look. Are you running Appdaemon in Docker? Ther error might be from an incorrect long lived access token. Please also post the HA error from the log.
The app is written for Appdaemon 4 and should work without any changes.
I’m not running any other apps (at least that I am aware of), I this all installed as part of a HASSIO install, so not sure exactly what container HASSIO uses for appdaemon. I can’t actually get the login error to recreate at the moment, so perhaps that is not related here, I will keep an eye out for it and post the log when I see it again. Here is my appdaemon.yaml details:
secrets: /config/secrets.yaml
appdaemon:
latitude: 40.625931
longitude: -75.370461
elevation: 111
time_zone: America/New_York
plugins:
HASS:
type: hass
http:
url: http://127.0.0.1:5050
hadashboard:
admin:
api:
You are missing the long lived access token and the ha_url
entry compared to my appdaemon.yaml: You need to create a long-lived accesss token from the HA frontend, but this might be handled by hassio automatically on setup (I am not sure since I am not running hassio).
secrets: /config/secrets.yaml
appdaemon:
latitude: 40.625931
longitude: -75.370461
elevation: 111
time_zone: America/New_York
plugins:
HASS:
type: hass
ha_url: http://192.168.x.x:8123 # The url and port for your HA instance
token: xxxxxxxxxxxxxxxxxxx # A long-lived access token created in HA
http:
url: http://127.0.0.1:5050
hadashboard:
admin:
api:
Here is how to create the long-lived access token from the Appdaemon docs: https://appdaemon.readthedocs.io/en/latest/CONFIGURE.html#hass-authentication
longlived token isnt needed for the addon
As ReneTode notes, adding the access token doesn’t help (in fact it created many more login errors). Do we know if the scripting support will be fixed in a future release so I can simply wait and use that in the near future?
i only saw here that it was broken, and @aimc said that he would look at it before the next release.
but if you dont get this app working i expect you got another problem somewhere.
Thanks and yes it is odd I can’t get the app working, was trying to determine what other ways I could troubleshoot that part.
I’m getting a bunch of these errors in the log, but can’t figure out how to address it? Any suggestions are appreciated
20-01-20 18:12:22 INFO (MainThread) [hassio.api.proxy] WebSocket access from a0d7b954_appdaemon
20-01-20 18:12:22 ERROR (MainThread) [hassio.api.proxy] Client error on WebSocket API Cannot connect to host 172.30.32.1:8123 ssl:False [Connection refused].
20-01-20 18:12:27 INFO (MainThread) [hassio.api.proxy] Home Assistant WebSocket API request initialize
seems that AD cant connect to HA.
which version from AD are you using?
and what is in the logs from AD when you restart AD?
I did just update HASSIO to the latest version so I am not currently seeing that WebSocket API error anymore, but I am getting this error pop up in the HA dashboard repeatedly when it is starting up - Login attempt or request with invalid authentication from 173.244.223.122 , I just can’t find that in the logs.
Here are the Logs from AD after restart:
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing...
-----------------------------------------------------------
Hass.io Add-on: AppDaemon 4
Python Apps and Dashboard using AppDaemon 4.x for Home Assistant
-----------------------------------------------------------
Add-on version: 0.1.1
You are running the latest version of this add-on.
System: HassOS 3.5 (armv7 / raspberrypi4)
Home Assistant version: 0.104.2
Supervisor version: 195
-----------------------------------------------------------
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing...
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] appdaemon.sh: executing...
[cont-init.d] appdaemon.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[14:32:40] INFO: Starting AppDaemon...
2020-01-20 14:32:42.296054 INFO AppDaemon: AppDaemon Version 4.0.0 starting
2020-01-20 14:32:42.296866 INFO AppDaemon: Python version is 3.8.1
2020-01-20 14:32:42.297499 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2020-01-20 14:32:42.298198 INFO AppDaemon: Added log: AppDaemon
2020-01-20 14:32:42.298772 INFO AppDaemon: Added log: Error
2020-01-20 14:32:42.299371 INFO AppDaemon: Added log: Access
2020-01-20 14:32:42.299885 INFO AppDaemon: Added log: Diag
2020-01-20 14:32:42.338433 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2020-01-20 14:32:42.398905 INFO HASS: HASS Plugin Initializing
2020-01-20 14:32:42.399946 INFO HASS: HASS Plugin initialization complete
2020-01-20 14:32:42.401428 INFO AppDaemon: Initializing HTTP
2020-01-20 14:32:42.402609 INFO AppDaemon: Using 'ws' for event stream
2020-01-20 14:32:42.425402 INFO AppDaemon: Starting API
2020-01-20 14:32:42.434954 INFO AppDaemon: Starting Admin Interface
2020-01-20 14:32:42.436043 INFO AppDaemon: Starting Dashboards
2020-01-20 14:32:42.458717 INFO HASS: Connected to Home Assistant 0.104.2
2020-01-20 14:32:42.530235 INFO AppDaemon: App 'Nav' added
2020-01-20 14:32:42.532507 INFO AppDaemon: Found 1 total apps
2020-01-20 14:32:42.534045 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2020-01-20 14:32:42.536843 INFO AppDaemon: Running on port 5050
2020-01-20 14:32:42.634822 INFO HASS: Evaluating startup conditions
2020-01-20 14:32:42.689162 INFO AppDaemon: Got initial state from namespace default
2020-01-20 14:32:43.072014 INFO AppDaemon: New client Hello Panel connected
2020-01-20 14:32:44.547689 INFO AppDaemon: Scheduler running in realtime
2020-01-20 14:32:44.565383 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2020-01-20 14:32:44.570606 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hello.py - ignoring
2020-01-20 14:32:44.572735 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/navigate.py
2020-01-20 14:32:44.584386 INFO AppDaemon: Initializing app Nav using class Navigate from module navigate
2020-01-20 14:32:44.593030 INFO AppDaemon: App initialization complete
do you have a dashboard with a camera?
then the problem is that you leave that on while restarting.
I do have a dashboard (several actually) using my camera stream from HA, so that error is about the connection to the camera? I assume it’s not big issue then if I am getting those login errors just at the start of reboot? Hmm, I was hoping that had something to do with my Navigate app still not working.
did you update the navigate app today?
No, I made no changes to the Navigate app, it just still does not work for me.