[HELP] Have I missed something in a Rule?

Your rule only triggers on System started and at 06:00. Unless you happen to restart OH during one of those other times of day those if statements will never execute because the rule only gets triggered at the one time of day.

OK. So I found the error. As you said, I had only one Cron which would trigger at 6 AM.
So I included this Cron expression
(the timings are changed to the current time)

when
    System Started or
    Time cron "0 35 17 * * ? *" or
    Time cron "0 37 17 * * ? *" or
    Time cron "0 39 17 * * ? *"
then
    -------/do the if statements/-------

But when I combined that Cron into one expression, it worked like a charm. All the 3 modes of operation.

when
    System Started or
    Time cron "0 45,47,49 17 * * ? *"
then
     -------/do the if statements/-------

So I guess that multiple cron is solved in 2.2 version and not in 2.1
Or It should work but I am unable to do it for some reason??
Anyways my rule works, I am happy.

That is correct. Multiple cron triggers was solved in 2.2

Any further suggestions of where I should look to try and resolve my issue? Or is it a case of working towards upgrading to OH2.2?

How do the log files look like, are the ChannelTriggered events even there?

If not and you’re trying to debug the rule you are looking at the wrong place. The it would be the setup of the binding or the binding itself. If yes you should add logging the steps of the the rule, say every couple of lines, to see where it fails.

There is nothing in the events.log at all related to the triggers. So I’m guessing that it’s not the rule or syntax causing the issue.

The Astro binding seems to be configured correctly as I get my sun rise and sun set times.

Searching around, there are issues with this reported for 2.1 that should be fixed in 2.2. Don’t see the hardware you’re running on, but if pi consider testing this with a second SD card with 2.2 on it, and only the astro binding to see if it schedules the triggers.

I’m running OH on a VM, so no need for swapping SD cards around. I was already planning on migrating my configuration to 2.2 after I got it all working in 2.1, looks like I’ll have to bring those plans forward.

Thanks for your help.

@rlkoshak as you can see I have 3 modes of operation. What I want to understand is, if a mode say OCCUPIED received command ON, does it mean that the system considers the other 2 modes as “OFF” by default.
What I want to ask is, will the system hold the state of the other modes as “OFF” or not, without receiving a command “OFF”?

And most importantly can I use that default “OFF” state as a trigger in another rule?
Such as

rule "Manual Mode Operation - Seminar"
	when
		Item Occupied_Seminar received command OFF or
		Item Vacant_Seminar received command OFF or
		Item Night_Seminar received command OFF
	then
		if(Occupied_Seminar.state !=ON && Vacant_Seminar.state !=ON && Night_Seminar.state !=ON) {
			Operating_Mode_Seminar.sendCommand("MANUAL")
			Manual_Seminar.sendCommand(ON)
		}
end

Just want to understand if what I am thinking is possible or not.

I’m not sure I fully understand the question.

Rules are triggered by events. So the above Rule will run when Occupied_Seminar receives an OFF command, or Vacant_Seminar receives an OFF command, or Night_Seminar receives an OFF command. No two events are ever likely to occur at the same time, which is why it doesn’t make sense to have an and in the when clause of a Rule. That covers the Rule trigger.

Your if statement is using && so the body of the if statement will only execute if all three Items are OFF. An Item stays in whatever state it last was in until it receives a command or update that puts it into a different state, or OH has restarted or re-read in a .items file in which case all the Items get defaulted to NULL. If you have persistence set up, the Items will be updated to the most recently saved value in the database.

Sorry if my question was a bit confusing. I understood both your explanations perfectly well.
I did not realize about the when part. In my head I was thinking “and”, but I understand now that it is not possible to do like that.

I will tinker a bit on this for now.
Thanks for the info.
Sometimes the obvious things goes right out of the mind :disappointed:
and Sorry for deviating from the main topic by the OP.