Change dashboard on event?

the app is updated for AD 4 (if we talk about the same app)

Sorry, but I don’t follow about the app update? I didn’t add the app until I had already updated from AD3 to AD4 as my script to do the navigation stopped working when I moved to AD4 so the app idea was mentioned above. Unfortunately, I can’t get the app working with AD4 either so I just done have my automatic navigation working on the dashboard.

ah, sorry. i mixed up 2 topics in my head and was thinking about another app :wink:

the navigate app you got is working correct. (according to the logs.)
to get it working you need to add an hadashboard event to HA.

Ah good to hear about the app, I had been trying to use my Navigate script in HA but is that not an HAdashboard event? Here is the script I am using again, I thought this was correct to trigger the app


frontdoor_hadashboard:
  alias: Navigate
  sequence:
  - event: hadashboard
    event_data:
      command: navigate
      timeout: 20
      target: Hello3Test

i am sorry, but i have never created events in HA, and have no clue about them.
but i can help to change the app so that you dont need the HA event.

but you need to show me the automation that triggers the script also.

Thanks for the help, here is the Automation that triggers the script:

- alias: Dashboard Front Cam
  initial_state: true
  hide_entity: true
  trigger:
    platform: state
    entity_id: binary_sensor.front_door_motion
  action:
    - service: script.turn_on
      entity_id: script.frontdoor_hadashboard 

and here is the script again:

frontdoor_hadashboard:
  alias: Navigate
  sequence:
  - event: hadashboard
    event_data:
      command: navigate
      timeout: 20
      target: Hello3Test

shouldnt you provide a state for the trigger?

an app that listens for a sensor state would be like this:

import appdaemon.plugins.hass.hassapi as hass

class Navigate(hass.Hass):
    def initialize(self):
      # Listen for the state change from the entity.
      self.listen_state(self.navigate,self.args["entity"], new=self.args["state"])

    def navigate(self, entity, attribute, old, new, kwargs):
        # Get the target from the args.
        target = self.args["target"]
        # Get the timeout from the args, if supplied.
        if 'timeout' in self.args:
            timeout = self.args['timeout']
            self.dash_navigate("/" + target, timeout=timeout)
        else: 
            self.dash_navigate("/" + target)

then in the apps.yaml you use it like:

front_door_motion: #the name from the app
  module: navigate
  class: Navigate
  entity: binary_sensor.front_door_motion # or any other entity
  state: "on" # the state to listen for
  target: Hello3Test # the dashboardname
  timeout: 20 # the amount of time the dashboard stays visible

you can create as many apps as you want, just by adding this YAML to the apps.yaml file again, with another appname.

Thanks again, the script had been working without that state trigger, but I see your point and it makes sense to have it in there as you do in your apps.yaml. I have updated my app with your code (and changed the app name to front_door_motion.py) and updated my apps.yaml with your code as well. Still not triggering on motion, but I see in the AD log that is says the app was ignored because it does not have a description, do I need to make an adjustment? Here is the AD log:

[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.2
 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.
[11:34:41] INFO: Starting AppDaemon...
2020-01-21 11:34:42.808518 INFO AppDaemon: AppDaemon Version 4.0.1 starting
2020-01-21 11:34:42.809176 INFO AppDaemon: Python version is 3.8.1
2020-01-21 11:34:42.809791 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2020-01-21 11:34:42.810372 INFO AppDaemon: Added log: AppDaemon
2020-01-21 11:34:42.810961 INFO AppDaemon: Added log: Error
2020-01-21 11:34:42.811524 INFO AppDaemon: Added log: Access
2020-01-21 11:34:42.812048 INFO AppDaemon: Added log: Diag
2020-01-21 11:34:42.852201 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2020-01-21 11:34:42.907144 INFO HASS: HASS Plugin Initializing
2020-01-21 11:34:42.908016 INFO HASS: HASS Plugin initialization complete
2020-01-21 11:34:42.909162 INFO AppDaemon: Initializing HTTP
2020-01-21 11:34:42.910218 INFO AppDaemon: Using 'ws' for event stream
2020-01-21 11:34:42.933287 INFO AppDaemon: Starting API
2020-01-21 11:34:42.942976 INFO AppDaemon: Starting Admin Interface
2020-01-21 11:34:42.944039 INFO AppDaemon: Starting Dashboards
2020-01-21 11:34:42.967138 INFO HASS: Connected to Home Assistant 0.104.2
2020-01-21 11:34:43.068486 INFO AppDaemon: App 'front_door_motion' added
2020-01-21 11:34:43.070791 INFO AppDaemon: Found 1 total apps
2020-01-21 11:34:43.072251 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2020-01-21 11:34:43.075899 INFO AppDaemon: Running on port 5050
2020-01-21 11:34:43.246888 INFO HASS: Evaluating startup conditions
2020-01-21 11:34:43.336597 INFO AppDaemon: Got initial state from namespace default
2020-01-21 11:34:43.623183 INFO AppDaemon: New client Hello Panel connected
2020-01-21 11:34:45.088737 INFO AppDaemon: Scheduler running in realtime
2020-01-21 11:34:45.102778 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2020-01-21 11:34:45.107855 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/front_door_motion.py - ignoring
2020-01-21 11:34:45.109986 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/hello.py - ignoring
2020-01-21 11:34:45.112310 INFO AppDaemon: App initialization complete
2020-01-21 11:34:47.718594 INFO AppDaemon: New client Hello Panel connected

you didnt read my instructions right.
you shouldnt have renamed the py file.

the name from the app is set in the yaml, and you connect the apps yaml and the apps py file with

module: name_of_py_file

so you need to change the name from the py file back, or change the yaml.

Ah success! Thank you ReneTode for your help and patience with me, I wasn’t getting the naming at first. The dashboard is now correctly changing on the motion at the door.

1 Like

great. glad to hear it did work at last.

1 Like