Activate a Light Scene Via Code

input "sleepPrepLightScene", "capability.switch", title: "Select Sleep Prep Scene", submitOnChange: true, required: false, multiple: true

sleepPrepLightScene.each {
		log.debug "Light Scene Prep"
		it.sendEvent("name": "switch", value: "on")
	}

I have this code. In the Scene Device the "switch" turns to "on", but the scene does not activate.

by sending the event for the device, you make it appear on to everything in Hubitat, but the actual logic of turning on in that device is never run. Instead, you simply want to call it.on() - so that the "on" command is run for the selected device.

1 Like

Thank you!