Finish rule when first condition met

I don’t write code, so I may have terminology wrong (maybe why i cant find a topic to explain what i need to do…).
I’m majorly cleaning up some rules and reducing complexity now that I’ve been at this almost a year.
There’s a rule I’m working on now that I want it to break after the first matching condition is met or send a default value if none are met.
I thought this was how you did it but it doesn’t seem to work:

rule "Set Furnace Mode"
	Item NestTStat_HVAC_Mode changed or
	Item furHiHtNT_Trigger received command ON or
	Item furLoHtNT_Trigger received command ON or
	Item furHiHtOH_Trigger received command ON or
	Item furLoHtOH_Trigger received command ON or
	Item furLoFan_Trigger changed or
	Item Nest_Run changed or
	Item furnaceOHRun changed
	if ( furHiHtNT_Trigger.state == ON && NestTStat_HVAC_Mode.state == "HEAT" ) {
	} else if ( furLoHtNT_Trigger.state == ON && NestTStat_HVAC_Mode.state == "HEAT" ) {
	} else if ( furHiHtOH_Trigger.state == ON && NestTStat_HVAC_Mode.state == "HEAT" ) {
	} else if ( furLoHtNT_Trigger.state == ON && NestTStat_HVAC_Mode.state == "HEAT" ) {
	} else if ( furLoFan_Trigger.state == ON ) {
	} else {

there’s a couple other conditions i need to add in there so ignore if there aren’t enough off conditions :stuck_out_tongue:

I just need to figure out how to make it send a command on the first met condition and then exit or run all the way to the bottom if none are met. it doesn’t seem to be doing that as is…

Not sure I understand everything: does your rule never do anything, is it doing all at once? It likely will help if you add your item definitions too.
But most importantly, before you post this do a little sleuthing by adding logInfo statements, for example you could add this immediately after the then to detect whether your rule even triggers:
logInfo("Set furnace mode rule","Rule got triggered")
If you see that it triggers (you would see the message above in your logs, check the docs if you don’t know where your log-files are, it depends on your system): congrats, you at least know that your rule triggers as you want it. If it does not, check your items.

For the next step, you may want to log the values of your items to figure out what is going on; something like:
logInfo("Set furnace mode rule", "Item furHiHtNT_Trigger has state: " + furHiHtNT_Trigger.state.toString)
and you can do this for all items and find their states written into your logs.
Doing that step-by-step and adding more logInfo statements where you need it will likely lead you in the right direction.

crap, i may have spoken prematurely… waiting for it to change again.

the first time the rule ran the output should have been 1 but it set to 0. i thought anyway…now i’m not so sure.

nevermind, what i saw was a delay when the nest binding updates its state.

there’s another rule that updates some other important items and i mistook a state in the above rule changing twice as an error but now i see that its completely expected based on the timing of how things react because of the nest binding. sorry
just ignore this whole thing!

Are you sure this rule does always what you want?

Do you actively set the *_Trigger Items to state OFF?
Otherwise, the rule will always take the first line that is true, this is not necessarily the one which triggered the rule.

yes, at least so far. I’ll be watching it this evening when openhab takes over control of the furnace.
Due to WAF the Nest mostly controls the furnace during the day but to keep just the nursery and master warm at night the nest is set very low and OH has direct control of the furnace. here’s a portion of a rule where i’m being sure to turn off unused triggers:

rule "Auxiliary Heat Zone Upper"
	Item AuxHeatUpper received command
	logInfo("AuxHeatUpper changed", zoneUpperVentCount.toString )
 	if ( AuxHeatUpper.state == ON && NestTStat_HVAC_Mode.state.toString == "HEAT" && Nest_Run.state == OFF ) {
		if ( zoneUpperVentCount.state == 4 || zoneUpperVentCount.state == 3 ) {
			logInfo("vent count:","4 or 3")

It’s a two stage furnace which is why there’s a Hi and Lo trigger. Depending on the number of open vents the furnace will run in high or low (and corresponding fan speed). the last, separate furnaceOHRun command is used to trigger other events that need to know who is running the furnace (in case you’re curious about what the other stuff is).