ASTRO Rule Weirdness

So I have the following rule…

rule "Holiday Mode On"
when
	Channel 'astro:sun:home:set#event' triggered START
then
if (VIR_HolidaySwitch.state==ON)
{
    HolidayRemote1.sendCommand(ON)
    FntPatioPlug.sendCommand(ON)
    WalkGatePlug.sendCommand(ON)
    GarageHolidaySwitch.sendCommand(ON)
}	
end

The rule does not fire…

If I change the WHEN statement from ASTRO to CRON it works as it should.

I do not see any errors in the log files

What is weird to me, is that I have another rule with similar styling that DOES RUN.

rule "turn landscape lighting off"
when
    Channel 'astro:sun:home:set#event' triggered START 
then
    FntLandscapeLights.sendCommand(ON)
    BckLandscapeLights.sendCommand(ON)
end

Can you not run two rules that start off the same trigger?

Any suggestions?

Yes, you can. I’m having it the same way with my astro triggers.

Add some logging to find out at which step the rule does not get executed …

As I mentioned above, if I change the Astro line to Cron it works…the Astro trigger is the line that does not fire.

If you are sure about that look for some hidden characters in your rule code.

No hidden characters. I wonder if this is related to the other multiple Astro rule errors I’ve seen mentioned.

Can you please post your astro thing config

astro:sun:home  [ geolocation="29.732733029,-95.475100095", interval=60 ]
astro:moon:home [ geolocation="29.732733029,95.475100095", interval=60 ]

One of your longitudes looks wrong. Not sure which one, though, and not sure it’s even relevant to the problem.

-95.475100095
95.475100095

Snapshot 2.2 works without any problems.

Ok, I’m, still having ASTRO weirdness…

I am on 2.2 Snapshot 1072

This rule works perfectly…

exterior.rules

rule "turn landscape lighting off"
when
    Channel 'astro:sun:home:rise#event' triggered START 
then
    FntLandscapeLights.sendCommand(OFF)
    BckLandscapeLights.sendCommand(OFF)
end

rule "turn landscape lighting on"
when
    Channel 'astro:sun:home:set#event' triggered START 
then
    FntLandscapeLights.sendCommand(ON)
    BckLandscapeLights.sendCommand(ON)
end

In the log I see the following:

2017-11-09 17:28:00.009 [vent.ChannelTriggeredEvent] - astro:sun:home:set#event triggered START
2017-11-09 17:28:00.084 [ome.event.ItemCommandEvent] - Item 'FntLandscapeLights' received command ON
2017-11-09 17:28:00.086 [vent.ItemStateChangedEvent] - FntLandscapeLights changed from OFF to ON
2017-11-09 17:28:00.087 [ome.event.ItemCommandEvent] - Item 'BckLandscapeLights' received command ON

I also have another rule:

sunset_holiday.rules

rule "Holiday Mode On"
when
    Channel 'astro:sun:home:set#event' triggered START
then
    if (VIR_HolidaySwitch.state==ON)
{
    HolidayRemote1.sendCommand(ON)
    FntPatioPlug.sendCommand(ON)
    WalkGatePlug.sendCommand(ON)
    GarageHolidaySwitch.sendCommand(ON)
}
end

rule "Holiday Mode Off"
when
    Time cron "0 1 0 1/1 * ? *" 
then
    if (VIR_HolidaySwitch.state==ON)
{
    HolidayRemote1.sendCommand(OFF)
    FntPatioPlug.sendCommand(OFF)
    WalkGatePlug.sendCommand(OFF)
    GarageHolidaySwitch.sendCommand(OFF)
}	
end

The virtual holiday switch is on

this rule does not fire and writes nothing to the log files…something is afoul here.

Guidance is greatly appreciated.

I don’t know if underscores are allowed in rules names, I would try it without:

sunsetholiday.rules

Geez…really? :roll_eyes:

I’ll rename and see if that works…if it does I’ll submit to the docs so it can be put in the rules documentation.

Grrrr

1 Like

Well the UNDERSCORE was the issue. Thanks to @sihui for pointing it out.

I’ll post a suggested change to the documentation so that others will not run into this.

Squid