Hallo und einen schönen Nachmittag
Ich habe den Code mit "Design" erstellt und hier ist der erzeugte Code:
triggers:
- id: "3"
configuration:
itemName: Temperature2TZ2000a476raq2
type: core.ItemStateChangeTrigger
conditions:
- inputs: {}
id: "4"
configuration:
itemName: TestschalterOSRAM_OnOff
state: OFF
operator: <
type: core.ItemStateCondition
actions:
- inputs: {}
id: "2"
configuration:
blockSource: <xml xmlns="
https://developers.google.com/blockly/xml"><block
type="controls_if" id="GcWQevSU-Mu6=4cfJ)T*" x="279" y="268"><value
name="IF0"><block type="logic_compare" id="xx+jSrQ/Y_JK$7711hId"><field
name="OP">LT</field><value name="A"><block type="oh_getitem_state"
id="H-J]q/xTO5jbn9}YIxvY"><value name="itemName"><shadow type="oh_item"
id="A/qfm[iWiG?ZqqzqR;5+"><field
name="itemName">Temperature2TZ2000a476raq2_Temperature</field></shadow></value></block></value><value
name="B"><block type="text" id="c=DM0Vy75z[]~b}9@Y(0"><field
name="TEXT">23</field></block></value></block></value><statement
name="DO0"><block type="oh_event" id="[ZoyoR3F_}s~j[LqIl#e"><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id="NBl;V9~i[|(HI30IPMP?"><field
name="TEXT">ON</field></shadow></value><value name="itemName"><shadow
type="oh_item" id="Ya229n?.o91wwzvXH=P4"><field
name="itemName">TestschalterOSRAM</field></shadow></value></block></statement></block></xml>
type: application/javascript
script: >
if
(itemRegistry.getItem('Temperature2TZ2000a476raq2_Temperature').getState()
< '23') {
events.sendCommand('TestschalterOSRAM', 'ON');
}
type: script.ScriptAction
- inputs: {}
id: "1"
configuration:
blockSource: <xml xmlns="
https://developers.google.com/blockly/xml"><block
type="controls_if" id="I=x(1OjRujp#kdZ5xr+;" x="204" y="65"><value
name="IF0"><block type="logic_compare" id="riVMNBd@-+j^cmr}@l,c"><field
name="OP">GT</field><value name="A"><block type="oh_getitem_state"
id="Dm7K#N#14UnkqOR#Tj^)"><value name="itemName"><shadow type="oh_item"
id="YL?8[^}j8!R6v+}y/Xg^"><field
name="itemName">Temperature2TZ2000a476raq2_Temperature</field></shadow></value></block></value><value
name="B"><block type="text" id="V,e;L9yU(`vPDnk@0g~U"><field
name="TEXT">23</field></block></value></block></value><statement
name="DO0"><block type="oh_event" id="9F09EnV~6KT0TkkULPT("><field
name="eventType">sendCommand</field><value name="value"><shadow
type="text" id="2zGu+%S;GxM8yY0t8}`/"><field
name="TEXT">OFF</field></shadow></value><value name="itemName"><shadow
type="oh_item" id="t^v]%8o6J}Czk63XJ~5n"><field
name="itemName">TestschalterOSRAM</field></shadow></value></block></statement></block></xml>
type: application/javascript
script: >
if
(itemRegistry.getItem('Temperature2TZ2000a476raq2_Temperature').getState()
> '23') {
events.sendCommand('TestschalterOSRAM', 'OFF');
}
type: script.ScriptAction
------
Servus
Dieter