# Astrobinding offset

**URL:** <https://community.openhab.org/t/astrobinding-offset/134488>\
**Category:** Bindings\
**Created:** [March 23, 2022, 10:19pm UTC](https://community.openhab.org/t/astrobinding-offset/134488 "2022-03-23T22:19:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![khael87](https://community.openhab.org/letter_avatar_proxy/v4/letter/k/e8c25b/32.png) [@khael87](https://community.openhab.org/u/khael87)\
**Post date:** [March 23, 2022, 10:19pm UTC](https://community.openhab.org/t/astrobinding-offset/134488/1 "2022-03-23T22:19:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![fibu-freak](https://community.openhab.org/user_avatar/community.openhab.org/fibu-freak/32/29710_2.png) [@fibu-freak](https://community.openhab.org/u/fibu-freak)\
**Post date:** [March 23, 2022, 10:51pm UTC](https://community.openhab.org/t/astrobinding-offset/134488/2 "2022-03-23T22:51:48Z")

</div>

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

```yaml
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 ?

---

<div class="post-metadata">

**Author:** ![khael87](https://community.openhab.org/letter_avatar_proxy/v4/letter/k/e8c25b/32.png) [@khael87](https://community.openhab.org/u/khael87)\
**Post date:** [March 23, 2022, 10:56pm UTC](https://community.openhab.org/t/astrobinding-offset/134488/3 "2022-03-23T22:56:52Z")

</div>

Thanks for your help.

```yaml

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

```

---

<div class="post-metadata">

**Author:** ![fibu-freak](https://community.openhab.org/user_avatar/community.openhab.org/fibu-freak/32/29710_2.png) [@fibu-freak](https://community.openhab.org/u/fibu-freak)\
**Post date:** [March 23, 2022, 11:22pm UTC](https://community.openhab.org/t/astrobinding-offset/134488/4 "2022-03-23T23:22:53Z")

</div>

See here my complete Astro-Thing:

```yaml
// 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.

```yaml
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:

```yaml
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:

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

```

Please have a look in the docs [here](https://www.openhab.org/docs/configuration/rules-dsl.html#myitem-sendcommand-new-state-versus-sendcommand-myitem-new-state)

---

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [March 24, 2022, 12:19am UTC](https://community.openhab.org/t/astrobinding-offset/134488/5 "2022-03-24T00:19:36Z")

</div>

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`)
