Dim Lights that are on when house switches to night


In my home, I use night mode a little different than most might. When the house is in night mode, all of my motion detectors will turn on lights at 10% when they see motion. In the “bed” location mode, all motion detectors act as above, except for the motion detectors in the bedrooms. When in “bed” mode, the lights will not turn on with motion.

When entering night mode, i wanted to dim all the lights that happen to be on at the time. The following piston will query which lights are currently on, save that list, and then dim each of those lights.

I hope this helps the community.