[SOLVED] Astro Channel Not Firing

I’m running Openhabian 2.3.0. Loaded the Astro binding on PaperUI. The following is not working for me, please advise what I’m doing wrong. I’m looking for a rule to run at the following times:

  • 30 minutes prior to sunset
  • At sunset
  • At sunrise
  • 30 minutes after sunrise

I have tried “rise”/“set” instead of “daylight” and neither work.

Looking at the log I received a message saying the “Internal_Daylight_End2” item has changed to a date in the future, however, that date in the future occurs, and my log entry doesn’t show. Just as a note, I have other logInfo rules, and they show so I know it’s not the logger.

dates.items

DateTime    Internal_Daylight_End2    "Internal Daylight End [%1$tH:%1$tM]"    { channel="astro:sun:local:daylight#end" }

DateTime    Internal_Daylight_Start2    "Internal Daylight Start [%1$tH:%1$tM]"    { channel="astro:sun:local:daylight#start" }

astro.things

astro:sun:local  [ geolocation="38.338701172184636,-94.93057767291682,100", interval=600 ] {
   Channels: 
	Type end : daylight#end [ 
		offset=-30 
	]

	Type start : daylight#start [
		offset=30
	]
}

insteon.rules

rule "Test"
when
	Channel "astro:sun:local:daylight#event" triggered END
then
	logInfo("Test", "Test")
end

You did not define the rangeEvent channel for your astro thing:

@ktech here is my rule and my things file. This works for me with no issue. I struggled with this a little also. I am using the start trigger you were trying the end. I am not sure the exact difference. I know mine triggers 30 minutes prior to sunset. I believe you were missing the range event from your thing declaration. Hope this helps.

rule "Turn porch light on at Sunset"
when
    Channel 'astro:sun:minus30:set#start' triggered START
then
    logInfo("rules", "S It's sunset, I'm turning the porch light on")
end
astro:sun:minus30  [ geolocation="29.66780,-98.12314", interval=300 ] 
{

Type start : set#start [
            offset=-30
        ]

Type rangeEvent : set#event [
            offset=-30
        ]


}

Hi Kevin, as @sihui and @Thedannymullen wrote, you have to define the offset in the tings.file as a Type rangeEvent like this:

// 		Astro - Binding Geo-Position  geolocation="xxxxxxxx,yyyyyyy,zzz"

Thing astro:sun:local			"Sonnen Daten"		[geolocation="xxxxxxxx,yyyyyyy,zzz", interval=300]
Thing astro:moon:local		"Mond Daten"			[geolocation="xxxxxxxx,yyyyyyy,zzz", interval=300]
                                        
Thing astro:sun:stowing		"Offset -180"			[geolocation="xxxxxxxx,yyyyyyy,zzz", interval=300]{
	Channels:
		Type rangeEvent : set#event [
			offset=-180,
			earliest="19:40"
		]
	}

Your rules-file should look like this:

//===============================================================================
val String filename = "astro-rules"
rule "Sunset_180 Start"
	when
			Channel 'astro:sun:stowing:set#event' triggered START
	then
		logInfo(filename + "_03", "Sunset_180 Start. START")
		//EG_EG_Kind2_Licht.sendCommand(ON)
end
//===============================================================================
rule "Sunset_180 Ende"
	when
			Channel 'astro:sun:stowing:set#event' triggered END
	then
		logInfo(filename + "_04", "Sunset_180 Ende. END")
		//EG_EG_Kind2_Licht.sendCommand(ON)
end
//===============================================================================
rule "Sunrise Start"
	when
			Channel 'astro:sun:local:rise#event' triggered START
	then
		logInfo(filename + "_05", "Sunrise START ")
		//EG_EG_Kind2_Licht.sendCommand(ON)
end
//===============================================================================
rule "Mittag Start"
	when
		Channel 'astro:sun:local:noon#event' triggered START
	then
		logInfo(filename + "_06", "Mittag - noon. START")
		//Sonoff_Basic_03.sendCommand(ON)
end
//===============================================================================

The first two Rules will be fired, when the offset time of your thing ( astro:sun:stowing) is reached, the other two Rules interact with the “normal” thing ( astro:sun:local).
You don’t need any items (as far as I know :thinking:) to test the set.
For me this work quite fine. And I have created a lot more testing rules (and itmes) for the astro-binding to understand what’s going on.
Have fun with testing.
Peter

1 Like

I was trying to do the offsets with the “start”/“stop” types instead of rangeEvent because I thought the thing must be called “astro:sun:local”, instead of replacing the “local” with other descriptors. I was able to do what I needed by creating multiple astro things, and using the rangeEvent type as described. Thanks!