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.