Hi all,
I’m having issues with working out how to set up my Appdaemon script to be run by a button on the Home Assistant overview dashboard. I’m very new to HA/RPi/Appdaemon so bear with me.
My app is defined as:
import appdaemon.plugins.hass.hassapi as hass
import RPi.GPIO as GPIO
#
# Hellow World App
#
# Args:
#
class HelloWorld(hass.Hass):
def initialize(self):
self.log("Hello from AppDaemon")
self.log("You are now ready to run Apps!")
def trigger(self):
self.log("Triggering")
# Board Settings
switchPin = 14
GPIO.setmode(GPIO.board)
GPIO.cleanup()
GPIO.setup(switchPin, GPIO.OUT)
GPIO.output(switchPin, GPIO.HIGH)
So simply, when an event is triggered, I want Appdaemon to output on pin 14.But I don’t know how to set this event up?? I think I need to have the app listening for a state change when a button is pressed?? But I have no idea how to do this.
And yes, I do have a switch set up that triggers this output already, but this is the start of something more complex (I hope).
How do I create a button (entity??) on the Overview dashboard, that will allow me to call the trigger function in my app.
Apologies if this has been asked before, I have tried searching for it, but I cannot find anything that (A) answers my question, and (B) I can follow.
Thanks in advance!