Erste Schritte mit Der Grafische Logikeditor Node-RED

Direkteinstieg in unsere Applikationssammlung:  Node-RED App Library – kostenlose Anwendungen zum Download zur Heimautomatisierung

Einführung

Die perfekte Ergänzung von realKNX umfasst das extrem leistungsfähige und dennoch einfach zu bedienende visuelle Programmierwerkzeug Node-RED. Node-RED kann für den Aufbau von Automatisierungsaufgaben verwendet werden, indem einfach Funtionsblöcke zusammengeschaltet werden. Die Programmierung erfolgt grafisch über das Verbinden vordefinierter Funktionsblocks, sogenannter Knoten. Eingangsknoten, Verarbeitungsknoten und Ausgangsknoten werden miteinander verbunden, um einfache oder komplexe Aufgaben auszuführen.

Die Programmierung von Node-RED erfordert keine Kenntnisse einer Progammiersprache.

Der Benutzer hat Zugriff auf eine umfangreiche Bibliothek, die kopiert und und nach Bedarf angepasst werden kann. Die Bibliotheksmodule umfassen die Anwendung von Funktionsbausteinen wie zum Beispiel UND / ODER Verknüpfungen oder SMS & Push-Benachrichtigungen auf Mobiltelefone.

1) realKNX:

 

–> realknx-in: Listens to state changes of a selected realKNX Item.

–> realknx-get: Gets an realKNX Item on an input message.

–> realknx-monitor: Monitors the realknx-controller node.

–> realknx-out: Sends commands or state updates to a selected realKNX Item.

Programmierbeispiele

Inhalt: 

1)UND, ODER, XOR Logik

2)Invertierung

3)Push notification

4)HTTP Request

5)Google Home – Text-to-speech über einen einfachen Befehl [1bit]

6)Google Home – Text-to-speech mit Variablenausgabe[1byte]

7) Google Home – Informationsausgabe über die „AUX-Funktion“

8) Logik in Abhängigkeit von Uhrzeit und Sonnenstand

9)Mathematische Funktionen

1)UND, ODER, XOR Logik

Für diese logischen Operation muss im Eingabeknoten  “ -> Convert output to boolean:  „ angewählt werden

Folgende Knoten werden benötigt: 

  • realknx-in
  • boolean logic
  • realknx-out  oder einen anderen Kommandoknoten.

AND: Wenn alle Eingänge gleichzeitig „true“ sind, wird der Ausgang „true“ geschaltet, sonst „false“
OR: Wenn einer der Eingänge „true“ ist, wird der Ausgang „true“ geschaltet, sonst „false“
XOR: Der Ausgang ist genau dann logisch „true“, wenn an einer ungeraden Anzahl von Eingängen „true“ anliegt und an den restlichen „false“

Beispiel:

Die Rückmeldungen von drei Lichtkreisen wird mittels Oder Verknüpfung auf eine Sammelmeldung gelegt. Wenn zumindest einer der Lichtkreise eingeschaltet ist, wird dies über die Sammelmeldung auf den Bus geschickt.

Code


[{"id":"3c3fe9e.0537896","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Garage - Appliques","passthru":false,"booleanoutput":true,"outputatstartup":true,"x":251,"y":160,"wires":[["3bee6971.de7ad6"]]},{"id":"9d1c8922.b81be","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Garage - Sol","passthru":false,"booleanoutput":true,"outputatstartup":true,"x":229,"y":208,"wires":[["3bee6971.de7ad6"]]},{"id":"4ec00c31.05d30c","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Garage - Spots","passthru":false,"booleanoutput":true,"outputatstartup":true,"x":239,"y":256,"wires":[["3bee6971.de7ad6"]]},{"id":"3bee6971.de7ad6","type":"BooleanLogic","z":"b8c9a488.f73c78","name":"","operation":"OR","inputCount":"3","topic":"startup","x":557.0000152587891,"y":214,"wires":[["b70b887c.6514d"]]},{"id":"b70b887c.6514d","type":"realknx-out","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Garage - Etat Lumière","topic":"","payload":"","booleaninput":true,"x":800,"y":214,"wires":[]},{"id":"b1d2fbe.d184108","type":"realknx-controller","z":"","name":"realknx-ctrl","host":"localhost","port":"3000"}]

2)Invertierung

Für diese Operation muss im Eingabeknoten  “ -> Convert output to boolean:  „ angewählt werden

Folgende Knoten werden benötigt: 

  • realknx-in
  • Invert
  • realknx-out  oder einen anderen Kommandoknoten.

INVERT: Die Ausgabe dieser Funktion invertiert den Zustand des Eingangs

Beispiel:

Einschalten eines Lichtkreises wenn ein anderer ausgeschaltet wird.

Code


[{"id":"e9b09c5d.d73498","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Home cinema - Floor","passthru":false,"booleanoutput":true,"outputatstartup":true,"x":280,"y":480,"wires":[["f02983b1.243f5"]]},{"id":"3a85553b.314fc2","type":"realknx-out","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Home cinema - Table","topic":"","payload":"","booleaninput":true,"x":660,"y":480,"wires":[]},{"id":"f02983b1.243f5","type":"Invert","z":"b8c9a488.f73c78","name":"Invert","x":468.7840881347656,"y":479.34090423583984,"wires":[["3a85553b.314fc2"]]},{"id":"b1d2fbe.d184108","type":"realknx-controller","z":"","name":"realknx-ctrl","host":"localhost","port":"3000"}]

 

3)Push notification

Für diese Operation muss im Eingabeknoten  “ -> Convert output to boolean:  „ angewählt werden

Folgende Knoten werden benötigt: 

  • realknx-in
  • pushbullet

PUSHBULLET: In Abhängigkeit des Zustand eines Eingangsknotens werden unterschiedliche Nachrichten auf das Smartphone geschickt

Installation: 

a) Menu Node-Red aufrufen („Hamburger“ oben rechts)
b) Manage Palette anwählen
c) Install (auf der linken Seite des Fensters)
d) Folgendes Text eingeben um das entsprechende Modul in der Community zu suchen und anschliessend installieren: node-red-node-pushbullet
e) Anschliessend das Modul pushbullet im Flow ergänzen

Konfiguration des Knotens: 

a) Folgende Seite öffnen https://www.pushbullet.com/
b) Konto erstellen
c) Unter Settings den „Account“ anwählen
d) Erstellen eines Access Token
e) Den API code kopieren
f) Nach Node-Red zurückkehren
g) Menu Node-Red aufrufen („Hamburger“ oben rechts)
h) Configuration Nodes anwählen
i) Auf „PushBullet Config“ doppelklicken und den API code einfügen
j) Die kostenlose App pushbullet aus dem jeweiligen Store laden und sich mit den Kontodaten anmelden

Hinweis zur Parametrierung des Flows:

Wenn Pushbullet Knoten die msg.payload empfängt, wird die Information auf die ausgewählten Smartphones geschickt. Der „Title“ ist die Nachricht, die auf dem Smartphone angezeigt wird.

Beispiel:

In Abhängigkeit des binären Zustands eines Eingangsknotens werden zwei verschiedene Nachrichten auf das Smartphone geschickt

Code


[{"id":"ba7a85a1.07fe98","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Salon - Porte","passthru":false,"booleanoutput":true,"outputatstartup":false,"x":356,"y":700,"wires":[["775ea7a1.00d32"]]},{"id":"775ea7a1.00d32","type":"switch","z":"b8c9a488.f73c78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","outputs":2,"x":510,"y":700,"wires":[["a017101e.aebce"],["a1f60797.dbba7"]]},{"id":"a017101e.aebce","type":"change","z":"b8c9a488.f73c78","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"La porte est ouverte","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":680,"wires":[["833d043e.dcdbb8"]]},{"id":"a1f60797.dbba7","type":"change","z":"b8c9a488.f73c78","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"La porte est fermée","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":720,"wires":[["cd5639c0.4f288"]]},{"id":"833d043e.dcdbb8","type":"pushbullet","z":"b8c9a488.f73c78","config":"","pushtype":"note","title":"","chan":"","name":"","x":890,"y":680,"wires":[]},{"id":"cd5639c0.4f288","type":"pushbullet","z":"b8c9a488.f73c78","config":"","pushtype":"note","title":"","chan":"","name":"","x":890,"y":720,"wires":[]},{"id":"b1d2fbe.d184108","type":"realknx-controller","z":"","name":"realknx-ctrl","host":"localhost","port":"3000"}]

 

4)HTTP Request

Lors de la configuration, vous devez impérativement sélectionner l’option  “ -> Convert output to boolean:  „ dans le module realknx-in

Module nécessaire:

  • realknx-in
  • HTTP request

HTTP REQUEST: En fonction de l’état du realknx-in, vous allez pouvoir envoyer une requête HTTP vers un équipement.

Exemple:

Envoyer une requête HTTP à votre télévision en fonction de l’état de votre enceinte..

Code


[{"id":"f8cb8e8.22a45f","type":"http request","z":"b8c9a488.f73c78","name":"","method":"GET","ret":"txt","url":"// TAP HER YOUR HTTP REQUEST // ","tls":"","x":810,"y":982,"wires":[[]]},{"id":"b2755673.6edbb8","type":"switch","z":"b8c9a488.f73c78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":657.2159118652344,"y":982.6590881347656,"wires":[["f8cb8e8.22a45f"]]},{"id":"6d35eaec.797f3c","type":"switch","z":"b8c9a488.f73c78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","outputs":1,"x":656.2159118652344,"y":1043.6590881347656,"wires":[["ff34358b.70dda8"]]},{"id":"f1874af0.0150e8","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Living Room - Speaker","passthru":true,"booleanoutput":true,"outputatstartup":false,"x":456.2159118652344,"y":1013.6590957641602,"wires":[["b2755673.6edbb8","6d35eaec.797f3c"]]},{"id":"ff34358b.70dda8","type":"http request","z":"b8c9a488.f73c78","name":"","method":"GET","ret":"txt","url":"// TAP HER YOUR HTTP REQUEST // ","tls":"","x":810,"y":1043,"wires":[[]]},{"id":"b1d2fbe.d184108","type":"realknx-controller","z":"","name":"realknx-ctrl","host":"localhost","port":"3000"}]

 

5)Google Home – Text-to-speech über einen einfachen Befehl [1bit]

Lors de la configuration, vous devez impérativement sélectionner l’option  “ -> Convert output to boolean:  „ dans le module realknx-in

Module nécessaire:

  • realknx-in
  • googlehome-notify-nj4

 

googlehome-notify-nj4 : Lorsque ce module reçoit un msg.payload, il va le traduire en parole sur le Google Home sélectionné.

Configuration du Node: 

a) Menu de Node-Red (hamburger en haut à droite)
b) Cliquer sur Configuration Nodes
c) Double-click sur „GoogleHome-config-node“ et tapez l’adresse IP du Google Home

Exemple:

Faire dire à un Google Home une information concernant votre installation comme si la porte est en train de s’ouvrir ou pas.

Code


[{"id":"33ab6bc6.fb20d4","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Salon - Porte","passthru":false,"booleanoutput":true,"outputatstartup":false,"x":301,"y":1240,"wires":[["db683951.359918"]]},{"id":"db683951.359918","type":"change","z":"b8c9a488.f73c78","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"La porte est ouverte","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"La porte est fermé","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":504,"y":1240,"wires":[["b3250fb4.5acc1"]]},{"id":"b3250fb4.5acc1","type":"googlehome-notify-nj4","z":"b8c9a488.f73c78","server":"","name":"Google Home","x":720,"y":1240,"wires":[]},{"id":"b1d2fbe.d184108","type":"realknx-controller","z":"","name":"realknx-ctrl","host":"localhost","port":"3000"}]

 

6)Google Home – Text-to-speech mit Variablenausgabe[1byte]

Lors de la configuration, vous ne devez pas sélectionner l’option  “ -> Convert output to boolean:  „ dans le module realknx-in

Module nécessaire:

  • realknx-in
  • googlehome-notify-nj4

googlehome-notify-nj4 : Lorsque ce module reçoit un msg.payload, il va le traduire en parole sur le Google Home sélectionné.

Configuration du Node: 

a) Menu de Node-Red (hamburger en haut à droite)
b) Cliquer sur Configuration Nodes
c) Double-click sur „GoogleHome-config-node“ et tapez l’adresse IP du Google Home

Configuration de la fonction: 

a) Double-Click sur la fonction „[var] Volume“
b) Modifier le texte qui en vert car c’est celui qui va être dit par Google. Veuillez respecter la mise en forme.

Exemple:

Faire dire à un Google Home une information concernant votre installation comme le niveau de votre volume..

Code


[{"id":"c6a115fa.a8cc68","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Salon - Volume","passthru":false,"booleanoutput":false,"outputatstartup":false,"x":340,"y":1480,"wires":[["4ba41f76.45f718"]]},{"id":"a1c6650c.c32788","type":"function","z":"b8c9a488.f73c78","name":"[var] Volume","func":"var nombre = Number(msg.payload);\n// Please choose your text in green then integrate your variable with \n var msg1 = { payload : \"Le volume est à \"+ nombre + \" pourcents\" }; \n return [msg1]; ","outputs":"1","noerr":0,"x":730,"y":1480,"wires":[["2ad828bc.d5c9d"]]},{"id":"4ba41f76.45f718","type":"delay","z":"b8c9a488.f73c78","name":"","pauseType":"queue","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"6","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":540,"y":1480,"wires":[["a1c6650c.c32788"]]},{"id":"2ad828bc.d5c9d","type":"googlehome-notify-nj4","z":"b8c9a488.f73c78","server":"","name":"Google Home","x":920,"y":1480,"wires":[]},{"id":"b1d2fbe.d184108","type":"realknx-controller","z":"","name":"realknx-ctrl","host":"localhost","port":"3000"}]

 

7) Google Home – Informationsausgabe über die „AUX-Funktion“

Lors de la configuration, vous ne devez pas sélectionner l’option  “ -> Convert output to boolean:  „ dans le module realknx-in pour un [AUX-1byte]

Lors de la configuration, vous devez impérativement sélectionner l’option  “ -> Convert output to boolean:  „ dans le module realknx-in pour un [AUX-1bit-ON]

Module nécessaire: 

  • realknx-in
  • googlehome-notify-nj4

 

Exemple:

Avec cet exemple, Google Home va dire „Il est l’heure de venir à table“ lorsque d’un appui sur notre bouton KNX. Cela peut être utile pour prévenir le reste de la maison d’un événement:

  • A table
  • Au lit
  • Debout
  • etc…

 

Code


[{"id":"dd2a1a75.b6bed8","type":"change","z":"b8c9a488.f73c78","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Il est l'heure de venir à table","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":1680,"wires":[["8f53c325.db62a"]]},{"id":"9668f26a.1e2518","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Maison - A table","passthru":true,"booleanoutput":false,"outputatstartup":false,"x":342,"y":1680,"wires":[["588bf36e.4e415c"]]},{"id":"588bf36e.4e415c","type":"trigger","z":"b8c9a488.f73c78","op1":"0","op2":"1","op1type":"str","op2type":"str","duration":"1","extend":false,"units":"s","reset":"","name":"","x":500,"y":1680,"wires":[["4a4b6d45.d0f4fc"]]},{"id":"8003f40e.5d68a8","type":"change","z":"b8c9a488.f73c78","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Il est l'heure de venir à table","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":1744,"wires":[["371b87c6.16a428"]]},{"id":"88426965.3d0ce8","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Maison - A table","passthru":true,"booleanoutput":true,"outputatstartup":false,"x":342,"y":1744,"wires":[["d49fe69.a4c8b18"]]},{"id":"d49fe69.a4c8b18","type":"trigger","z":"b8c9a488.f73c78","op1":"false","op2":"true","op1type":"bool","op2type":"bool","duration":"1","extend":false,"units":"s","reset":"","name":"","x":500,"y":1744,"wires":[["806745fb.aeffa"]]},{"id":"806745fb.aeffa","type":"switch","z":"b8c9a488.f73c78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","outputs":1,"x":630,"y":1744,"wires":[["8003f40e.5d68a8"]]},{"id":"4a4b6d45.d0f4fc","type":"switch","z":"b8c9a488.f73c78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"str"}],"checkall":"true","outputs":1,"x":630,"y":1680,"wires":[["dd2a1a75.b6bed8"]]},{"id":"b7955ee3.2e3a38","type":"comment","z":"b8c9a488.f73c78","name":"[AUX-1byte]","info":"","x":174,"y":1681,"wires":[]},{"id":"492097ed.01972","type":"comment","z":"b8c9a488.f73c78","name":"[AUX-1bit-ON]","info":"","x":174,"y":1744,"wires":[]},{"id":"8f53c325.db62a","type":"googlehome-notify-nj4","z":"b8c9a488.f73c78","server":"","name":"Google Home","x":963,"y":1680,"wires":[]},{"id":"371b87c6.16a428","type":"googlehome-notify-nj4","z":"b8c9a488.f73c78","server":"","name":"Google Home","x":963,"y":1744,"wires":[]},{"id":"b1d2fbe.d184108","type":"realknx-controller","z":"","name":"realknx-ctrl","host":"localhost","port":"3000"}]

 

8) Logik in Abhängigkeit von Uhrzeit und Sonnenstand

Lors de la configuration, vous devez impérativement sélectionner l’option  “ -> Convert output to boolean:  „ dans le module realknx-in

Lors de la configuration, vous devez impérativement sélectionner l’option  “ -> If msg arrives on input, always pass through to output: „ dans le module realknx-in

Module nécessaire:

  • realknx-in
  • Big Timer
  • Invert
  • Boolean logic
  • realknx-out

 

Big Timer : Ce module permet de faire de faire des actions en fonction d’une horloges, du coucher/lever du soleil, à l’aube/crépuscule, et au debut/fin de nuit.

 

 

 

 

 

 

 

 

 

Configuration du Node: 

a) Double-click sur „Big Timer“ 
b) Renseigner obligatoirement la latitude et la longitude de votre position pour permettre de calculer les informations en fonction du soleil.
c) Choisir le moment pour On time et OFF time

Exemple:

Lors de l’appui sur la touche l’interrupteur KNX „Cosy/Off“, je vais activer un scénario d’ambiance pour ma pièce avec un „true“. Si il fait nuit, cela sera le Cosy Night qui sera mis en route avec un éclairage faible pour ne pas agresser les yeux. En revanche, si il fait jour, c’est le scénario Cosy day qui sera activé dans le but de créer une ambiance beaucoup plus intense. Lorsque d’un second appui sur cette touche, je vais envoyer un „false“ qui va couper l’ensemble des lumières de ma pièce.

Code


[{"id":"a74a8206.e8374","type":"bigtimer","z":"b8c9a488.f73c78","outtopic":"fromBigTimer","outpayload1":"true","outpayload2":"false","name":"BigTimer","lat":"43.623753","lon":"7.046926","starttime":"5000","endtime":"5001","startoff":0,"endoff":0,"offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"suspend":false,"random":false,"repeat":true,"atstart":true,"x":300,"y":1980,"wires":[["86192dfe.3b06d8","cf44dfe2.d785e8"],[],[]]},{"id":"85cc8dd8.eb1e78","type":"inject","z":"b8c9a488.f73c78","name":"Day","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"x":112,"y":1960,"wires":[["a74a8206.e8374"]]},{"id":"19cf71c.158890e","type":"inject","z":"b8c9a488.f73c78","name":"Night","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"x":112,"y":2000,"wires":[["a74a8206.e8374"]]},{"id":"86192dfe.3b06d8","type":"BooleanLogic","z":"b8c9a488.f73c78","name":"","operation":"AND","inputCount":2,"topic":"result","x":568,"y":2044.5,"wires":[["148658a6.d55757"]]},{"id":"df511ab8.528158","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Garage - Cosy/Off","passthru":true,"booleanoutput":true,"outputatstartup":false,"x":130,"y":2124,"wires":[["5a4031b4.27b858","f3867525.c0ad"]]},{"id":"5a4031b4.27b858","type":"switch","z":"b8c9a488.f73c78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":298,"y":2101,"wires":[["681e0db.51b04f4"]]},{"id":"148658a6.d55757","type":"switch","z":"b8c9a488.f73c78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":694,"y":2044.5,"wires":[["375024a7.ac9d04"]]},{"id":"ab9c5d03.dc7ec","type":"BooleanLogic","z":"b8c9a488.f73c78","name":"","operation":"AND","inputCount":2,"topic":"result","x":568,"y":2098,"wires":[["1624889e.45d31f"]]},{"id":"681e0db.51b04f4","type":"trigger","z":"b8c9a488.f73c78","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"1","extend":false,"units":"s","reset":"","name":"","x":428,"y":2100,"wires":[["86192dfe.3b06d8","ab9c5d03.dc7ec"]]},{"id":"1624889e.45d31f","type":"switch","z":"b8c9a488.f73c78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","outputs":1,"x":696,"y":2098,"wires":[["e09afd00.f47d8"]]},{"id":"cf44dfe2.d785e8","type":"Invert","z":"b8c9a488.f73c78","name":"Invert","x":430,"y":2046,"wires":[["ab9c5d03.dc7ec"]]},{"id":"5c60b768.e54f48","type":"comment","z":"b8c9a488.f73c78","name":"BigTimer (more..)","info":"The BigTimer sends 'true' during daytime and night time its sends 'false'.\n\n**Note** You must change the location, make sure to use '.'' and not ',' in the lat/long.","x":300,"y":1920,"wires":[]},{"id":"8d1ac3e2.7989e","type":"comment","z":"b8c9a488.f73c78","name":"Force day & night","info":"For test for example","x":100,"y":1920,"wires":[]},{"id":"f3867525.c0ad","type":"switch","z":"b8c9a488.f73c78","name":"","property":"payload","propertyType":"msg","rules":[{"t":"false"}],"checkall":"true","outputs":1,"x":297,"y":2147,"wires":[["e9858590.1d3278"]]},{"id":"e9858590.1d3278","type":"realknx-out","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Garage - All OFF","topic":"","payload":"","booleaninput":true,"x":1077,"y":2147,"wires":[]},{"id":"51131f7d.3dc3b8","type":"comment","z":"b8c9a488.f73c78","name":"replace these (more..)","info":"The 'Cosy day' and 'Cosy night' are debug nodes to show the output values.\n\nReplace the 'Cosy day' and 'Cosy night' debug nodes with your realKNX-out nodes.\n","x":1100,"y":1980,"wires":[]},{"id":"fee0912b.5a3ef","type":"realknx-out","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Garage - Cosy Day","topic":"ItemCommand","payload":"","booleaninput":true,"x":1075,"y":2044,"wires":[]},{"id":"eed010be.beb638","type":"realknx-out","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Garage - Cosy Night","topic":"ItemCommand","payload":"","booleaninput":true,"x":1085.7840881347656,"y":2098.34090423584,"wires":[]},{"id":"8dc69f49.54c86","type":"inject","z":"b8c9a488.f73c78","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":true,"x":1308,"y":2099,"wires":[["fee0912b.5a3ef","eed010be.beb638","e9858590.1d3278"]]},{"id":"375024a7.ac9d04","type":"change","z":"b8c9a488.f73c78","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"29","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":861,"y":2044,"wires":[["fee0912b.5a3ef"]]},{"id":"e09afd00.f47d8","type":"change","z":"b8c9a488.f73c78","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"30","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":864,"y":2098,"wires":[["eed010be.beb638"]]},{"id":"d2aa59a.f9539a8","type":"comment","z":"b8c9a488.f73c78","name":"number of your scene (0..63)","info":"","x":860,"y":1980,"wires":[]},{"id":"95d66bca.bc4a4","type":"comment","z":"b8c9a488.f73c78","name":"Don't remove..","info":"The next version will be delete this function... ","x":1313,"y":2051,"wires":[]},{"id":"b1d2fbe.d184108","type":"realknx-controller","z":"","name":"realknx-ctrl","host":"localhost","port":"3000"}]

 

9)Mathematische Funktionen

Lors de la configuration, vous ne devez pas sélectionner l’option  “ -> Convert output to boolean:  „ dans le module realknx-in

Module nécessaire: 

  • realknx-in
  • Fonction
  • realknx-out si nécéssaire pour une commande

 

Exemple:

Nous avons le retour d’état de trois lampes KNX qui vont me permettre grâce à la logique de m’indiquer si une des lampes est allumée ou pas. Cela est utile car je peux savoir si j’ai bien éteint TOUTE les lumières dans une pièce. Je peux renvoyer cette information sur un objet d’état [1bit] grâce a un realknx-out.

 

Code


[{"id":"416f8540.e4dabc","type":"function","z":"b8c9a488.f73c78","name":"Addition","func":"// Replace the name in green with the name of your variable1\nif (msg.topic===\"Cinéma - Sol\") {\n context.global.Y0 = msg.payload;\n }\n // Replace the name in green with the name of your variable2\nif (msg.topic===\"Cinéma - Plafonnier\"){\n context.global.Y1 = msg.payload;\n }\n // Write the type of operation\nmsg.payload= context.global.Y0 + context.global.Y1 ;\n\n// The result is sent to msg.payload\nreturn msg ; ","outputs":"1","noerr":0,"x":720,"y":2940,"wires":[["c72cfc55.472828"]]},{"id":"e8844ec3.fb664","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Cinéma - Plafonnier","passthru":false,"booleanoutput":false,"outputatstartup":false,"x":530,"y":3060,"wires":[["b59826a.9f4ae58","cf040a0b.4f1af8","a52721a5.df419","eab83c28.b13048","416f8540.e4dabc"]]},{"id":"c72cfc55.472828","type":"debug","z":"b8c9a488.f73c78","name":"Addition","active":true,"console":"false","complete":"payload","x":940,"y":2940,"wires":[]},{"id":"b9f53d2f.2e6cc","type":"debug","z":"b8c9a488.f73c78","name":"Soustraction","active":true,"console":"false","complete":"payload","x":950,"y":2978,"wires":[]},{"id":"1c4fee2a.35e71a","type":"debug","z":"b8c9a488.f73c78","name":"Multiplication","active":true,"console":"false","complete":"payload","x":960,"y":3014,"wires":[]},{"id":"eab83c28.b13048","type":"function","z":"b8c9a488.f73c78","name":"Soustraction","func":"// Replace the name in green with the name of your variable1\nif (msg.topic===\"Cinéma - Sol\") {\n context.global.Y0 = msg.payload;\n }\n // Replace the name in green with the name of your variable2\nif (msg.topic===\"Cinéma - Plafonnier\"){\n context.global.Y1 = msg.payload;\n }\n // Write the type of operation\nmsg.payload= context.global.Y0 - context.global.Y1 ;\n\n// The result is sent to msg.payload\nreturn msg ; ","outputs":"1","noerr":0,"x":730,"y":2978,"wires":[["b9f53d2f.2e6cc"]]},{"id":"a52721a5.df419","type":"function","z":"b8c9a488.f73c78","name":"Multiplication","func":"// Replace the name in green with the name of your variable1\nif (msg.topic===\"Cinéma - Sol\") {\n context.global.Y0 = msg.payload;\n }\n // Replace the name in green with the name of your variable2\nif (msg.topic===\"Cinéma - Plafonnier\"){\n context.global.Y1 = msg.payload;\n }\n // Write the type of operation\nmsg.payload= context.global.Y0 * context.global.Y1 ;\n\n// The result is sent to msg.payload\nreturn msg ; ","outputs":"1","noerr":0,"x":740,"y":3014,"wires":[["1c4fee2a.35e71a"]]},{"id":"cf040a0b.4f1af8","type":"function","z":"b8c9a488.f73c78","name":"Division","func":"// Replace the name in green with the name of your variable1\nif (msg.topic===\"Cinéma - Sol\") {\n context.global.Y0 = msg.payload;\n }\n // Replace the name in green with the name of your variable2\nif (msg.topic===\"Cinéma - Plafonnier\"){\n context.global.Y1 = msg.payload;\n }\n // Write the type of operation\nmsg.payload= context.global.Y0 / context.global.Y1 ;\n\n// The result is sent to msg.payload\nreturn msg ; ","outputs":"1","noerr":0,"x":720,"y":3050,"wires":[["fc88ed97.e348e"]]},{"id":"fc88ed97.e348e","type":"debug","z":"b8c9a488.f73c78","name":"Divison","active":true,"console":"false","complete":"payload","x":940,"y":3050,"wires":[]},{"id":"b59826a.9f4ae58","type":"function","z":"b8c9a488.f73c78","name":"Moyenne","func":"// Replace the name in green with the name of your variable1\nif (msg.topic===\"Cinéma - Sol\") {\n context.global.Y0 = msg.payload;\n }\n // Replace the name in green with the name of your variable2\nif (msg.topic===\"Cinéma - Plafonnier\"){\n context.global.Y1 = msg.payload;\n }\n // Write the type of operation\nmsg.payload= (context.global.Y0 + context.global.Y1)/2 ;\n\n// The result is sent to msg.payload\nreturn msg ; ","outputs":"1","noerr":0,"x":720,"y":3086,"wires":[["e342c2b8.5d6c8"]]},{"id":"e342c2b8.5d6c8","type":"debug","z":"b8c9a488.f73c78","name":"Moyenne","active":true,"console":"false","complete":"payload","x":940,"y":3086,"wires":[]},{"id":"b1e43f52.61307","type":"realknx-in","z":"b8c9a488.f73c78","name":"","controller":"b1d2fbe.d184108","itemname":"Cinéma - Sol","passthru":false,"booleanoutput":false,"outputatstartup":false,"x":510,"y":2960,"wires":[["416f8540.e4dabc","eab83c28.b13048","a52721a5.df419","cf040a0b.4f1af8","b59826a.9f4ae58"]]},{"id":"b1d2fbe.d184108","type":"realknx-controller","z":"","name":"realknx-ctrl","host":"localhost","port":"3000"}]

 

10) Phillips HUE: Envoie état (On/Off) d’une lampe Phillips HUE pour realknx-node

Lors de la configuration, vous ne devez pas sélectionner l’option  “ -> Convert output to boolean:  „ dans le module realknx-in

Module nécessaire: 

  • realknx-in
  • Fonction
  • realknx-out si nécéssaire pour une commande

 

Exemple:

Nous avons le retour d’état de trois lampes KNX qui vont me permettre grâce à la logique de m’indiquer si une des lampes est allumée ou pas. Cela est utile car je peux savoir si j’ai bien éteint TOUTE les lumières dans une pièce. Je peux renvoyer cette information sur un objet d’état [1bit] grâce a un realknx-out.

 

Code


abc