[SOLVED] Turn on light in the morning, if sun is down

This item’s name is Sunrise_Time
The Item is linked to an Astro channel.

To use that Item in a rule, you would refer to it by its name. Same way as you refer to your lights by Item name to send commands in the same rule.

Generally you’d be interested in the Item’s state.

Sunrise_Time.state

Thank you, Thank you, Thank you - it works!
I believe I started all out by using Sunrise_time, but I have tried so many different things I don’t remember any longer.

For anybody who would be in the same situation - here is my config.

Openhab 2.4
Astrow Binding Installed and configured.

default.items

/* Astro */
DateTime         Sunrise_Time       "Sunrise [%1$tH:%1$tM]"                   { channel="astro:sun:local:rise#start" }
DateTime         Sunset_Time        "Sunset [%1$tH:%1$tM]"                    { channel="astro:sun:local:set#start" }

timer.rules

rule "Tænd spot facade når det er mørkt"
	when
		
        Time cron "0 47 23 ? * MON-FRI *"
	then
		if (now.isAfter((Sunrise_Time.state as DateTimeType).getZonedDateTime.toInstant.toEpochMilli)){
                       
                    Spot_Facade.sendCommand(ON) 
                    Spot_Terrasse.sendCommand(ON)
        }
end

Now I just have to find the best sunrise vs sunset and IsBefore or isAfter.

Thanks again :smiley:

1 Like