Astro Thing with Rule

Hello,

I have a question according my Astro thing and Rule.

This is my Item:

DateTime Evening_Time "Avond [%1$tH:%1$tM]" (Astro) {channel="astro:sun:minus90:set#start"}

This is my thing

Astro.things:
astro:sun:minus90 [ geolocation="52.406995,6.624562", interval=60] { Channels: Type rangeEvent : set#event [ offset=-60 ] }

Astro rule:

rule "Licht aan bij schemer"
when
	Channel 'astro:sun:minus90:set#event' triggered START
then
	gLights3.sendCommand(ON)
	sendTelegram("jeroen","ik heb het licht in de kamer aan gedaan")
end

I can’t figure out what’s wrong. Could someone please help me?

Cannot see anything obviously wrong. What happens or doesn’t happen that you expected? Have you installed Astro binding? What messages does it leave for you in openhab.log?

The rule should turn on the gLights3 but it doesn’t. It also should send me a message with telegram. The rule was not triggered last night. I didn’t see anything in the log.
The item file wasn’t updated.

Okay, if there is no astro event in events.log there is nothing to trigger your rule.

Have you installed Astro binding? What messages does it leave for you in openhab.log at system startup? What is the current datetime you see in your Item Evening_Time?

There wasn’t any error. I changed the Thing:

astro:sun:minus90 [ geolocation="52.406995,6.624562", interval=60] {
     Channels:
        Type start : rise#start [
            offset=-30
        ]
        Type end : set#start [
            offset=-60
        ]
}

I also changed the rule:

rule "Licht aan bij binnenkomst"
when
	Channel 'astro:sun:minus90:set#start' triggered START
then
	gLights3.sendCommand(ON)
	sendTelegram("jeroen","ik heb het licht in de kamer aan gedaan")
end

Now the item has a value in the sitemap. But the rule isn’t triggered. It should trigger at 20:37 but nothing happend

I checked PaperUI if the thing was linked to the item:

Take care not to muddle events channels with state channels.

In your first post, the rangeEvent offset was about an event. The Item was linked to a state channel (of datetime type) which had no offsets. The rule was waiting for an event which should have had the offset (and so would not be at the time the Item said).

Okay, so guessing that you haven’t changed your Item, it is linked to a state channel that now has a -60 offset.
There is no longer any event offset on the event so it will not happen at the time the Item says.
But that doesn’t matter, because you have broken the rule trigger.

You cannot trigger rules from state channels, you must use an event channel like you did to begin with.
Event channels are different things to state channels and have their offsets (if any) specified separately.

I changed the thing back to use the rangeEvent:

astro:sun:minus90 [ geolocation="52.406995,6.624562", interval=60] {
	Channels:
		Type rangeEvent : set#event [
			offset=-60
		]
}

My item is stil the same :

DateTime Evening_Time "Avond [%1$tH:%1$tM]" (Astro){channel="astro:sun:minus90:set#start"}

Because my item channel was set#start. I changed the thing and the rule.

There is no item linked to the Range Event channel.

Okay. The way it is now, only the set#event has an offset.

Because the set#start state channel has no offset, this will not be the same as the set#event

That’s good. You cannot link Items to event channels.

so according to you the rule, the thing and the item are well configured and the rule should be triggered?

The Rule works. Thanks for your help. Your help is greatly appreciated

1 Like

Jeroen, can you please post a working example? Thanks in advance.

This is my item:

DateTime    Evening_Time        "Avond [%1$tH:%1$tM]"                                    				(Astro) {channel="astro:sun:minus90:set#start"}

and this is my thing:

astro:sun:minus90 [ geolocation="XX.XXXXXX,X.XXXXXX", interval=60] {
	Channels:
		Type rangeEvent : set#event [
			offset=-60
		]
}

and my rule:

rule "Licht aan bij presence"
when
	Channel 'astro:sun:minus90:set#event' triggered START
then
	if (gPresence.state==ON) {
	gLights3.sendCommand(ON)
	sendTelegram("jeroen","ik heb het licht in de kamer aan gedaan")
	}
end

I hope it helps you

Thank you very much. When using an item to connect with astro we would need to use set#start for the offset. I got it now. Thanks for helping.

You should thank @rossko57 for explaining this.