- Platform information:
-
Hardware: Raspberry pi3b+
-
OS:openhabian
-
openHAB version:2.5.7
I’m having trouble using if statements in my rules I have other rules with if statements that don’t work as well and I’m very new to all of this. I have two dummy switches that are both being reported as on and off and the rule will run when I remove the if. Am I formating the if rule wrong or something else?
rule “We get Home at night”
when
Item d_home changed to ON or Item m_home changed to ON or Item test changed to ON
then
if( NightState==ON ) {
nano_dimmer.sendCommand(75)
ks_dimmer.sendCommand(100)
createTimer(now.plusMinutes(1), [ |
nano_dimmer.sendCommand(OFF)
ks_dimmer.sendCommand(OFF)
])}
endSwitch NightState “Night”
Switch test “Testing”
-
Have you tried if( NightState.state==ON )
1 Like
NightState isan Item object, with many properties - label, icon, type, name, etc.
Likely you are interested in its state.
if( NightState.state==ON ) {
1 Like
Ah ok I figured it was something simple I was missing and that would explain why I’ve never been able to get any if rule to work properly thank you!
1 Like