Astro binding channel events in JSRule

Hello everyone,

I currently try to achieve that a rule is triggered as sun as the sunset starts with an offset of 30 minutes. I have the following configuration in place:

Things:

astro:sun:home_offset  [ geolocation="51.58196536,7.05765748,88", interval=60 ] {
    Channels: 
        Type start : set#start [
            offset=-329
        ]
}

Items:

DateTime Sunset_Time_Offset	"Sunset [%1$tH:%1$tM]"  { channel="astro:sun:home_offset:set#start" } // Sonnenuntergang

Rule:

rules.JSRule({
    name: "outdoor_sunset_on",
    description: "Sonnenuntergang",
    triggers: [triggers.DateTimeTrigger('Sunset_Time_Offset', false)],
    execute: (event) => {
        console.log("Sonnenuntergang")
    },
    tags: []
});  

rules.JSRule({
    name: "outdoor_sunset_on_channel_things",
    triggers: [triggers.ChannelEventTrigger('astro:sun:home_offset:set#start')],
    execute: (event) => {
        console.log("Sonnenuntergang über channel event")
    },
    tags: []
}); 

The first rule (outdoor_sunset_on) is triggered, the second one (outdoor_sunset_on_channel_things ) not. If possible I would like to avoid to create an item for this purpose and directly attach the rule towards a channel event trigger. Any idea what I do wrong here?

Cheers
Dennis

Hi Dennis,

you need to specify the event name for the ChannelEventTrigger, see JavaScript Scripting - Automation | openHAB and triggers - Documentation.

Something like this?