Rules Not working after


(Oddi Austin Ferreira) #1

This my rule file

// RGB Rules
import org.openhab.core.library.types.* rule “Set RGB value RGBNeo1” when
Item RGBNeo1 changed then
val hsbValue = RGBNeo1.state as HSBType
val brightness = hsbValue.brightness.intValue
val redValue = ((((hsbValue.red.intValue * 255) / 100) *brightness) /100).toString
val greenValue = ((((hsbValue.green.intValue * 255) / 100) *brightness) /100).toString
val blueValue = ((((hsbValue.blue.intValue * 255) / 100) *brightness) /100).toString
val color = redValue + “,” + greenValue + “,” + blueValue
sendCommand( RGBLedColor, color)
end

//Scenes

rule “Lighting Scene Sleep”
when
Item Scene_Sleep received command ON
then
sendCommand(ODSmartSwitch1Channel1, ON)
sendCommand(ODSmartSwitch1Channel2, OFF)
sendCommand(ODSmartSwitch1Channel3, OFF)
sendCommand(ODSmartSwitch1Channel4, OFF)
sendCommand(ODSmartSwitch1Channel5, OFF)
sendCommand(ODSmartSwitch1Channel6, ON)
sendCommand(ODSmartSwitch1Channel7, ON)
sendCommand(ODSmartSwitch1Channel8, OFF)
sendCommand(RGBNeo1, 63,31,0)

    postUpdate( Scene_Sleep, OFF)
end

rule “Lighting Scene Wakeup”
when
Item Scene_Wakeup received command ON
then
sendCommand(ODSmartSwitch1Channel1, OFF)
sendCommand(ODSmartSwitch1Channel2, OFF)
sendCommand(ODSmartSwitch1Channel3, OFF)
sendCommand(ODSmartSwitch1Channel4, OFF)
sendCommand(ODSmartSwitch1Channel5, OFF)
sendCommand(ODSmartSwitch1Channel6, OFF)
sendCommand(ODSmartSwitch1Channel7, OFF)
sendCommand(ODSmartSwitch1Channel8, OFF)

    sendCommand(RGBNeo1, 0,0,0)

    postUpdate( Scene_Wakeup, OFF)
end

But as soon as i enter anything with var all my rules stop working

var Timer MyTimer1 = null ( eg Automatic Light Off Rule )


(Vincent Regaud) #2

Please use the code fences:

Please show your code that is not working too.


(Oddi Austin Ferreira) #3

My system is openhab2
Im new to openhab so using everything from examples
The code which is not working was used from this link. Automatic Light Off Rule
the problem is as soon as i put anything starting with var in rule file all my rules stop working.


(Vincent Regaud) #4

Post the rule file that is not working