Astrobinding offset

Hello everyone,
i’m so sorry but i used OPENHAB since v1, so with 3rd versione become so hard convert my config!

I use item files instead of openhab panel.

I use simply rules to turn on and off all the lights, but doesn’t works
astro:sun:local:rise#event

This is the things configuration:
astro:sun:home [ geolocation=“42.xyz,12.xyz”, interval=60 ]
astro:moon:home [ geolocation=“42.xyz,12.xyz”, interval=60 ]
astro:sun:local [ geolocation=“42.xyz,12.xyz”, interval=60 ]
{
Channels:
Type rangeEvent : rise#event [
offset=-40
]
Type rangeEvent : set#event [
offset=20
]
}

Where is the error?

Hi,
first, please use Code-Fences for the code as your “quotation marks” seems to be “wrong”.

astro:sun:local [ geolocation=“42.xyz,12.xyz”, interval=60 ]
{
Channels:
Type rangeEvent : rise#event [
offset=-40
]
Type rangeEvent : set#event [
offset=20
]
}

Second, can you post a rule you use ?

Thanks for your help.


rule "Luci esterne alba"
when
        Channel 'astro:sun:local:rise#event' triggered START
then
        sendCommand(Light_applique, OFF)
        Thread::sleep(500)
        sendCommand(Light_plafoniera, OFF)
        Thread::sleep(500)
        sendCommand(Light_garage, OFF)
        Thread::sleep(500)
        sendCommand(Light_cancello, OFF)
        Thread::sleep(500)
        sendCommand(Luce_terrazzarnotte, OFF)
        Thread::sleep(500)
        sendCommand(Luce_giardino, OFF)
        Thread::sleep(500)
        sendCommand(Luce_lavanderia, OFF)
        Thread::sleep(500)
        sendCommand(Luce_portone, OFF)
        Thread::sleep(500)
        sendCommand(LED_rampa, OFF)
        Thread::sleep(500)
        sendCommand(Luce_scale, OFF)
        Thread::sleep(500)
        sendCommand(Luce_esterno, OFF)
        Thread::sleep(500)
end

See here my complete Astro-Thing:

//    Astro - Binding Geo-Position  geolocation="45.33654,3.45678,502"

// astronomische Jahreszeiten (Tag- und Nachtgleiche)
Thing astro:sun:local     "Sonnen Daten"                   [geolocation="45.33654,9.8709123,502", interval=300]
Thing astro:moon:local    "Mond Daten"                     [geolocation="45.33654,9.8709123,502", interval=300]
                                        
// Meteorologische Jahreszeiten
Thing astro:sun:localmet  "Sonnen Daten meteorologisch"    [geolocation="45.33654,9.8709123,502", interval=300, useMeteorologicalSeason=true]
                                        
Thing astro:sun:stowing4   "Offset 50"                     [geolocation="45.33654,9.8709123,502", interval=300]{
  Channels:
    Type rangeEvent : set#event [
      offset=50
    ]
    Type start : set#start [
      offset=50
    ]
    Type end : set#end [
      offset=50
    ]
    Type rangeEvent : astroDusk#event [
      offset=50
    ]
    Type rangeEvent : night#event [
      offset=50
    ]
    Type rangeEvent : noon#event [
      offset=50
    ]
    Type start : noon#start [
      offset=50
    ]
    Type start : noon#end [
      offset=50
    ]
      Type rangeEvent : rise#event [
      offset=50
    ]
    Type start : rise#start [
      offset=50
    ]
    Type end : rise#end [
      offset=50
    ]
}

You will see several Things for the different purposes. One of them (the fourth) is for offset use and a rule which works with those offset events.

rule "Sunset_50 Start"
    when
            Channel 'astro:sun:stowing4:set#event' triggered START
    then
        logInfo("astro-rules" + '_03', " Sunset_50 Start. START")
        //EG_gEG_Kind2_Licht.sendCommand(ON)
end
//===============================================================================
rule "Sunset_50 Ende"
    when
            Channel 'astro:sun:stowing4:set#event' triggered END
    then
        logInfo("astro-rules" + '_04', " Sunset_50 Ende. END")
        //EG_gEG_Kind2_Licht.sendCommand(ON)
end
//===============================================================================

and the log for those events:

2022-03-23 19:25:00.006 [INFO ] [hab.core.model.script.astro-rules_03] -  Sunset_50 Start. START
2022-03-23 19:28:00.006 [INFO ] [hab.core.model.script.astro-rules_04] -  Sunset_50 Ende. END


So from what I can see, your Rule looks quite ok, but the Action-Type “sendCommand” only seems to accept Strings, as i understand:

....
sendCommand(Light_applique, "OFF")
.....

Please have a look in the docs here

2 Likes

Does your xxx.things file load correctly? (see your openhab.log)
Does the event fire at any time? (see your events.log)
Does your xxx.rules file load correctly? (see your openhab.log)