Is there a SmartApp to create and trigger lighting scenes?

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

2 Likes

I did the exact same enhancement a year or so ago, but didn’t share it :smiling_imp:

It would be a fun challenge to create a Device Type that automatically generated “scene buttons”…

1 Like

Yep, it works for me! Thanks Twack!

We are looking at building out more tutorials, as well as better integrating community-developed examples and tutorials. The tutorials we currently have are somewhat buried in our current docs structure.

@mager added a public repo where we can host examples here. If there is some specific code that would make for a good example there, we would love a PR to that repo.

I came up with another hacked variant of Scene Machine. This one uses a contact sensor, that when opened saves the state of some lights, and then turns them on full bright. When the contact closes it restores the previous state. The intended application is for a closet light where there is no light in the closet, but just outside in the hall. Scene Machine core (getDeviceSettings() and setScene()) becomes a very handy general purpose tool for saving and restoring the state of some switches and dimmers.

Code is here: https://github.com/bravenel/SmartThings/blob/master/Brighten%20When%20It%20Opens

1 Like

And the new guy chucks his hat into the scene foray…

1 Like

Many of you probably already know this, but a friend of mine ran into some problems elsewhere so just wanted to mention it…

The zigbee ZLL standard only applies to lighting. (Will be folded back into zigbee 3.0 when it comes out.)

Consequently unlike most home automation standards it has many different network device types for “light bulb.”

Specifically, it has different network device types for on/off bulb, bulb that dims, bulb without color, bulb with color, bulb that doesn’t change color but can change “temperature” (cool white to warm white).

The reason for splitting these out by device type rather than capabilities of just a bulb was to allow for making each bulb as dumb as possible to reduce cost and complexity.

My friend said Cree, GE link, and Hue are three different ZLL bulb types. Hence some of the problems being seen in the controllerverse (not just ST) since that’s just a really different way to approach the issue. They can still all talk to each other, but my friend said they don’t always listen–a ZLL node will ignore an entire command intended for a different device type, not just skip the parameters it doesn’t support.

Anyway, just a FWIW, I haven’t tried any of this myself.

1 Like

I got Scene Machine setup and working great. Question is, how can I “play” a scene automatically at sunset?

Completely lost on what should be something simple; I must be missing something somewhere…

You need a minor change to Scene Machine to add a virtual button that can trigger the app. That button can be turned on from a Hello Home phrase that runs at sunset. I posted the additional code and instructions you need above in this thread.

2 Likes

@bravenel Bruce: Thanks again, finally got around to implementing your code and got my scene working at sunrise.

Although not at all straightforward, I can follow the logic. There really should be an easier way of doing something so simple, though.

1 Like

Hi

I have installed Scene Machine and when I install (or update) it I see in the IDE Logs that the bulbs are found and the levels and colors are read from them. When I trigger the scene however, the bulbs turn on but just to whatever their last state (brightness and color) was. Effectively I only have have switch on/off function at this stage.

Any ideas why this may be happening, or suggestions how I can debug the issue.

I am very new to ST, smartapps, IDE etc.

Thanks!
Brent

When I add this code to Scene Machine, and then try to record a scene I don’t have any options available for a momentary button? Is this something I am doing wrong in the code? I want to be able to add scenes to my routines like “Dinner”, “Movie”, etc which can replay those lighting scenes.

Thanks

Checking out your smart app @rob_a_landry and Its great! had a question; there is a trigger option for “Button Press” but I don’t seem to have a device with the capability. What device can be used for this trigger? Thanks again so much!!

Any device which is a “button controller.”

This includes the very popular minimote

The Iris keyfob

The 8 button Remotec (minimote on the left, Remotec on the right)

The SmartenIT 3 toggle

And a number of other devices. :sunglasses: Many listed in the following thread:

Awesome! Thanks so much for the info! I actually bought a couple of VRCS4’s and have been reading up on how to get them working correctly with ST. Once I have them working could I use those buttons? That would be a fantastic solution to me scene problem! :slight_smile:

I can’t find a better thread for this, if there is one please direct me! Is there a reason Scene Machine is not saving/playing back color values on Hue lights? It gets the dimmer level, but leaves the color value last used by the bulb.

Otherwise, a brilliant app! and I’m not sure why this functionality isn’t rolled into the main SmartThings functionality…
Thanks!