Motion Sensor trigger script?

Forgive me if this has been covered. I am new to home assistant but I do have a IT background. I am using Cync by GE bulbs (yes they suck, and I dove in before knowing the problems) anyway, I am able to communicate with them in home assist using a integration. However, the problem is since “Scenes” don’t appear to work that well for this bulb… I had to resort a workaround using “scripts”. which is fine…

My question is this… can a motion detector activate a “script” in home assist?

Ps. The reason Scenes do not work for my bulbs, is because if the “brightness” command exist in my YAML, it will not change the color of my bulbs. It does change the brightness. And vice versa, if I leave out that brightness tag… I can control the color in the scene. I resorted to using a script command because I can add “brightness” setting at the end of the script, to change the color and then the brightness at the very end.

Yes, scripts can be called as a service directly using the script’s entity ID as the service or indirectly using the script.turn_on service in the action sequence of any automation or script.

Make sure to review Waiting for Scripts to Complete and Passing variables to scripts for important information about the differences between using the direct or indirect methods.

1 Like

That worked beautifully! thank you.

Is there a script option to return a bulb to a previous state? For example: Bulb color is soft white, script changes it to red… but needs to go back to white? Similar to what I understand Scenes do. Problem is like I mention I cant use scenes because that “Brightness” option messes with the bulb and will not change. :frowning:

It could be done, but you would have to store the previous state somewhere. If the time span between change and change-back isn’t very long (under a couple minutes) you could store it in a variable inside the script, otherwise you would want to use a helper.

1 Like

Sounds to me like you want an automation.

Sounds to me like you want an automation.

I’ve kind of had to mix automations/scripts on that to get some of it working. I have about 33 bulbs (all cync) known of these issues I would have just invested in something else. Eeek. All because of a “brightness” line item. I used to run all this through Alexa… but the Skill is garbage and the lights would not be consistent. Using the native app (bluetooth) obviously worked fine. Slapping it in Home Assistant that went away and as you know gave me a whole world of options.