Check this out:
rule "alarm front door"
when
Item AlarmFrontDoor changed from ON to OFF
then
logInfo("AlarmStatus-arr-rule", "running...")
if ((1 == 1) || (2 == 2)) {
if ( 1 == 1) {
say("The front door is open", "pollytts:Salli", "enhancedjavasound")
} else {
sendXMPP("email1@email.com", "The front door has been opened!")
sendXMPP("email2@email.com", "The front door has been opened!")
}
} else {
logInfo("AlarmStatus-arr-rule", "justarrived home: "+JustArrived.state)
}
end
and this does NOT have the same behavior, showing it’s absolutely a matter of variable/Item type and use.
The logs are : Event.log :
2019-02-25 09:19:11.966 [ome.event.ItemCommandEvent] - Item 'AlarmFrontDoor' received command OFF
2019-02-25 09:19:11.967 [vent.ItemStateChangedEvent] - AlarmFrontDoor changed from ON to OFF
openhab.log:
2019-02-25 09:19:11.967 [INFO ] [me.model.script.AlarmStatus-arr-rule] - running...
2019-02-25 09:19:11.968 [DEBUG] [ce.pollytts.internal.PollyTTSService] - Synthesize 'The front door is open' in format AudioFormat [codec=MP3, container=NONE, bitDepth=16, bitRate=64000, frequency=22050]
2019-02-25 09:19:11.968 [DEBUG] [ce.pollytts.internal.PollyTTSService] - voice UID: 'pollytts:Salli' voice label: 'Salli' voice Locale: en_US
2019-02-25 09:19:11.968 [DEBUG] [ce.pollytts.internal.PollyTTSService] - Synthesize 'The front door is open' in format AudioFormat [codec=MP3, container=NONE, bitDepth=16, bitRate=64000, frequency=22050]
2019-02-25 09:19:11.968 [DEBUG] [ce.pollytts.internal.PollyTTSService] - Audio Stream for 'The front door is open' in format AudioFormat [codec=MP3, container=NONE, bitDepth=16, bitRate=64000, frequency=22050]
2019-02-25 09:19:11.968 [DEBUG] [ce.pollytts.internal.PollyTTSService] - voice UID: 'pollytts:Salli' voice label: 'Salli' voice Locale: en_US
2019-02-25 09:19:11.969 [DEBUG] [ce.pollytts.internal.PollyTTSService] - Audio Stream for 'The front door is open' in format AudioFormat [codec=MP3, container=NONE, bitDepth=16, bitRate=64000, frequency=22050]
So, else clearly works, there’s definitely something in the way JustArrived is set or used.
Okay… so where to from here?
- It’s an item, not a variable (thank you for the clarification)
- The item is on a timer,
- I set it with JustArrived.state = ON and JustArrived.postUpdate(ON) , but they both have the same unintended effect.
Is it something local to the IF statement, should the item be used differently or should I use a variable? If I use a variable, can that be used as a Switch in the sitemap?