Code Monkey home page Code Monkey logo

jeelink-mqtt's Introduction

Jeelink MQTT

This program exposes Jeelink data via MQTT. It connects to a given serial port and publishes data to a given MQTT topic.

The program is written in Java. You can run it on almost any device which can run Java.

Config file

Create a jeelink.properties file with the following content. The file must be placed beside the *.jar file.

mqttServer=tcp://broker.my.lan   #address of your MQTT server
logLevel=INFO                    #log level
topic=home/temperatures          #root topic
sketchName=LACR                  #LACR or EC3K
serialPortName=/dev/usb-lacr     #port name of your jeelink

Building and running

To build run the following commands:

mvn clean install
java -jar target/jeelink-mqtt-0.1.0-SNAPSHOT-jar-with-dependencies.jar

Alternatively you can download a release.

Supported sketches

Lacrosse

Use LACR as sketchName. The following data is published for each sensor:

home/temperatures/18/temperature 22.2
home/temperatures/18/humidity 48
home/temperatures/18/batterylow false

Energy Count 3000

Use EC3K as sketchName. The following data is published for each sensor:

home/ec3k/14E7/currentpower 31.0
home/ec3k/14E7/energy 199774
home/ec3k/14E7/timeon 24106151
home/ec3k/14E7/timetotal 24106151
home/ec3k/14E7/maxpower 51.6

Integration into Openhab

Sample for Lacrosse

Number temp_room1   "room1 temp [%.1f �C]" <temperature>  { mqtt="<[mosquitto:home/temperatures/63/temperature:state:default]" }
Number hum_room1   "room1 hum [%1d %%]" <humidity>  { mqtt="<[mosquitto:home/temperatures/63/humidity:state:default]" }
Switch bat_room1 "room1 battery low" {mqtt="<[mosquitto:home/temperatures/63/humidity/batterylow:state:MAP(battery.map)]"}

You need a battery.map file:

true=ON
false=OFF
NULL=OFF

Sample for EC3K

Number ec3k1Power "ec3k 1 power" { mqtt="<[mosquitto:home/ec3k/0E3D/currentpower:state:default]" }
Number ec3k1Max "ec3k 1 max" { mqtt="<[mosquitto:home/ec3k/0E3D/maxpower:state:default]" }
Number ec3k1EnergyTotal "ec3k 1 total" { mqtt="<[mosquitto:home/ec3k/0E3D/energy:state:default]" }

jeelink-mqtt's People

Contributors

dependabot[bot] avatar magcode avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jeelink-mqtt's Issues

TX22 (wind,rain,temp,hum)...

Hi, thanks for your effort and development done...

Is there a chance that you are also trying to support TX22....its already implemented in the LaCrosse-LaCrosseITPlusReader code (fhem).

Packets look like this....

`
#include "TX22IT.h"

/*
TX22-IT 8842 kbps 868.3 MHz

Message Format:
SSSS.DDDD DDAE.LQQQ TTTT.VVVV VVVV.VVVV ... CCCC.CCCC
Data - organized in nibbles - are structured as follows (example with blanks added for clarity):
a 5a 5 0 628 1 033 2 000 3 e00 4 000 bd

data always starts with "a"
from next 1.5 nibbles (here 5a) the 6 msb are identifier of transmitter,
bit 1 indicates acquisition/synchronizing phase
bit 0 will be 1 in case of error
next bit is the low battery flag
next three bits (here 5) is count of quartets transmitted
up to 5 quartets of data follow
each quartet starts with a type indicator (here 0,1,2,3,4)
0: temperature: 3 nibbles bcd coded tenth of °C plus 400 (here 628-400 = 22.8°C)
1: humidity: 3 nibbles bcd coded (here 33 %rH)
2: rain: 3 nibbles, counter of contact closures
3: wind: first nibble direction of wind vane (multiply by 22.5 to obtain degrees, here 0xe*22.5 = 315 degrees)
next two nibbles wind speed in m/s
4: gust: speed in m/s
next two bytes (here bd) are crc.
During acquisition/synchronizing phase (abt. 5 hours) all 5 quartets are sent, see example above. Thereafter
data strings contain only a few ( 1 up to 3) quartets, so data strings are not always of equal length.

                |--- acquisition/synchronizing phase
                ||-- Error
    "A"  -Addr.-|| Nbr.Q
    SSSS.DDDD DDAE.LQQQ  T          H          R          W          G           CRC

TX22IT [A 1 D 3 1 0 7 2 2 0 1 B 3 C F E C4 ] CRC:OK S:A ID:7 NewBatt:0 Error:1 Temp:--- Hum:72 Rain:27.00 Wind:25.40m/s from:270.00 Gust:--- CRC:C4
TX22IT [A 1 D 2 2 0 1 B 3 D F E 3A ] CRC:OK S:A ID:7 NewBatt:0 Error:1 Temp:--- Hum:--- Rain:27.00 Wind:25.40m/s from:292.50 Gust:--- CRC:3A
TX22IT [A 1 D 2 2 0 1 B 3 E F E 17 ] CRC:OK S:A ID:7 NewBatt:0 Error:1 Temp:--- Hum:--- Rain:27.00 Wind:25.40m/s from:315.00 Gust:--- CRC:17
TX22IT [A 1 C 3 1 0 7 3 2 0 1 B 4 0 0 0 8A ] CRC:OK S:A ID:7 NewBatt:0 Error:0 Temp:--- Hum:73 Rain:27.00 Wind:--- from:--- Gust:0.00 m/s CRC:8A
TX22IT [A 1 C 1 2 0 1 B E ] CRC:OK S:A ID:7 NewBatt:0 Error:0 Temp:--- Hum:--- Rain:27.00 Wind:--- from:--- Gust:--- CRC:E
TX22IT [A 1 C 2 0 5 5 3 2 0 1 B 19 ] CRC:OK S:A ID:7 NewBatt:0 Error:0 Temp:15.30 Hum:--- Rain:27.00 Wind:--- from:--- Gust:--- CRC:19

*/
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.