# I want to use astro to switch on/off a light at sunrise/sunset

**URL:** <https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177>\
**Category:** Items & Sitemaps\
**Tags:** astro, openhab3\
**Created:** [September 21, 2022, 6:39pm UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177 "2022-09-21T18:39:43Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![enboig](https://community.openhab.org/letter_avatar_proxy/v4/letter/e/3be4f8/32.png) [@enboig](https://community.openhab.org/u/enboig)\
**Post date:** [September 21, 2022, 6:39pm UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/1 "2022-09-21T18:39:43Z")

</div>

With a clean installation of openhab3, I try to create a trigger to switch on a light, but after installing Astro binding, and adding _sun thing_:

```auto
UID: astro:sun:sol
label: Sol
thingTypeUID: astro:sun
configuration:
  useMeteorologicalSeason: false
  interval: 300
  geolocation: XX.XXXXXXXXXXXXX,Y.YYYYYYYYYYYYY

```

when I try to create a channel, I can’t because `There is no profile available for the selected item`.  
Should I install/enable something else? Should my _Astro group_ be of special type?

Thanks in advance

 ![Screenshot_20220921_203743](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/9/8/9860cdd413379539bf2b4fd586d4f89d7ea91df2.png)

---

<div class="post-metadata">

**Author:** ![hmerk](https://community.openhab.org/user_avatar/community.openhab.org/hmerk/32/56432_2.png) [@hmerk](https://community.openhab.org/u/hmerk)\
**Post date:** [September 21, 2022, 6:53pm UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/2 "2022-09-21T18:53:41Z")

</div>

You misunderstood the astro binding and the information available.  
the sun raise event is a trigger channel, that can be used directly in rules, without the need to create additional items.  
Creating the rule, select the trigger even with value „START“ and the rule will fire when sunrise starts.

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/5/0/501e5f8c00f14be436e51df42b37b01d8d5b58e6.jpeg)

---

<div class="post-metadata">

**Author:** ![enboig](https://community.openhab.org/letter_avatar_proxy/v4/letter/e/3be4f8/32.png) [@enboig](https://community.openhab.org/u/enboig)\
**Post date:** [September 21, 2022, 7:14pm UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/3 "2022-09-21T19:14:08Z")

</div>

It worked! Thanks a lot.

---

<div class="post-metadata">

**Author:** ![satman](https://community.openhab.org/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@satman](https://community.openhab.org/u/satman)\
**Post date:** [March 18, 2023, 11:37am UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/4 "2023-03-18T11:37:41Z")

</div>

Hi,  
I have just upgraded from OH2.5 to an all GUI OH3.2.4, which is running fine except for the Sunrise and Sunset Triggers. Searching for help led to this post from Sep 2022 showing Trigger:  
 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/a/a/aa5db0b07c2733b99ef5ce5f0358ec6b98d3bdc6.png)  
Could you please let me know how to navigate to and build this Trigger.  
I have loaded the Astro Sun Data Thing, but so far I have only found this type of trigger:  
 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/5/e/5efd64003c0c230cd9a419f5ae328dfef0044670.png)

My current Item is:

```csv
  DateTime SunriseStart_Time { channel="astro:sun:xxUIDxx:rise#start" }

```

My aim is also to advance and delay the Rise and Set time by 20 min.  
Can you give me a hint, please.

---

<div class="post-metadata">

**Author:** ![hmerk](https://community.openhab.org/user_avatar/community.openhab.org/hmerk/32/56432_2.png) [@hmerk](https://community.openhab.org/u/hmerk)\
**Post date:** [March 18, 2023, 2:14pm UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/5 "2023-03-18T14:14:02Z")

</div>

You need to add a thing trigger to your rule, trigger channels are not linked to items.  
This is written on the second line of your first screenshot.

---

<div class="post-metadata">

**Author:** ![satman](https://community.openhab.org/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@satman](https://community.openhab.org/u/satman)\
**Post date:** [March 18, 2023, 2:59pm UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/6 "2023-03-18T14:59:14Z")

</div>

Thanks for your time,  
That is understood and trigger found, but how can I now delay or advance the trigger by +/- n minutes?

---

<div class="post-metadata">

**Author:** ![hmerk](https://community.openhab.org/user_avatar/community.openhab.org/hmerk/32/56432_2.png) [@hmerk](https://community.openhab.org/u/hmerk)\
**Post date:** [March 18, 2023, 3:07pm UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/7 "2023-03-18T15:07:56Z")

</div>

This can be done in the chanel configuration and is also in the astro binding docs.

---

<div class="post-metadata">

**Author:** ![hmerk](https://community.openhab.org/user_avatar/community.openhab.org/hmerk/32/56432_2.png) [@hmerk](https://community.openhab.org/u/hmerk)\
**Post date:** [March 18, 2023, 5:13pm UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/8 "2023-03-18T17:13:24Z")

</div>

> [@satman](#):
>
> Thanks for your time,

Which seems to wasted when I see you are asking again in another topic ☹

---

<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:** [March 18, 2023, 9:57pm UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/9 "2023-03-18T21:57:09Z")

</div>

> [@CivilDusk Time Offset](https://community.openhab.org/t/civildusk-time-offset/120848/2):
>
> Use the astro binding. Configure the range event for sunset: Then create an offset time for that event by using the configure channel. Then create a rule to trigger at the event started for the set#event Set the START or END of the event trigger otherwise the rule will fire twice (START and END) If you wanted to use the range event for civil dusk you just do the same as above but instead of sunset event range you use the civil dusk event range.

---

<div class="post-metadata">

**Author:** ![satman](https://community.openhab.org/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@satman](https://community.openhab.org/u/satman)\
**Post date:** [March 19, 2023, 10:43am UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/10 "2023-03-19T10:43:33Z")

</div>

Thanks Greg, perfect!! 🙂

---

<div class="post-metadata">

**Author:** ![Maximilian\_Fabricius](https://community.openhab.org/user_avatar/community.openhab.org/maximilian_fabricius/32/100531_2.png) [@Maximilian\_Fabricius](https://community.openhab.org/u/Maximilian_Fabricius)\
**Post date:** [May 25, 2023, 4:52am UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/11 "2023-05-25T04:52:26Z")

</div>

All,

I am no so new to OH3 actually, but still have a very hard time understanding the astro trigger (giving my neighbor good laughs about weird times that our terrace lights switch on and off).

So I installed the astro binding. I have actually no “plus30” binding as in the example.

What I’d like to do in this rule is to switch on/off the lights when it is daylight outside starts/stops (see below).

Is this the recommended way of doing it?

Thanks,

Max

* * *

configuration: {}  
triggers:

- id: “1”  
configuration:  
time: 19:00  
type: timer.TimeOfDayTrigger
- id: “6”  
configuration:  
thingUID: astro:sun:19c7b2f15b  
event: END  
channelUID: astro:sun:19c7b2f15b:daylight#event  
type: core.ChannelEventTrigger  
conditions:   
actions:
- inputs: {}  
id: “2”  
configuration:  
command: ON  
itemName: LichtStromEingang\_Relay1\_Output  
type: core.ItemCommandAction
- inputs: {}  
id: “3”  
configuration:  
command: ON  
itemName: LichtTerrasseGarage\_Power  
type: core.ItemCommandAction
- inputs: {}  
id: “4”  
configuration:  
command: ON  
itemName: LichtTerrasseHaupt\_Power  
type: core.ItemCommandAction
- inputs: {}  
id: “5”  
configuration:  
command: ON  
itemName: StromTerrasse\_Power  
type: core.ItemCommandAction

* * *

configuration: {}  
triggers:

- id: “1”  
configuration:  
time: 19:00  
type: timer.TimeOfDayTrigger
- id: “6”  
configuration:  
thingUID: astro:sun:19c7b2f15b  
event: END  
channelUID: astro:sun:19c7b2f15b:daylight#event  
type: core.ChannelEventTrigger  
conditions:   
actions:
- inputs: {}  
id: “2”  
configuration:  
command: ON  
itemName: LichtStromEingang\_Relay1\_Output  
type: core.ItemCommandAction
- inputs: {}  
id: “3”  
configuration:  
command: ON  
itemName: LichtTerrasseGarage\_Power  
type: core.ItemCommandAction
- inputs: {}  
id: “4”  
configuration:  
command: ON  
itemName: LichtTerrasseHaupt\_Power  
type: core.ItemCommandAction
- inputs: {}  
id: “5”  
configuration:  
command: ON  
itemName: StromTerrasse\_Power  
type: core.ItemCommandAction

---

<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:** [May 25, 2023, 6:29am UTC](https://community.openhab.org/t/i-want-to-use-astro-to-switch-on-off-a-light-at-sunrise-sunset/139177/12 "2023-05-25T06:29:36Z")

</div>

You could use the do only if not daylight like here:

> [@Conditional Switch Turn on - OH3](https://community.openhab.org/t/conditional-switch-turn-on-oh3/126478/4):
>
> Create a rule that is triggered by the front door opening and turns on the hall light. [image] [image] If the local sun phase name is NOT equal to DAYLIGHT (that will cover you from sunrise to sunset) Create an expire entry for the hall light that turns off after two minutes.
