Yes, you have it right. That’s where I started, and I went from there, morphing over time as I came to understand both what I could do with ST, and what worked for us in our house. I don’t have the code anymore, but here’s a crack at what I first did, which was adding a tiny bit of code to Scene Machine:
in preferences add:
section("Activate the scene when this...") {
input "button", "capability.momentary",
multiple: false,
title: "Momentary button is pushed...",
required: false
}
This gives us the “hook” into Scene Machine of a button that can be pressed, or turned on by another app. One cool feature of a Momentary Tile Button is that when you press it it generates a “switch.on” event, and then right away turns back off. That’s helpful so that it will be ready to go the next time. The next bit of code subscribes to the button push, and links it into Scene Machine.
In both installed() and updated() add:
subscribe(button, "switch.on", appTouch)
That’s all there is to it. “appTouch” is the same method used when Scene Machine is invoked from the mobile app by touching its tile. It took me longer to figure out how to come up with a Momentary Tile Button than to figure out the code. That’s done in the IDE “My Devices”, New Device, and then selecting the type of device (along with name and address).
With the Momentary Tile Button created in the IDE, and the modified app installed, the Button can be turned on by Hello Home Phrases or other apps, which will activate the scene in Scene Machine; the Button can be selected wherever an app calls for a switch. Another use example would be to include the Momentary Tile Button in an ActiON dashboard. It can be pressed on the dashboard, and that would activate the scene.
Bruce