Change dashboard on event?

at this moment all you can do is change the dashboard from ALL dashboards you have.
but you can set a time and then it goes back to the previous dashboard.

if you really want it to be at just 1 dashboard then you have 2 options:

  1. make a navigate button on the dashboard or
  2. make it happen at the client side and then fully is a good option.

I appreciate your quick reply. That’s what I figured. I’m using node-red to translate the motion event into a GET request to fully then 15 seconds later go back to the original dashboard. I assume that it would be faster not opening a new connection going directly from dashboard to dashboard with the events but I have about 10 tablets running and they all don’t need to show the camera at the same time.
Thanks ReneTode.

i theory you could also create a javascript inside your skin.
and that javascript would then do the navigate if a sensor is changed. but the sensor needs to be on the dashboard as well when you do that. (or you need to add some more javascript to start checking the state frequently, but you dont want to go that way)

The sensor is on the dashboard actually. Javascript isn’t really my strong suit though. I will have to look into it though. Thanks for the suggestion!

Sorry to bump this again, but I have been using a script just like this to automate a dashboard change when my front door motion is triggered for some time. I just upgraded my AppDaemon add-in from V3 to V4 and this automation no longer works, and nothing happens even if I try to trigger the script manually. Does something in the automation or script code need to change for this to work again with V4?

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?