Astro Binding Offset not working

Hello everybody,

I’m using 2 Astro things: one regular one and one with an offset:

astro:sun:home  [ geolocation="x,y", interval=300 ]
    astro:sun:minus60  [ geolocation="x,y", interval=300 ] {
        Channels:
            Type rangeEvent : set#start [
                offset=-60
            ]
    }

But the “minus60” does not seem to work correct. In the logs I can see that both channels trigger at the same time:

2019-07-23 21:28:00.030 [vent.ChannelTriggeredEvent] - astro:sun:minus60:set#event triggered START
2019-07-23 21:28:00.036 [vent.ChannelTriggeredEvent] - astro:sun:home:set#event triggered START

I set up some variables to see if the times are correct.

DateTime    Sunset_Light     "Sunset Light[%1$tH:%1$tM]"     <sun>    (gAstro) {channel="astro:sun:minus60:set#start"}
DateTime    Sunset_Time      "Sunset [%1$tH:%1$tM]"    <sunset>    (gAstro) {channel="astro:sun:home:set#start"}

The values seem to be ok:
Sunset_Light is 2019-07-23T20:28:00.000+0200
Sunset_Time is 2019-07-23T21:28:00.000+0200

I think I have something wrong in the offset config of the item.

Regards Martin

Notice the difference -

If you want to offset that event, you need to specify that event

Type rangeEvent : set#event [

Note that if you also want to offset in an Item, then you must separately spcify the offset for a state channel (like set#start)

Hello,

Thanks for the willingness to help. I don’t understand. Can you elaborate with a bit more info and a light example?

Thanks in advance.

Regards
Ralf

If you want to offset that event , you need to specify that event

astro:sun:home  [ geolocation="x,y", interval=300 ]
    astro:sun:minus60  [ geolocation="x,y", interval=300 ] {
        Channels:
            Type rangeEvent : set#event [
                offset=-60
            ]
    }

If you want to offset an Item’s state, you need to specify the state channel

astro:sun:home  [ geolocation="x,y", interval=300 ]
    astro:sun:minus60  [ geolocation="x,y", interval=300 ] {
        Channels:
            Type rangeEvent : set#start [
                offset=-60
            ]
    }

If you want to offset both, you need to specify both

astro:sun:home  [ geolocation="x,y", interval=300 ]
    astro:sun:minus60  [ geolocation="x,y", interval=300 ] {
        Channels:
            Type rangeEvent : set#start [
                offset=-60
            ]
            Type rangeEvent : set#event [
                offset=-60
            ]
    }

set#start and similar are state channels, presenting a datetime value that you can put into an Item
set#event and similar are trigger channels, cannot be linked to any Item because they are transient events, but invoke an openHAB event when their time comes.
Two different uhh, things.

Have another look with that in mind

2 Likes

Thanks for your help. Sounds reasonable and I will try.

Unfortunately it takes 24 hours to test :wink:

You could test it by offsetting to a time that’s 5-10 minutes away.

I also had a hard time wrapping my head around offsetting Astro. I think I got it going through sheer dumb luck, which meant that I didn’t know what to do when I subsequently broke it. @rossko57’s explanation is about the best I’ve read to explain the difference between the the state and the event.

@rpwong right!! excellent advice!

It’s better to be lucky than good, right up until your luck runs out.

1 Like

Not really. For testing purposes you can take another offset. (e.g. -1438) So you will get the result after two minutes :wink:

Thanks for the clarification.

I think I need the set#event. For testing I defined both (set#event and set#start):

    astro:sun:minus60  [ geolocation="x, y", interval=300 ] {
        Channels:
                Type rangeEvent : set#start [
                    offset=-60
                ]
                Type rangeEvent : set#event [
                    offset=-60
                ]
        }

At the same time I have a thing without offset:

astro:sun:home  [ geolocation="x, y", interval=300 ]

Both channels trigger at the same time:

2019-07-27 21:23:00.006 [vent.ChannelTriggeredEvent] - astro:sun:home:set#event triggered START
2019-07-27 21:23:00.013 [vent.ChannelTriggeredEvent] - astro:sun:minus60:set#event triggered START

Any ideas?

Regards
Martin

When you edit things (as opposed to creating new) there can be cache effects in play. I don’t know the details, but for example

For Astro in particular, you do need the binding to run its “initialize job” like it does at midnight to calculate the coming day’s schedule. Usually means a reboot.

I just rebooted OpenHAB. We will see what happens…