Astro binding does not offset

Or so it appears. I can’t find the error. Maybe someone can spot the error for me?
Output sitemap:


Things-file:

// Normal sunrise and sunset
Thing astro:sun:home [ geolocation="52.175272,4.447210,1", interval=60 ]
...
//Shutter offset
Thing astro:sun:shuttersClosed [ geolocation="52.175272,4.447210,1", interval=60 ] {
            Channels:
                    Type rangeEvent : set#event [
                            offset=-15,
                            latest="19:14"
                    ]
    }

Items file:

DateTime sunsetTimeStart "Sunset start [%1$tH:%1$tM]" { channel="astro:sun:home:set#start" } ... 
DateTime shutterClosedTimeStart "Offset sunset for shutter [%1$tH:%1$tM]" { channel="astro:sun:shuttersClosed:set#start" }

And the Sitemap:

Text item=sunsetTimeStart
Text item=shutterClosedTimeStart

The event seem to be fine with your definition, and should trigger accordingly, but for displaying the time in your sitemap try adding

//Shutter offset
Thing astro:sun:shuttersClosed [ geolocation="52.175272,4.447210,1", interval=60 ] {
           Channels:
                   Type rangeEvent : set#event [
                           offset=-15,
                           latest="19:14"
                   ]
                   Type start : set#start [
                           offset=-15,
                           latest="19:14"
       ]
   }

from memory at the moment, so might need double checking :wink:

1 Like

Have you restarted OH since making the change to the Thing?

Astro has both state channels (e.g. sunset time) and event channels (e.g. triggers at sunset)

The offsets for these are set separately. The offset you have shown only affects the event. You need another offset for the states that you display in your UI.

The # parts of the config should make more sense with this in mind.

@H102, No, I did not but now I have including clearing cache and tmp folders to no avail.

@rossko57 and @Hans_Lree, one part of me thinks this makes sense, the other part does not. Now I have to set the set#event and set#start separately while you want them to reflect the same offset. It is under test. Let’s see what result we get :slight_smile:

If you want everything to be offset by the same amount, make a complete new sun Thing for a different location, displaced by a few degrees of longitude.

I had that programmed indeed. I was doing some cleaning-up to keep track of items and things and thought this was the neat way of doing this. Turns out, if I use the set#event triggered START in a rule, it still looks at the set#start from the things-file and not the set#event.

I think I will go back to the coordinates approach…

Use it in what way? It is an event, it has no value.


        Item PartOfDay received command or
        Time cron "0 59 7 * * ?" or
        Time cron "0 14 19 * * ?" or
        Channel 'astro:sun:offsetEarly15:set#event' triggered START

Works like a charm with set#event

Yes, this is the event for triggering your rule, as previously mentioned. I though this already worked for you and your problem was that the time in your sitemap was not displayed with the offset. For the latter you need to implement the additional set#start channel with exactly the same offset. Your event channel was already correct and should not be be touched.

• The event channel for triggering rules
• The datetime state channel for displaying the time in your sitemap

So leaving your rule trigger as is, and adding the datetime channel as I described originally you will have the correct event trigger for your rule with the offset and also the correct time displayed in your sitemap with the offset.

BTW, if you use the cron conditions for your rule to make sure that the shutters close at a certain latest time you might also want to have a look at the ‘earliest’ and ‘latest’ options in the thing definitions.

1 Like