Seite 1 von 1

UI Rule - Required input "device" of the condition "3" not connected

Verfasst: 10. Feb 2025 21:33
von TomW80
Hallo,

ich teste gerade die UI Rule und möchte eine Pushovernachricht bei einen Ereignis verschicken.
Das angegebene Gerät "Tom-Galaxys22" ist in Pushover angelegt. Doch warum erhalte ich beim Speichern der Rule den Fehler:
Validation of rule dd49895eca has failed! Required input "device" of the condition "3" not connected
So sieht mein Code aus:

Code: Alles auswählen

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: KG_Abstell1_Feuchte
    type: core.ItemStateUpdateTrigger
  - id: "2"
    configuration:
      itemName: KG_Waschkueche_Feuchte
    type: core.ItemStateUpdateTrigger
conditions:
  - inputs: {}
    id: "7"
    configuration:
      blockSource: <xml xmlns="https://developers.google.com/blockly/xml"><block
        type="controls_if" id="|CI11RGC]Z_!!OUT6s$[" x="21" y="26"><value
        name="IF0"><block type="logic_operation"
        id="uYMw5o4sH7r}6xV-Y8um"><field name="OP">OR</field><value
        name="A"><block type="logic_compare" id="_}%VrZ#d(C;u}y#@%Xr-"><field
        name="OP">GTE</field><value name="A"><block type="oh_getitem_state"
        id=",E.MA@2u?2f8e|@1pUa,"><value name="itemName"><shadow type="oh_item"
        id=")fcHO82:xd*?qC;rGQcw"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="~u@}y5pt#E@POp$|W,kg"><mutation itemName="KG_Abstell1"
        itemLabel="Abstellraum 1"></mutation><field
        name="itemName">KG_Abstell1</field></block></value></block></value><value
        name="B"><block type="oh_quantity_ext" id="IPZEio=GB8P^9cUzzL]s"><value
        name="value"><shadow type="text" id="~ZWqHm2O}Gy_NmaSa7*n"><field
        name="TEXT">10</field></shadow><block type="text"
        id="j9mQ?}lY:qBryU:(;MFo"><field
        name="TEXT">65</field></block></value><value name="unit"><shadow
        type="text" id="_ivX}A[HQYn9p9q;1/Ns"><field
        name="TEXT">W</field></shadow><block type="text"
        id="BEz*ZwJ{_?}KNcI#7Kvg"><field
        name="TEXT">%</field></block></value></block></value></block></value><value
        name="B"><block type="logic_compare" id="bJMt7?QqD(rZ[5PuQ%-7"><field
        name="OP">GTE</field><value name="A"><block type="oh_getitem_state"
        id="}4[as}jM8VXzt+e$yAUN"><value name="itemName"><shadow type="oh_item"
        id=")fcHO82:xd*?qC;rGQcw"><mutation itemName="MyItem"
        itemLabel="MyItem"></mutation><field
        name="itemName">MyItem</field></shadow><block type="oh_item"
        id="#0NydKbm5C]S`Q+`jvOH"><mutation itemName="KG_Waschkueche"
        itemLabel="Waschküche"></mutation><field
        name="itemName">KG_Waschkueche</field></block></value></block></value><value
        name="B"><block type="oh_quantity_ext" id="Zwae]cZzkfG?O;H.vUDQ"><value
        name="value"><shadow type="text" id="~ZWqHm2O}Gy_NmaSa7*n"><field
        name="TEXT">10</field></shadow><block type="text"
        id="z*,xB395Ab$zj[LM0qvg"><field
        name="TEXT">65</field></block></value><value name="unit"><shadow
        type="text" id="_ivX}A[HQYn9p9q;1/Ns"><field
        name="TEXT">W</field></shadow><block type="text"
        id="PWh9rR2?WT2KV40y=2XD"><field
        name="TEXT">%</field></block></value></block></value></block></value></block></value></block></xml>
      type: application/javascript
      script: >
        if (items.getItem('KG_Abstell1').state >= Quantity('65' + '%') ||
        items.getItem('KG_Waschkueche').state >= Quantity('65' + '%')) {

        }
    type: script.ScriptCondition
actions:
  - id: "3"
    configuration:
      config: pushover:pushover-account:******
      device: Tom-Galaxys22
      message: TEST
    type: pushover.sendMessageToDevice#*****


Was mache ich falsch?

Re: UI Rule - Required input "device" of the condition "3" not connected

Verfasst: 10. Feb 2025 21:40
von udo1toni
Es wäre mir neu, dass man Blockly so verwenden kann.
Du hast ja einen if-block mit offenem Ausführungsteil.
Also entweder nutzt Du die Pushover Funktion direkt in einem (vollständigen) (Blockly) Script, oder Du musst zumindest irgendwie dafür sorgen, dass die ScriptCondition true oder false zurückgibt.

Re: UI Rule - Required input "device" of the condition "3" not connected

Verfasst: 10. Feb 2025 21:59
von Harka
des Weiteren gibt es für Vergleiche von UoM-Werten ein extra Block https://www.openhab.org/docs/configurat ... comparison

Für pushover gibt es eine Blockly-Erweiterung (selbst nicht in Nutzung!). https://community.openhab.org/t/pushover-actions/134051

Re: UI Rule - Required input "device" of the condition "3" not connected

Verfasst: 17. Feb 2025 20:33
von TomW80
Mit Blockly war es fürs erste einfacher das Programm zu schreiben. Mit Euren Hinweisen konnte ich das nun ohne Blocky umsetzen. Allerdings funktioniert der Vergleich nicht. Bei jeder Änderung von einem Item wird eine Pushover-Nachricht verschickt.

Code: Alles auswählen

configuration: {}
triggers:
  - id: "1"
    configuration:
      itemName: KG_Abstell1_Feuchte
    type: core.ItemStateUpdateTrigger
  - id: "2"
    configuration:
      itemName: KG_Waschkueche_Feuchte
    type: core.ItemStateUpdateTrigger
conditions: []
actions:
  - inputs: {}
    id: "3"
    configuration:
      type: application/javascript
      script: >-
        var things = Java.type('org.openhab.core.model.script.actions.Things');



        if (items.getItem('KG_Abstell1').state >= Quantity('65 %') ||
        items.getItem('KG_Waschkueche').state >= Quantity('65 %')) {
          things.getActions(
            'pushover',
            'pushover:pushover-account:70bd0905dc').sendMessage(
              'Feucht im Keller > 65%, bitte kontrollieren!',
              'openHAB'
          );
        }
    type: script.ScriptAction
Die beiden Items sehen so aus. (noch Textbasiert)

Code: Alles auswählen

Number:Dimensionless  KG_Abstell1_Feuchte  "KG Abstellraum 1 Feuchte [%.2f %]"       <humidity>        (KG_Abstell1, Feuchte_KG)                                         ["Humidity"]                 {channel="knx:device:42a36ac8:TF_KG_Abstell1:Feuchte", unit="%", stateDescription=""[pattern="%.2f %%"]}

Number:Dimensionless  KG_Waschkueche_Feuchte  "KG Waschküche Feuchte [%.2f %]"       <humidity>                  (KG_Waschkueche, Feuchte_KG)                            ["Humidity"]                 {channel="knx:device:42a36ac8:TF_KG_Waschkueche:Feuchte", unit="%", stateDescription=""[pattern="%.2f %%"]}
Muss ich das ohne das Quantity() machen?

Und wie muss ich das machen, dass die Nachricht nur alle x Minuten gesendet wird?

Re: UI Rule - Required input "device" of the condition "3" not connected

Verfasst: 17. Feb 2025 21:53
von Harka
TomW80 hat geschrieben: 17. Feb 2025 20:33 ... Mit Euren Hinweisen ...
Äääähmm ..
Vergleiche von Werten mit Einheit funktionieren nicht ohne Weiteres mit ">="
Anbei ein Lösungsansatz bei dem die Meldung beim Überschreiten 1 mal erfolgt und dann erst wieder wenn der Wert zwischenzeitlich unter dem Vergleichswert war. Hier mit Temperatur und der OH-Notifikation. Das mit der Meldung alle x–Minuten solltest Du Dir noch mal genau überlegen. Da gibt es imho smartere Lösungsansätze.
Forum_UoM_Vergleich_2501.png

Re: UI Rule - Required input "device" of the condition "3" not connected

Verfasst: 24. Feb 2025 20:23
von TomW80
Danke Harka, es funktioniert jetzt.
Screenshot 2025-02-24 202304.jpg