Switch light on with Sunset does not work. What do I wrong?

I run openHAB on a Synology NAS.

I use two Sonoff S20 switches with MQTT to switch two different lamps. That is working well.
But one of the lamps I want to switch on with Sunset and off at 00:00 hours.

The switching on at sunset is not working, even if I can see an event for that in the eventlogg.

default.items

Switch 	Balkong 	"Balkongdörr"	{mqtt=">[mybroker:/BalkongdorrLamp/gpio/12:command:ON:1],>[mybroker:/BalkongdorrLamp/gpio/12:command:OFF:0],<[mybroker:/BalkongdorrLamp/lightState/Switch:command:OFF:0],<[mybroker:/BalkongdorrLamp/lightState/Switch:command:ON:1]"}
Switch 	Fonster 	"Fönster"  		{mqtt=">[mybroker:/VardagsrumLamp/gpio/12:command:ON:1],>[mybroker:/VardagsrumLamp/gpio/12:command:OFF:0],<[mybroker:/VardagsrumLamp/lightState/Switch:command:OFF:0],<[mybroker:/VardagsrumLamp/lightState/Switch:command:ON:1]"}
Switch 	Framdorr 	"Framdörr"  	{mqtt=">[mybroker:/UtomhusFramdorr/gpio/12:command:ON:1],>[mybroker:/UtomhusFramdorr/gpio/12:command:OFF:0],<[mybroker:/UtomhusFramdorr/lightState/Switch:command:OFF:0],<[mybroker:/UtomhusFramdorr/lightState/Switch:command:ON:1]"}
Switch 	Garage 		"Garage"  		{mqtt=">[mybroker:/UtomhusBalkong/gpio/12:command:ON:1],>[mybroker:/UtomhusBalkong/gpio/12:command:OFF:0],<[mybroker:/UtomhusBalkong/lightState/Switch:command:OFF:0],<[mybroker:/UtomhusBalkong/lightState/Switch:command:ON:1]"}
Switch 	Kontor 		"Kontor"  		{mqtt=">[mybroker:/UtomhusKontoret/gpio/12:command:ON:1],>[mybroker:/UtomhusKontoret/gpio/12:command:OFF:0],<[mybroker:/UtomhusKontoret/lightState/Switch:command:OFF:0],<[mybroker:/UtomhusKontoret/lightState/Switch:command:ON:1]"}

DateTime Date  "Date [%1$tY-%1$tm-%1$td %1$tH:%1$tM]"  { channel="ntp:ntp:demo:dateTime" }

default.things

ntp:ntp:demo [ hostname="se.pool.ntp.org", refreshInterval=60, refreshNtp=30 ]

default.rules

rule "lichtuit"
when
	Time cron "0 0 0 ? * *"
then
	sendCommand(Balkong, OFF)
end

rule "lichtaan"
when
	Item Sunset_Time received update ON
then
    sendCommand(Balkong, ON)
end

Item Sunset_Time is created in openHAB Paper UI.

Att Sunset time (19:51) is see the following events in events.log:

2018-04-12 19:50:52.296 [vent.ItemStateChangedEvent] - Date changed from 2018-04-12T19:49:52.274+0200 to 2018-04-12T19:50:52.284+0200
2018-04-12 19:51:00.055 [vent.ChannelTriggeredEvent] - astro:sun:906dd801:daylight#event triggered END
2018-04-12 19:51:00.058 [vent.ChannelTriggeredEvent] - astro:sun:906dd801:set#event triggered START
2018-04-12 19:51:52.318 [vent.ItemStateChangedEvent] - Date changed from 2018-04-12T19:50:52.284+0200 to 2018-04-12T19:51:52.304+0200
...
2018-04-12 19:54:52.425 [vent.ItemStateChangedEvent] - Date changed from 2018-04-12T19:53:52.404+0200 to 2018-04-12T19:54:52.414+0200
2018-04-12 19:55:00.016 [vent.ChannelTriggeredEvent] - astro:sun:906dd801:civilDusk#event triggered START
2018-04-12 19:55:00.019 [vent.ChannelTriggeredEvent] - astro:sun:906dd801:set#event triggered END
2018-04-12 19:55:52.439 [vent.ItemStateChangedEvent] - Date changed from 2018-04-12T19:54:52.414+0200 to 2018-04-12T19:55:52.424+0200
2018-04-12 19:56:52.446 [vent.ItemStateChangedEvent] - Date changed from 2018-04-12T19:55:52.424+0200 to 2018-04-12T19:56:52.434+0200

Can anybody tell me what I am doing wrong?

try to:


when
    Channel 'astro:sun:906dd801:set#event' triggered START 
then
 sendCommand(Balkong, ON)   
end
1 Like

Thank you. This solved it.