hi i just bought sigbee scene switch and add thing scene_sw1 with item scene_sw1_button (string) when i press one of 4 buttons it receive state 1_single 2_single etc, now i think i need a rule to :
when i press the button (receive update)
2 if state = 1_singe and
3 if pokoj_1 is on send command Pokoj_1(off) if Pokoj_1 is off send command(on) - change state of light01.
Can somemone help me to start this rule ?
rule “scena2”
when
Item scena_sw1 received update
if scena_sw1=1_single
then
if Pokoj_1=On
Pokoj_1.sendCommand(OFF)
else
Pokoj_1.sendCommand(on)
I strongly recommend using Blockly instead of Rules DSL. You don’t need to know the syntax of the code that way. It’s all just blocks.
If you insist on writing rules in Rules DSL in .rules files, please review the Rules documentation including all the links therein. Don’t just guess at the syntax, you’ll waist a ton of time.
For example, this shows how to create an if statement.
With Blockly, you just need to drag the “if” block over to the page.
OH is large and complex and built upon lots of layers of abstraction. If you skip the docs and fail to understand certain key concepts, you will end up waisting a ton of time in frustration. You are unlikely to be successful if you just jump in and try random stuff.