Wie können Temperatur, LaCrosse und andere Sensoren mit JeeLink abgefragt und mit Node-RED weiter verarbeitet werden. Den JeeLink mit diesem LaCrosseITPlusReader Sketch flashen:
Dann noch für Node-RED den Node serial installieren. Den serialport Node wie folgt installieren:
1 |
npm install node-red-node-serialport |
Hier der ganze Flow, der die Daten auf der Debug-Konsole ausgibt:
Diese Einstellungen sind für den Node nötig:
Wichtig ist der Port und die Geschwindigkeit:
Wer die Daten dann noch an einen MQTT Server senden will, kann diesen Sketch verwenden:
Einfach per copy und paste einfügen:
1 |
[{"id":"4f4e5830.489908","type":"serial in","z":"3235fb54.1ae56c","name":"JeeLink Serial Eingang","serial":"e2f6aa4c.a54608","x":125.36666870117188,"y":127.86666870117188,"wires":[["55c2c551.574ed4","15334402.fe3db4"]]},{"id":"55c2c551.574ed4","type":"debug","z":"3235fb54.1ae56c","name":"","active":false,"console":"false","complete":"false","x":355.36669921875,"y":127.48333740234375,"wires":[]},{"id":"e4b62f1d.feb7a8","type":"comment","z":"3235fb54.1ae56c","name":"www.wenzlaff.info","info":"","x":803.5357055664062,"y":38.25000762939453,"wires":[]},{"id":"23504bef.07f3fc","type":"comment","z":"3235fb54.1ae56c","name":"Empfangen von Seriellen Daten mit JeeLink und senden an MQTT Server","info":"","x":290.3666687011719,"y":39.100006103515625,"wires":[]},{"id":"15334402.fe3db4","type":"function","z":"3235fb54.1ae56c","name":"Parse RF12B ","func":"// console.log(msg.topic, msg.payload, msg.qos, msg.retain);\n// context = {};\n\n//we are expecting data in form \"OK nodeid data1 data2 etc\"\nvar tokens = msg.payload.split(\" \"); \nvar outString = null;\nvar outTopic;\nif (tokens.shift() == \"OK\")\n{\n var nodeid = tokens.shift() & 0x1F;\n outString = tokens;\n outTopic = 'rfm12b/' + nodeid;\n}\nelse\n{\nreturn null;\n}\n\nvar msg2 = { payload:outString, topic:outTopic};\nreturn msg2;","outputs":"1","noerr":0,"x":361.25,"y":197.25,"wires":[["f5ae7b8d.48c588","dea133f5.8681f8"]]},{"id":"f5ae7b8d.48c588","type":"debug","z":"3235fb54.1ae56c","name":"","active":false,"console":"false","complete":"payload","x":547.36669921875,"y":197.48333740234375,"wires":[]},{"id":"dea133f5.8681f8","type":"mqtt out","z":"3235fb54.1ae56c","name":"MQTT Testserver Daten von JeeLink an /JeeLink/Data/Wetter","topic":"/JeeLink/Data/Wetter","qos":"","retain":"true","broker":"5b1845c3.af545c","x":408.36669921875,"y":300.26666259765625,"wires":[]},{"id":"e2f6aa4c.a54608","type":"serial-port","z":"3235fb54.1ae56c","serialport":"/dev/ttyUSB0","serialbaud":"57600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":false},{"id":"5b1845c3.af545c","type":"mqtt-broker","z":"","broker":"test.mosquitto.org","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}] |