[SOLVED] Astro rules not working. Nothing happens!

  • Platform information:
    • Hardware: QNAP NAS
    • OS: Linux
    • Java Runtime Environment: which java platform is used and what version
    • openHAB version: 2.2.0

Hello again,

I am setting up my first rule. I cannot get my sunset rule to work. My astro.rules is below.

I have confirmer the sendCommand function is working by placing it into a different rule triggered by a cron schedule.

The sunset time/sun elevation is working correctly and appearing in the BasicUI.

Can I have a clue of what is wrong, please?

Thanks, George

rule "Sunset Rule"
    Channel "astro:sun:local:set#event" triggered START
    // Do what you want to do at start of sunset for example:
    // tplinksmarthome:hs110:energyswitch2:switch
    sendCommand(F2_Loft_Light, ON)

rule "Sunrise Rule"
    Channel "astro:sun:local:rise#event" triggered START
    // Do what you want to do at start of sunset
    sendCommand(F2_Loft_Light, OFF)

I have a test rule for sun set that is working…the only difference I can spot from yours is that i put the astro:sun:local:set#event in single quote, not doubles.

I don’t know if it can make some difference.


There is another thread that says that I should use double quotes, not single!

Maybe it does not matter… or maybe it does?

I don’t know…I just pointed out a difference…let’s wait someone who knows more.
Meanwhile…can you confirm you have the Channel in the astro thing configuration? and that is named that way?


Double quotes are fine, that should work. (As long as they are not these “fancy” curly quotes)

The point where this might also be going wrong, is that you are using the function sendCommand, which takes two strings as arguments, like so:

sendCommand("F2_Loft_Light", "OFF")

The advised way is however to use the method .sendCommand, like so:


Next to that, do you see something like “astro:sun:local:rise#event triggered START” in your events.log?

I can see the event in the events.log.

I have taken the sendCommand from a different rule file, which works fine. So, I would be surprised if this did not work. Nevertheless, I have changed this commend and will wait until tomorrow morning and see if the light is turned on.

2019-05-12 20:35:00.058 [vent.ChannelTriggeredEvent] - astro:sun:home:daylight#event triggered END
2019-05-12 20:35:00.061 [vent.ChannelTriggeredEvent] - astro:sun:home:set#event triggered START

Spot the difference:


Those are two different channels…

1 Like

Oh my goodness. So they are!!!

What a learning curve this openhab is…

Thank you. That fixed it.

I think I need to figure out how to use HabMIN. The absence of a syntax checker is making the configuration of the text files too tricky.

You might want to look into using Visual Studio Vode with the OpenHAB extension:

I however do not think that would have prevented this error unfortunately.

1 Like