Hello!
I want to pass a value to a dimmer with a rule written with Blockly. The trigger is a switch, if it gets the value “ON” it should dim the dimmer to 90%, if I turn the switch off(“OFF”) and set it back to “ON” it should dim to 0%.
But the dimmer only gets the value 0%.
What am I doing wrong?
Openhab: Openhab 3.1m4
System: Windows 10
triggers:
- id: "1"
configuration:
itemName: SwitchDummy
state: ON
type: core.ItemStateUpdateTrigger
conditions: []
actions:
- inputs: {}
id: "2"
label: Lichtan/aus
configuration:
blockSource: <xml xmlns="https://developers.google.com/blockly/xml"><block
type="controls_if" id="gkt+EW@]!Le@uUevt5Dw" x="268" y="148"><mutation
elseif="1"></mutation><value name="IF0"><block type="logic_compare"
id="(Yzk0`P6dlPez5=AYz,B"><field name="OP">GT</field><value
name="A"><block type="oh_item" id="?PxB/Jy7[Q*:{L`X_l_3"><field
name="itemName">ModbusData32000_ValueasDimmer</field></block></value><value
name="B"><block type="text" id="G~Yks3vn~9as_0n^?C~1"><field
name="TEXT">70</field></block></value></block></value><statement
name="DO0"><block type="oh_event" id="4^AP_rrutVK]Z1`RnoeU"><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id="B-a{+rnN*weuPEE8rzz-"><field
name="TEXT">0</field></shadow></value><value name="itemName"><shadow
type="oh_item" id="cpj5s_R`XT1*ENN6?6?U"><field
name="itemName">ModbusData32000_ValueasDimmer</field></shadow></value></block></statement><value
name="IF1"><block type="logic_compare" id="-7UB3O(IJ01jE:f=591p"><field
name="OP">LT</field><value name="A"><block type="oh_item"
id="P{;8]_}?vM;4`I8.09|H"><field
name="itemName">ModbusData32000_ValueasDimmer</field></block></value><value
name="B"><block type="text" id="Hrc@JqC$9F{c0orZ[9HW"><field
name="TEXT">70</field></block></value></block></value><statement
name="DO1"><block type="oh_event" id="muTk3alHE7mz^#2!B475"><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id="jR!%yAAoA6]`R8Y^LZby"><field
name="TEXT">90</field></shadow></value><value name="itemName"><shadow
type="oh_item" id="]v1Ar+f`Iqk,C+zoTxol"><field
name="itemName">ModbusData32000_ValueasDimmer</field></shadow></value></block></statement></block></xml>
type: application/javascript
script: |
if ('ModbusData32000_ValueasDimmer' > '70') {
events.sendCommand('ModbusData32000_ValueasDimmer', '0');
} else if ('ModbusData32000_ValueasDimmer' < '70') {
events.sendCommand('ModbusData32000_ValueasDimmer', '90');
}
type: script.ScriptAction