I’m just getting started with AppDaemon - it took me a while to even grasp the concept. I got some well-deserved (but mild) abuse from Rene, the author of AppDaemon For Beginners..
I’m confused by the usage of parameters in AD classes. Now that I understand that AppDaemon apps run continuously (instead of being called like scripts like I originally thought), I’m trying to code something that will take arbitrary parameters. I’m still working with the “turn on a lightbulb” example.
The apps.yaml
setup in the example shows an app & class setup like this:
some_light_on:
module: some_app
class: your_class_name
lightID: light.some_light
some_other_light_on:
module: some_app
class: your_class_name
lightID: light.some_other_light
To me, that looks like two entries for two specific light entities. How do I configure the “param” (4th line) configuration in apps.yaml
to take one of many entities?
I’m building a Harmony remote control with a bunch of icons and tap_action: call-service
entries. In my AppDaemon code, I’m using listen_event
to try and detect the clicks on the various icon “buttons”. Those buttons need to send various kinds of data back to AppDaemon. AppDaemon will then shuffle and sort the various arguments before sending the command to the Harmony system.
I know there’s the var1 = args["param1"]
usage within the AppDaemon Python code, but I’m not clear on how it fits into the initialization statement, or whether or not those need to be defined in apps.yaml
.
What I think I want to code in my UI YAML is something like this (pseudocode)
- script
custom_remote:
- service: turn_on_activity
data: Watch TV
- script
custom_remote:
- service: turn_on_activity
data: Play Xbox
— and —
- script
custom_remote:
- service: change_channel
data: [3, 1, 7]
This kind of behavior is possible, isn’t it? I’m confused by those settings in apps.yaml
and the use of args["params"]
.
Can someone help clarify?
Thanks.