I’m an OH beginner trying to create my first rules with the astro binding. All they do is turn some lights on at sunset and turn them off at sunrise. I want to test the rule now and not have to wait 8 hours (until sunset) for a test. I thought there might be a way to add an additional trigger that would run the rule when I press the run arrow, but I could not find anything like it. How can I test the rule and have it do what it’s supposed to without having to wait for an actual sun event? Is there a way to do this? Has it been suggested before?
You can add an offset to the Astro event. You’ll find the setting in the thing definition by going to the channel and clicking “Configure Channel”. However, I believe this will only take effect when Astro updates the times, which is typically at midnight.
You might be able to force an update by disabling and then enabling the thing, but I’m not certain as I’ve never had to do it. I’m not at home right now to check, but figured I’d get you started.
I interpreted it as them wanting to test if the Astro events work as triggers. But your interpretation makes more sense now that I read the OP a second time. ![]()
Updated with code. Does this appear correct?
So, I ran my sunset rule and the light did not go on (I can normally control this light on and off). What I’d like to happen is the act of pressing RUN acts like a TRUE trigger override to the WHEN condition to run the THEN clause and the light would go on. That would help me test the THEN part of the rule. Should the light have gone on? Or is my THEN clause shown here incorrect?
configuration: {}
triggers:
- id: "1"
configuration:
thingUID: astro:sun:local
event: START
channelUID: astro:sun:local:rise#event
type: core.ChannelEventTrigger
conditions: []
actions:
- inputs: {}
id: "2"
configuration:
itemName: ZW_N14_Front_Outdoor_Lights_Dimmer
command: sendCommand(OFF)
type: core.ItemCommandAction
For that matter is the WHEN clause correct to turn a light on at sunset?
Thanks for all the help.
Please post your rule code in code fences. Screenshots are difficult to debug.
It’s also best to check the log when rules don’t work. Log entries will often tell you where the mistakes are.
At a glance, you have send command sendCommand(ON). This would send a command, which is what you want to do. However, that command would be sendCommand(ON).
I suspect that you only want to send ON.
You would have the another rule for the sunset like the on you already have but change the channelUD TO:
channelUID: astro:sun:local:set#event
instead of rise and then change the command from:
command: sendCommand(OFF)
to
command: sendCommand(ON)
Also the type should be when the event is triggered otherwise the event won’t be triggered:
type: core.ChannelEventTrigger
I think that will work and should also work when you press the run button as suggested earlier in this thread.
That helps, but I’m still confused by this.
Your commands should just be ON and OFF, without sendCommand().
Yes I agree it should only be ON or OFF.
Example:
- inputs: {}
id: "5"
configuration:
command: ON
itemName: zigbee_switch_4_gang_switch_1
type: core.ItemCommandAction
Thank you. It makes sense now that I see it. That’s why I wanted to test it. I’ve updated the rules, too late to see the light go on tonight at sunset (it did not), so turned it on manually, hope to see it off in the morning.
Good luck. I am sure it will work. ![]()
Mine work well.
Did it work?
Yes, it works now. Thanks!

