Change dashboard on event?

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.

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

Hello, everyone. Was hoping to get a little help with changing the Dashboard upon the doorbell motion (or ringing). So far, I think the issue may be with the event, “hadashboard”, in the script. I have:

Installed AppDaemon from the Home Assistant Community Add-ons repository.

Created a python script named navigatedoorbell.py in Notepad++ with the below contents:

navigatedoorbell.py

import appdaemon.plugins.hass.hassapi as hass

class NavigateDoorbell(hass.Hass):
    def initialize(self):
      self.listen_state(self.navigate,self.args["binary_sensor.doorbell_global_motion_sensor"], new=self.args["True"])

    def navigate(self, entity, attribute, old, new, kwargs):
        target = self.args["True"]   # What is this value? Do I set this to the same as the new=self.args state above?
        if 'timeout' in self.args:
            timeout = self.args['30']
            self.dash_navigate("/" + target, timeout=timeout)
        else: 
            self.dash_navigate("/" + target)

Next, I configured both apps.yaml and appdaemon.yaml:

apps.yaml

doorbell_navigate:   # Am I creating the app name here, or was it created somewhere else?
  module: navigatedoorbell
  class: NavigateDoorbell
  entity: binary_sensor.doorbell_global_motion_sensor
  state: "True" 
  target: Doorbell    # "Doorbell" is both the Dashboard name and the Dashboard Page name. The path is "doorbell". Do I use "doorbell" here instead?
  timeout: 30

appdaemon.yaml

---
secrets: /config/secrets.yaml    # Do I need to do anything in secrets.yaml?
appdaemon:
  latitude: 12.345678
  longitude: 12.345678
  elevation: 1
  time_zone: America/New_York
  plugins:
    HASS:
      type: hass
      ha_url: https://myhomeassistant.duckdns.org:8123
http:
  url: http://127.0.0.1:5050   #Do I need to do anything with this?
admin:
api:
hadashboard:

Then, finally the script and automation:

Script

doorbell_hadashboard:
  alias: Navigate Doorbell
  sequence:
  - event: hadashboard
    event_data:
      command: navigate
      timeout: 30
      target: Doorbell

Automation

- alias: Doorbell Motion Navigate
  initial_state: true
  hide_entity: true
  trigger:
  - platform: state
    entity_id: binary_sensor.doorbell_global_motion_sensor
    to: 'True'
  - platform: state   # Do I need to make a spearate app for this trigger?
    entity_id: binary_sensor.doorbell_ringing_sensor
    to: 'True'
  action:
    - service: script.turn_on
      entity_id: script.doorbell_hadashboard

Anyone see anything? Note that I did not set a Long-Lived Access Token. Also, I did not do anything with configuration.yaml. Did I need to add the below?

appdaemon: !include apps.yaml   # or appdaemon.yaml?

Any answers to the notes above would be greatly appreciated.

Just installed Fully Kiosk integration and Android App on my wall tablet. This was a million times easier using Fully Kiosk’s service calls. Installation and automation/script took less than an hour with little online help. Would have been nice to get the above python script working, considering I spent all day on it. If you’re attempting an automation like this, just do Fully Kiosk. There are a few Web Settings within Fully Kiosk app that looked important for this script, so I enabled them.

alias: Navigate Doorbell
sequence:
  - type: turn_on
    device_id: 17d3b66a5b0cab67383ac1f280fdf3d7
    entity_id: light.master_bedroom_walltab_screen
    domain: light
  - service: fullykiosk.load_url
    data:
      entity_id: media_player.master_bedroom_walltab_media_player
      url: https://myhomeassistant.duckdns.org/lovelace-doorbell/doorbell
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - service: fullykiosk.load_url
    data:
      entity_id: media_player.master_bedroom_walltab_media_player
      url: https://myhomeassistant.duckdns.org/lovelace-poodstab/security
1 Like

Hey,

I tried this and it worked ok, the problem is that it will reload the browser and that takes some extra time. So I tried the same approach but with “Browser mod”

https://github.com/thomasloven/hass-browser_mod

With browser mod you can call ‘navigate’ and it will be instant navigation. I’m using views/tabs in my dashboard so I’m not really changing dashboard.

alias: Control Panel - Change dashboard to security
description: ""
trigger:
  - platform: device
    device_id: 8beda8602428b831c14ff8f70793437a
    domain: nest
    type: camera_person
condition: []
action:
  - service: browser_mod.navigate
    data:
      path: http://192.168.1.197:8123/dashboard/security
    target:
      device_id: 79027adc06d442646b3ea96351743b05
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - service: browser_mod.navigate
    data:
      path: http://192.168.1.197:8123/dashboard/0
    target:
      device_id: 79027adc06d442646b3ea96351743b05
mode: single

edit: to clarify, I do run it in Fully, but in this case i let browser mod control Fullys browser.

Cheers

2 Likes