Automation to send zwave mutlicast to lights that are on

Does anyone have an example of how to check if lights are on, then create a list of them, and then send them a z-wave multicast? For example I want them all to dim at sunset at the same time

This should help: Zwave JS Multicast Area Lights & Switches