# Need help getting astro sun offset to work

**URL:** <https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183>\
**Category:** Bindings\
**Tags:** astro, offset, astro-binding\
**Created:** [November 13, 2025, 7:37pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183 "2025-11-13T19:37:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![MuseInTheCircuit](https://community.openhab.org/user_avatar/community.openhab.org/museinthecircuit/32/119291_2.png) [@MuseInTheCircuit](https://community.openhab.org/u/MuseInTheCircuit)\
**Post date:** [November 13, 2025, 7:37pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/1 "2025-11-13T19:37:32Z")

</div>

I’m trying to get the sun rise and sun set event offsets to work. I’ve

- read through as many of the related forum posts as I can
- made sure the offsets are on the event channel
- made sure my rules are triggered from the event channel
- tried to configure the binding in the UI and tried to configure the binding with a things file
- restarted openhab after setting or changing offsets

Nothing I’ve done has induced the rule to fire at any time other than the exact sunrise or sunset time.

I’m

- running 5.1.0.M2 inside a docker image
- Using a definition like this:

```auto
astro:sun:local-offset-file [geolocation="XXXX,YYYY", interval=60] {
    Channels:
        Type rangeEvent : rise#event [
            offset=60
        ]
        Type rangeEvent : set#event [
            offset=-60
        ]
        Type start : rise#start [
            offset=60
        ]
        Type end : set#end [
            offset=-60
        ]

}

```

And a UI-based rule configured like this:

```yaml
configuration: {}
triggers:
  - id: "3"
    configuration:
      event: START
      thingUID: astro:sun:local-offset-file
      channelUID: astro:sun:local-offset-file:rise#event
    type: core.ChannelEventTrigger

```

Not sure if I”m doing something wrong, or if there’s a bug somewhere.

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![JimH](https://community.openhab.org/letter_avatar_proxy/v4/letter/j/a4c791/32.png) [@JimH](https://community.openhab.org/u/JimH)\
**Post date:** [November 14, 2025, 2:22pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/2 "2025-11-14T14:22:28Z")

</div>

I suspect there needs to be a separate Thing for each offset. This is working for me.

```auto
// Used to close blinds before sunset
astro:sun:SunsetOffset [geolocation="xxxx.yyyy"] {
    Channels:
        Type rangeEvent : set#event [
            offset=-15
        ]
}

// Used to open blinds 30 minutes after sunrise
astro:sun:SunriseOffset[geolocation="xxxx.yyyy"] {
    Channels:
        Type rangeEvent : rise#event [
            offset=30
        ]
}

```

Rules

```auto
// Close blinds at 15 minutes before sunset
rule CloseBlindsRule
when Channel "astro:sun:SunsetOffset :set#event" triggered START
then gBlinds.sendCommand(OFF)
end

// Open blinds 30 minutes after sunrise 
rule OpenBlindsRule
when Channel "astro:sun:SunriseOffset:rise#event" triggered END 
then gBlinds.sendCommand(ON)
end

```

---

<div class="post-metadata">

**Author:** ![jimtng](https://community.openhab.org/user_avatar/community.openhab.org/jimtng/32/98543_2.png) [@jimtng](https://community.openhab.org/u/jimtng)\
**Post date:** [November 15, 2025, 12:23pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/3 "2025-11-15T12:23:19Z")

</div>

Have just one astro sun thing / channel without any offset. Link it to a DateTime item.

Then in your rule, you can specify an offset for a DateTime trigger.

---

<div class="post-metadata">

**Author:** ![Hans\_Lree](https://community.openhab.org/user_avatar/community.openhab.org/hans_lree/32/194704_2.png) [@Hans\_Lree](https://community.openhab.org/u/Hans_Lree)\
**Post date:** [November 15, 2025, 12:53pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/4 "2025-11-15T12:53:49Z")

</div>

> Have just one astro sun thing / channel without any offset. Link it to a DateTime item.
> 
> Then in your rule, you can specify an offset for a DateTime trigger.

Would that work with a negative offset though?

I have these Thing definitions and DSL rule triggers which have been working fine for me for years now - similar to @JimH’s posting above.

```auto
Thing astro:sun:mornings [geolocation="xx.xxxx,xx.xxxx, interval=60] {
    Channels:
        Type rangeEvent : rise#event [
            offset=-10
        ]
        Type start : rise#start [
            offset=-10
        ]
}

Thing astro:sun:civillduskendevenings [geolocation="xx.xxxx,xx.xxxx, interval=60] {
    Channels:
        Type rangeEvent : civilDusk#event [
            offset=-10
        ]
        Type end : civilDusk#end [
            offset=-10
        ]
}

```

With the following DSL rule triggers

```auto
when
	Channel "astro:sun: mornings:rise#event" triggered START
then

…

when
	Channel "astro:sun:civillduskendevenings:civilDusk#event" triggered END 
then

```

and the additional Thing `rise#start` and `civilDusk#end` definitions assigned to items so that the actual times can be displayed in my sitemap, e. g.

 ![Screenshot 2025-11-15 at 13.50.34](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/3/0/30e55551864dbb66a18434db7d45312fb0980675.png)

So apart from me using `civilDusk` instead of `sunset`, everything should work the same.

---

<div class="post-metadata">

**Author:** ![jimtng](https://community.openhab.org/user_avatar/community.openhab.org/jimtng/32/98543_2.png) [@jimtng](https://community.openhab.org/u/jimtng)\
**Post date:** [November 15, 2025, 2:23pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/5 "2025-11-15T14:23:32Z")

</div>

> [@Assistance with Rule DSL datetime trigger offset](https://community.openhab.org/t/assistance-with-rule-dsl-datetime-trigger-offset/166157/8):
>
> Fix submitted: [RulesDSL: Fix DateTimeItem trigger's offset by jimtng · Pull Request #5015 · openhab/openhab-core · GitHub](https://github.com/openhab/openhab-core/pull/5015) No. Offset is independent of timeonly

---

<div class="post-metadata">

**Author:** ![Hans\_Lree](https://community.openhab.org/user_avatar/community.openhab.org/hans_lree/32/194704_2.png) [@Hans\_Lree](https://community.openhab.org/u/Hans_Lree)\
**Post date:** [November 15, 2025, 2:56pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/6 "2025-11-15T14:56:50Z")

</div>

Thanks for the link to this recent commit @jimtng !

Just for clarification - as I am also using `earliest` and `latest`, which I didn’t put in my example above, am I correct in assuming that these are currently still only possible through the Thing definition?

```auto
Channels:

        Type rangeEvent : rise#event [
            offset=-10,
            earliest="06:30",
            latest="8:30"

        ]

Type start : rise#start [
            offset=-10,
            earliest="06:30",
            latest="8:30"

        ]

```

---

<div class="post-metadata">

**Author:** ![MuseInTheCircuit](https://community.openhab.org/user_avatar/community.openhab.org/museinthecircuit/32/119291_2.png) [@MuseInTheCircuit](https://community.openhab.org/u/MuseInTheCircuit)\
**Post date:** [November 15, 2025, 7:00pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/7 "2025-11-15T19:00:22Z")

</div>

Putting them in separate files doesn’t work for me. The start/stop items show the same thing (that the offset doesn’t affect anything).

I’ll try the time item thing as a workaround, but I’d still like to know why the offsets don’t work on the channels.

---

<div class="post-metadata">

**Author:** ![Hans\_Lree](https://community.openhab.org/user_avatar/community.openhab.org/hans_lree/32/194704_2.png) [@Hans\_Lree](https://community.openhab.org/u/Hans_Lree)\
**Post date:** [November 16, 2025, 1:15pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/8 "2025-11-16T13:15:18Z")

</div>

Could it be the rule trigger you are using?

I’ve never created rules in the UI, but my DSL rule, which does work correctly, is being shown in the UI rules as

```auto
configuration: {}
triggers:
  - id: "0"
    configuration:
      event: END
      channelUID: astro:sun:civillduskendevenings:civilDusk#event
    type: core.ChannelEventTrigger
conditions: []
actions:
…

```

so no `thingUID`, but generally also no hyphens in the name - the same for @JimH’s working solution.

---

<div class="post-metadata">

**Author:** ![MuseInTheCircuit](https://community.openhab.org/user_avatar/community.openhab.org/museinthecircuit/32/119291_2.png) [@MuseInTheCircuit](https://community.openhab.org/u/MuseInTheCircuit)\
**Post date:** [November 17, 2025, 5:33pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/9 "2025-11-17T17:33:22Z")

</div>

I updated them to be:

```yaml
astro:sun:SunriseOffset [geolocation="X.X,Y.Y", interval=60] {
    Channels:
        Type rangeEvent : rise#event [
            offset=60
        ]
}
astro:sun:SunsetOffset [geolocation="X.X,Y.Y", interval=60] {
    Channels:
        Type rangeEvent : set#event [
            offset=-60
        ]
}

```

And removed the thingUID from the rules, but no change in behavior.

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [November 17, 2025, 6:00pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/10 "2025-11-17T18:00:01Z")

</div>

> [@MuseInTheCircuit](#):
>
> but no change in behavior

It is so easy via MainUI, why bothering with text files?

Take the `Range Event` Channel, klick on Configure Channel:

 ![1](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/2/e/2e3aa3c9ac0426dbd8ee126ff22d5159426c8b5a.png)

Make your settings, in this case latest is 21:05 (for summertime) and if the Channel triggers before that add 20min, for today in Germany this would be 16:48 (for wintertime)

 ![2](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/3/b/3b7778cc229c7c265109c38132cc0c9dcabdd041.png)

Rule Triggers:

DSL: `Channel 'astro:sun:shutterkitchen:set#event' triggered START` or  
JS: `triggers.ChannelEventTrigger("astro:sun:shutterkitchen:set#event", "START"),`

If you want to display those times you need the set#start Channel from the Starting Time and make the same adjustments, then link that Channel to a DateTime itemtype.

`DateTime ShuttersCloseKit { channel="astro:sun:shutterkitchen:set#start" }`

---

<div class="post-metadata">

**Author:** ![MuseInTheCircuit](https://community.openhab.org/user_avatar/community.openhab.org/museinthecircuit/32/119291_2.png) [@MuseInTheCircuit](https://community.openhab.org/u/MuseInTheCircuit)\
**Post date:** [November 17, 2025, 6:08pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/11 "2025-11-17T18:08:17Z")

</div>

> [@MuseInTheCircuit](#):
>
> tried to configure the binding in the UI and tried to configure the binding with a things file

I started with the main ui; it didn’t work there; read some posts somewhere suggesting a file; tried it there and it didn’t work there either. It doesn’t seem to make a difference _where_ I configure it, it always triggers at the exact sunrise or sunset start time instead of offset.

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/9/a/9a1d92a3819f772bbe4f54fce2ad0e02396810ad.png)

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [November 17, 2025, 6:12pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/12 "2025-11-17T18:12:14Z")

</div>

> [@MuseInTheCircuit](#):
>
> instead of offset

Double check your rules trigger, for your setup you would need:

DSL: `Channel 'astro:sun:shutterkitchen:rise#event' triggered START` or  
JS: `triggers.ChannelEventTrigger("astro:sun:shutterkitchen:rise#event", "START"),`

(Sorry, I don’t know the trigger for MainUI, I am using text files except for Things …

---

<div class="post-metadata">

**Author:** ![MuseInTheCircuit](https://community.openhab.org/user_avatar/community.openhab.org/museinthecircuit/32/119291_2.png) [@MuseInTheCircuit](https://community.openhab.org/u/MuseInTheCircuit)\
**Post date:** [November 17, 2025, 6:21pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/13 "2025-11-17T18:21:24Z")

</div>

Yeah, the yaml for my rules trigger in the UI is in the original post.

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [November 17, 2025, 6:23pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/14 "2025-11-17T18:23:52Z")

</div>

> [@MuseInTheCircuit](#):
>
> Yeah

Then I am out of ideas. This works for me since 10 years, my first time with openHAB.😅

You did install the Astro binding???

---

<div class="post-metadata">

**Author:** ![MuseInTheCircuit](https://community.openhab.org/user_avatar/community.openhab.org/museinthecircuit/32/119291_2.png) [@MuseInTheCircuit](https://community.openhab.org/u/MuseInTheCircuit)\
**Post date:** [November 17, 2025, 6:47pm UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/15 "2025-11-17T18:47:19Z")

</div>

Lol. Yeah. The events fire. They just _always_ fire at the regular time not the offset one.

---

<div class="post-metadata">

**Author:** ![ubeaut](https://community.openhab.org/user_avatar/community.openhab.org/ubeaut/32/119014_2.png) [@ubeaut](https://community.openhab.org/u/ubeaut)\
**Post date:** [November 23, 2025, 6:20am UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/16 "2025-11-23T06:20:54Z")

</div>

I did this post years ago:

> [@CivilDusk Time Offset](https://community.openhab.org/t/civildusk-time-offset/120848/3):
>
> Thank you, Greg. I hadn’t understood the concept of the range event. I’ve configured it and expect it will work fine this evening. One question: The offset appears to apply to the range event for any rules which use it. For instance, if I have two rules and I want one to fire 30 minutes before sunset and one to fire 15 minutes after sunset, I wouldn’t be able to do that, since there is only one range event from astro:sun:local. I don’t suppose it’s possible to create a second instance of asto…

But unfortunately it is a victim of the missing pictures in posts that happened this year.

---

<div class="post-metadata">

**Author:** ![pacive](https://community.openhab.org/user_avatar/community.openhab.org/pacive/32/36234_2.png) [@pacive](https://community.openhab.org/u/pacive)\
**Post date:** [November 23, 2025, 8:46am UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/17 "2025-11-23T08:46:16Z")

</div>

I have the same issue, the offsets doesn’t seem to have any effect (configured through mainUI in my case), either on the DateTime channels or the event channels.

I set up a test instance using latest milestone and have the `set` channels configured like this:

```yaml
  - id: set#start
    channelTypeUID: astro:start
    label: Start Time
    description: The start time of the event
    configuration:
      offset: 60
  - id: set#end
    channelTypeUID: astro:end
    label: End Time
    description: The end time of the event
    configuration:
      offset: 0
  - id: set#duration
    channelTypeUID: astro:duration
    label: Duration
    description: The duration of the event
    configuration: {}
  - id: set#event
    channelTypeUID: astro:rangeEvent
    label: Range Event
    description: Range event
    configuration:
      offset: -60

```

I would expect the `set#start` to report a later time than `set#end`, and the events to be scheduled earlier, but when reinitializing (either by deactivating/activating the Thing, restarting the binding or restarting OH) I still get the same results as with no offset:

```auto
09:39:27.598 [DEBUG] [ro.internal.handler.AstroThingHandler] - Scheduled Event job astro:sun:5285c39a4b/set#event/START in 21737404ms (at 2025-11-23T15:41:45)
09:39:27.601 [DEBUG] [ro.internal.handler.AstroThingHandler] - Scheduled Event job astro:sun:5285c39a4b/set#event/END in 22035400ms (at 2025-11-23T15:46:43)
09:39:27.610 [INFO] [openhab.event.ItemStateChangedEvent] - Item 'Astro_Sun_Set_Start_Time' changed from NULL to 2025-11-23T15:41:45.992+0100 (source: org.openhab.core.thing$astro:sun:5285c39a4b:set#start)
09:39:27.612 [INFO] [openhab.event.ItemStateChangedEvent] - Item 'Astro_Sun_Set_End_Time' changed from NULL to 2025-11-23T15:46:43.714+0100 (source: org.openhab.core.thing$astro:sun:5285c39a4b:set#end)

```

---

<div class="post-metadata">

**Author:** ![pacive](https://community.openhab.org/user_avatar/community.openhab.org/pacive/32/36234_2.png) [@pacive](https://community.openhab.org/u/pacive)\
**Post date:** [November 23, 2025, 9:22am UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/18 "2025-11-23T09:22:27Z")

</div>

Found the issue I think. If you configure an offset, you MUST also configure earliest and latest, to a time before resp after the offset time could occur, otherwise the offset will fail to apply. This is a bug IMO, will report an issue on github.

---

<div class="post-metadata">

**Author:** ![sihui](https://community.openhab.org/user_avatar/community.openhab.org/sihui/32/55674_2.png) [@sihui](https://community.openhab.org/u/sihui)\
**Post date:** [November 23, 2025, 9:26am UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/19 "2025-11-23T09:26:06Z")

</div>

> [@pacive](#):
>
> I have the same issue

Double check the following:

You need to do the same settings for offset/earliest/latest on the `Start Time` and the `Range Event` Channel.  
The `Start Time` Channel needs to be linked to a DateTime itemtype and is not used for triggering, just for displaying:

```auto
DateTime ShuttersCloseKit { channel="astro:sun:shutterkitchen:set#start" } 

```

 ![kitchen](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/7/2/72385253011202ccf5551a7bb87ba0f8ad3970a1.png)

The `Range Event` Channel is used to trigger the rules via a Channel trigger:

`Channel 'astro:sun:shutterkitchen:set#event' triggered START`

Another Astro Thing shows the Time without an offset:

 ![untergang](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/2/2/2251dc9c33cc66cf575620e7d4b55793f99b6d21.png)

So for the rollershutter closing time it is exactly the +20 minutes like defined in the setup:

 ![Screenshot 2025-11-23 102456](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/a/a/aa004893311891d0330f656b3a61f07e0fc31469.png)

This is on 5.1.M2.

---

<div class="post-metadata">

**Author:** ![pacive](https://community.openhab.org/user_avatar/community.openhab.org/pacive/32/36234_2.png) [@pacive](https://community.openhab.org/u/pacive)\
**Post date:** [November 23, 2025, 9:31am UTC](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183/20 "2025-11-23T09:31:56Z")

</div>

I inspected what happens in the debugger, the issue is [here](https://github.com/openhab/openhab-addons/blob/54adedce502b7531f33f418d43f7d0d8136e9b5c/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/util/DateTimeUtils.java#L237) and [here](https://github.com/openhab/openhab-addons/blob/54adedce502b7531f33f418d43f7d0d8136e9b5c/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/util/DateTimeUtils.java#L219). If “latest” is not configured, the original time of the event is used (i.e,. before the offset was added), which causes the offset to be reset.

Just noticed there may be another issue also when using negative offsets, will investigate this more.

Update: for this the bug is in [this](https://github.com/openhab/openhab-addons/blob/54adedce502b7531f33f418d43f7d0d8136e9b5c/bundles/org.openhab.binding.astro/src/main/java/org/openhab/binding/astro/internal/util/DateTimeUtils.java#L245) method (the same as for the latest applies also if “earliest” is not configured), but also, if the default “00:00” is configured, the configuration will be ignored, again returning the original time of the event (before applying offset). So if using negative offsets, setting “earliest” to “00:01” works around the issue.

Update2: the bug was introduced in [this PR](https://github.com/openhab/openhab-addons/pull/19310).

[Next page](https://community.openhab.org/t/need-help-getting-astro-sun-offset-to-work/167183.md?page=2)
