[Solved]Switch trigger not triggering rule

Hello
I’m having an issue where these two rules are not being triggered by switch commands. They both run perfectly when triggered by Time cron but does not trigger by switch commands.

What conditions can make this happen?

The event bus is seeing the commands

2016-04-12 12:58:39 - MC_Gstatus received command ON
2016-04-12 12:58:40 - MC_Glist received command ON
2016-04-12 12:58:41 - MC_Gstatus received command ON
2016-04-12 12:58:41 - MC_Glist received command ON

Items

String MC_Text		"Minecraft Reply[%s]"	(MC)

Switch MC_Gstatus	"Update server status"	(MC)	{autoupdate="false"}
String MC_status	"Server status [%s]"	(MC)

Switch MC_Glist		"Update players"	(MC)	{autoupdate="false"}
Number MC_list		"Players online: [%d]"		(MC)

sitemap exerpt

        Frame label="MinecraftServer" {
		Switch item=MC_Server	mappings=[ON="Start", OFF="Stop"]
		Text item=MC_Text
		Text item=MC_status
	} // MC Server
	Frame label="WIP" {
		Switch item=MC_Gstatus	mappings=[ON="UPDATE"]
		Switch item=MC_Glist	mappings=[ON="UPDATE"]
	}

rules.

rule "Minecraft_list"
when
	Item MC_Glist recieved command
	or
	Time cron "0 34 12 ? * *"   // trigger by time cron set 1 or 2 mins from now. Debugger
then
	logInfo("MC_Server", "Glist triggered")
        // do stuff ...
end

rule "Minecraft_status"
when
	Item MC_Gstatus recieved command
	or
	Time cron "0 */15 * ? * *"	// every 15 mins
then
	logInfo("MC_Server", "Gstatus triggered")
        // do stuff ...
end

Edit solution:
I misspelled received as recieved

I’ve not seen examples where the “or” is put on a separate line like that. I can’t say for sure if that is the problem but it is the only thing that stands out to me. I usually put the or at the end of the line:

Item MC_Glist received command or

I have a rule with these triggers and it seems to work just fine.

Time cron "0 0 15 ? * 2,4,6"	// at 15:00, any day of month, any month, mon,wed,fri
	or
	Time cron "0 0 13 ? * 3,5"	// at 13:00, any day of month, any month, t,th
	or
	Time cron "0 0 11 ? * 1,7"	// at 11:00 on sat,sun

however I did try that suggestion and it didnt change anything

(it posted before i was done typing)

What happens if you use received update? The event log and what I can tell from looking at the rules says it should work. Have you loaded the rules into Designer? Maybe there is a subtle syntax error preventing it from working.

Sigh I knew I would be something like this, even after looking for such things
I copied another out of context switch command to the triggers and tested that and it worked. so after reviewing

Item MC_Server received command
	or
	Item MC_Glist recieved command or 
	Time cron "0 57 12 ? * *"

I realized I misspelled "received"
All works now

Thank you for your help :slight_smile:

‘i’ before ‘e’ except after ‘c’ … Those are the hardest errors to find without help from something like Designer. Glad you found it! Sometimes I wonder if the permissiveness of the Rules DSL is more of a hinderance than a help. Wouldn’t that have been easier to figure out and fix if there were some parse errors in the log?

1 Like

Can someone please post entire Minecraft thing sitemap and items files really apreciate this.