Easy rule

Hello,
i’m new for rules, someone know where is the problem on this easy rule on OH2?

the first item
LuceDivano.sendCommand(lucelettura)
doesn’t work here but work on other rules


rule "door_contact"
when
    Item contatto_cucina changed
    or Item contatto_sala changed
	or Item contatto_bagno changed
	or Item alarm_voice changed
	or Item alarm_keypad changed
then
	LuceDivano.sendCommand(lucelettura)

	if ((contatto_cucina.state = ON or contatto_cucina.state = ON or contatto_cucina.state = ON )){
		if (alarm_voice = ON or alarm_keypad = ON){
			allarme_Fired.sendCommand(1)
		}else{
			allarme_Fired.sendCommand(0)
		}
	}
end


Thank you

What is lucelettura? It isn’t declared or defined anywhere. You must declare a variable before its first use.

Correct, but the rule doesn’t still work :frowning:

rule "door_contact"
when
    Item contatto_cucina changed
    or Item contatto_sala changed
	or Item contatto_bagno changed
	or Item alarm_voice changed
	or Item alarm_keypad changed
then
	
	var HSBType lucerelax = new HSBType(new DecimalType(74),new PercentType(78),new PercentType(36))
	LuceDivano.sendCommand(lucerelax)

	if ((contatto_cucina.state = ON or contatto_cucina.state = ON or contatto_cucina.state = ON )){
		if (alarm_voice = ON or alarm_keypad = ON){
			allarme_Fired.sendCommand(1)
		}else{
			allarme_Fired.sendCommand(0)
		}
	}
end

Please give more details. Help us help you.

You should make it a routine to always look at the error messages by the openHAB designer an into the log files to see potential error messages.

One obvious mistake is the comparison with a single equal sign. “Equals” comparison is done with if(a == 5). Correct all your ifs and then check the log for errors.

I need to define some import?

Ok found. it’s just case sensitive… Thank you to all