Add LaCrosse Sensor like technoLine with JeeLink to node-red

This flows shows you how to get the Sensor values from a LaCrosse Sensor and who to decode the values from the JeeLink.

For this there are a lot of tutorials on the web for example: http://blog.wenzlaff.de/?p=3427

Then plug the JeeLink Stick into the node-red server

Second configure the Serial Node

Take a Serial node and configure it for the JeeLink with:

SerialPort:     /dev/ttyUSB0
Baud Rate:      57600
Data Bits:      8
Parity:         None
Stop Bits:      0

SplitInput:     on the character \n
and delivery:   ascii strings

Connect with the InfluxDB

the rest see in the Flow: I had a long time to figure out how the input from the JeeLink looks like. Here it is:

# Temperature sensor - Format:
#      0   1   2   3   4
# -------------------------
# OK 9 56  1   4   156 37     ID = 56  T: 18.0  H: 37  no NewBatt
# OK 9 49  1   4   182 54     ID = 49  T: 20.6  H: 54  no NewBatt
# OK 9 55  129 4   192 56     ID = 55  T: 21.6  H: 56  WITH NewBatt

# OK 9 2   1   4 212 106       ID = 2   T: 23.6  H: -- Channel: 1
# OK 9 2   130 4 225 125       ID = 2   T: 24.9  H: -- Channel: 2

# OK 9 ID XXX XXX XXX XXX
# |  | |  |   |   |   |
# |  | |  |   |   |   --- Humidity incl. WeakBatteryFlag
# |  | |  |   |   |------ Temp * 10 + 1000 LSB
# |  | |  |   |---------- Temp * 10 + 1000 MSB
# |  | |  |-------------- Sensor type (1 or 2) +128 if NewBatteryFlag
# |  | |----------------- Sensor ID
# |  |------------------- fix "9"
# |---------------------- fix "OK"

Code to encode the Message:

addr = bytes[0].toString(16)
battery_new = (parseInt(bytes[1]) & 0x80) >> 7;
battery_low = (parseInt(bytes[4]) & 0x80) >> 7;
type = (parseInt(bytes[1]) & 0x70) >> 4;
channel = parseInt(bytes[1]) & 0x0F;
temperature = ((parseInt(bytes[2]) * 256) + parseInt(bytes[3]) - 1000)/10;
humidity = parseInt(bytes[4]) & 0x7f;

Have fun !

--> The decription I have from the FHEM script http://fhem.de/fhem.html

[{"id":"3fefcd1b.d1acc2","type":"tab","label":"JeeLink"},{"id":"cf89d887.341568","type":"serial in","z":"3fefcd1b.d1acc2","name":"","serial":"3325d2c9.cb356e","x":130,"y":80,"wires":[["c9108dd9.d1ae6"]]},{"id":"c9108dd9.d1ae6","type":"function","z":"3fefcd1b.d1acc2","name":"Configuration","func":"msg.context = {}\nmsg.context['48'] = {'name':'SensorGarten'}\n\nnode.status({fill:\"blue\",shape:\"ring\",text:`${msg.payload}`})\nmsg.measurement = \"LaCrosse_Sensors\"\n\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":80,"wires":[["c743dc49.c8c97"]]},{"id":"c743dc49.c8c97","type":"function","z":"3fefcd1b.d1acc2","name":"ParseLaCrosseInput","func":"var code = msg.payload\nvar new_payload = {}\n// check if valid values\nif(code.match(/^OK 9/)) {\n  // split input into a byte array and deletes the first two bytes\n  var bytes = code.split(\" \");\n  bytes.shift()\n  bytes.shift()\n\n  var addr = bytes[0].toString()\n  if(!(addr in msg.context)){\n      node.status({fill:\"blue\",shape:\"ring\",text:`addr:${addr} is not defined !`})\n      return null\n  }\n  \n  new_payload.sensor = msg.context[addr].name\n  new_payload.battery_new = (parseInt(bytes[1]) & 0x80) >> 7\n  new_payload.battery_low = (parseInt(bytes[4]) & 0x80) >> 7\n  new_payload.type = (parseInt(bytes[1]) & 0x70) >> 4\n  new_payload.channel = parseInt(bytes[1]) & 0x0F\n  new_payload.temperature = ((parseInt(bytes[2]) * 256) + parseInt(bytes[3]) - 1000)/10\n  new_payload.humidity = parseInt(bytes[4]) & 0x7f\n  new_payload.message = msg.payload\n  \n  node.status({fill:\"blue\",shape:\"ring\",text:`T[${new_payload.temperature}°C]/H[${new_payload.humidity}%]`})\n  msg.payload = new_payload\n  return msg\n}\nreturn null;\n\n\n\n/**\n# Temperature sensor - Format:\n#      0   1   2   3   4\n# -------------------------\n# OK 9 56  1   4   156 37     ID = 56  T: 18.0  H: 37  no NewBatt\n# OK 9 49  1   4   182 54     ID = 49  T: 20.6  H: 54  no NewBatt\n# OK 9 55  129 4   192 56     ID = 55  T: 21.6  H: 56  WITH NewBatt\n\n# OK 9 2   1   4 212 106       ID = 2   T: 23.6  H: -- Channel: 1\n# OK 9 2   130 4 225 125       ID = 2   T: 24.9  H: -- Channel: 2\n\n# OK 9 ID XXX XXX XXX XXX\n# |  | |  |   |   |   |\n# |  | |  |   |   |   --- Humidity incl. WeakBatteryFlag\n# |  | |  |   |   |------ Temp * 10 + 1000 LSB\n# |  | |  |   |---------- Temp * 10 + 1000 MSB\n# |  | |  |-------------- Sensor type (1 or 2) +128 if NewBatteryFlag\n# |  | |----------------- Sensor ID\n# |  |------------------- fix \"9\"\n# |---------------------- fix \"OK\"\n**/","outputs":1,"noerr":0,"x":540,"y":80,"wires":[["fb97dd95.4ae0d"]]},{"id":"fb97dd95.4ae0d","type":"influxdb out","z":"3fefcd1b.d1acc2","influxdb":"1b0103fc.06b09c","name":"","measurement":"","x":770,"y":80,"wires":[]},{"id":"3325d2c9.cb356e","type":"serial-port","z":"3fefcd1b.d1acc2","serialport":"/dev/ttyUSB0","serialbaud":"57600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":false},{"id":"1b0103fc.06b09c","type":"influxdb","z":"","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"logger","name":"Influx Logger","usetls":false,"tls":""}]
swissglider

Flow Info

created 7 months ago

Node Types

Core
  • function (x2)
  • serial in (x1)
  • serial-port (x1)
Other

Tags

  • JeeLink
  • LaCrosse
  • technoLine
  • Influx
  • JeeNode
  • Node-Red
  • Sensor
  • Arduino
  • 868MHz
  • 433MHz
  • fhem
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option