Connector for JeeLabs JeeLink receiver USB-Stick via local serial port or remote TCP port to MQTT, Home Assistant and InfluxDB.
  • Python 98.7%
  • Dockerfile 0.7%
  • Shell 0.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Flo Kra d3eea0f4c8 Web page: delete a sensor
"Delete sensor..." in the sensor edit form, with a confirmation step:
removes the sensor from the sensors file (previous version as .bak)
without restart, removes its Home Assistant device and entities (also
when it was not announced since the start; an id still used via HA_ID
is kept) and clears its retained lastSeen topic. InfluxDB data stays.
POST /api/sensors/delete. HAOS app 2026.11.22.12. Tests, README,
CHANGELOG, app CHANGELOG, CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 17:46:44 +01:00
haos/jeelink2mqtt Web page: delete a sensor 2026-11-24 17:46:44 +01:00
jeelink2mqtt Web page: delete a sensor 2026-11-24 17:46:44 +01:00
tests Web page: delete a sensor 2026-11-24 17:46:44 +01:00
tools Rename to JeeLink2MQTT-InfluxDB (jeelinklog -> jeelink2mqtt) 2026-11-22 12:07:08 +01:00
.dockerignore Notifications configurable per source, applied without restart 2026-11-22 17:01:12 +01:00
.gitattributes Add optional HA_ID per sensor, switch all files to LF 2026-11-21 20:04:04 +01:00
.gitignore Notifications configurable per source, applied without restart 2026-11-22 17:01:12 +01:00
CHANGELOG.md Web page: delete a sensor 2026-11-24 17:46:44 +01:00
CLAUDE.md Web page: delete a sensor 2026-11-24 17:46:44 +01:00
docker-compose.yml Notifications configurable per source, applied without restart 2026-11-22 17:01:12 +01:00
Dockerfile Notifications configurable per source, applied without restart 2026-11-22 17:01:12 +01:00
INSTALLATION-LINUX.md Receive watchdog configurable, off by default 2026-11-22 15:07:48 +01:00
README.md Web page: delete a sensor 2026-11-24 17:46:44 +01:00
REFACTOR_PLAN.md feat(): split in modules 2026-11-20 12:28:21 +01:00
repository.yaml Rename to JeeLink2MQTT-InfluxDB (jeelinklog -> jeelink2mqtt) 2026-11-22 12:07:08 +01:00
requirements.txt Rename to JeeLink2MQTT-InfluxDB (jeelinklog -> jeelink2mqtt) 2026-11-22 12:07:08 +01:00

JeeLink2MQTT-InfluxDB

Connector for JeeLabs JeeLink receiver USB-Stick via local serial port or remote TCP port to MQTT, Home Assistant and InfluxDB.

  • Decodes sensor data from LaCrosse 868MHz temperature/humidity sensors
  • Publishes data to MQTT
  • Logs to InfluxDB
  • Web interface for status and configuration
  • Home Assistant auto discovery
  • Runs as HAOS-App, Docker or local install
  • Detects conflicting sensor IDs
  • Update sensor ID after battery change (unfortunately these sensors always change their ID on battery change)
  • Supports 2 sensor baud rates semi-simultaneously by toggling the receiver every 30s

Sensor types tested working:

  • LaCrosse/TechnoLine TX29 DTH-IT (17.241 kbps)
  • LaCrosse/TechnoLine TX35 DTH-IT (9.579 kbps)

Limitations

  • InfluxDB: currently only InfluxDB v1 is supported

Installation

Configuration

Config and data folders

All config files live in one config folder. It is, in this order:

  1. the -c argument (the ini file or the folder containing jeelink2mqtt.ini)
  2. the environment variable JEELINK2MQTT_CONFIG (file or folder, e.g. /config in a container or /etc/jeelink2mqtt for a system install)
  3. the folder of jeelink2mqtt.py

If jeelink2mqtt.ini does not exist there, the program creates the folder and a minimal configuration (the samples are only documentation and are not copied): jeelink2mqtt.ini with only [main] setup = True and the web page with config editing switched on ([web] enable, config_editing, port 8080; inside Home Assistant OS also an empty [mqtt] server), all other settings use the program defaults; jeelink2mqtt_sensors.yml and jeelink2mqtt_influxdb.yml contain only a comment (existing files are kept). The program then starts in setup mode, in which the JeeLink connection may still be missing. In setup mode only the web page runs (no JeeLink, MQTT, InfluxDB); it shows a setup banner. Configure the JeeLink connection, MQTT and InfluxDB in "Edit settings": the first save removes the setup flag and restarts the program normally. Sensors are added afterwards from the unknown sensor IDs.

Keep the config folder writable for the user running the program: sensor changes from the web page are saved there (jeelink2mqtt_sensors.yml, previous version as .bak). The start log line configuration: <folder> (writable|READ-ONLY) and /api/status (paths) show it.

Files written by the program (new/, unknown/, jeelink_new_sensors.log) go to the data folder: the environment variable JEELINK2MQTT_DATA, else [main] data_path, else the old [main] log_path, else data next to jeelink2mqtt.ini. Relative paths are relative to the config folder. The variable wins so a container can always use its data volume, even with an ini copied from an older install.

For the Home Assistant OS app the config folder is jeelink2mqtt/ in the Home Assistant config folder (next to configuration.yaml, editable with the File editor app) and the data folder /data. The configuration is split in the following files:

  • jeelink2mqtt.ini: base configuration
  • jeelink2mqtt_influxdb.yml: YAML configuration file for InfluxDB instances
  • jeelink2mqtt_sensors.yml: YAML configuration containing the sensors
  • jeelink2mqtt_notifications.yml: notification subtopic and which notifications are sent (optional, all on without it; changed on the web page without restart)

By default the JeeLink is read from a local serial port. It can also be read from a remote serial-to-TCP bridge (e.g. a Raspberry Pi Zero with ser2net in raw mode, or an ESP-Link / ESP8266 serial bridge), so jeelink2mqtt can run on another machine than the JeeLink:

[jeelink]
connection = tcp          serial (default) or tcp
tcp_host = 192.168.1.50
tcp_port = 2000

With connection = tcp the connection is opened in the background and re-established automatically (5 s, 10 s ... up to 60 s between tries) when it fails or the remote side closes it. The serial port is handled the same way: if it cannot be opened (wrong path, JeeLink not plugged in, no access) or fails while reading (USB stick unplugged), it is tried again with the same delays, and the program and its web page keep running (before, the program stopped). The status page shows the JeeLink as not connected meanwhile. initCmd is sent after every connect. serialport, baudrate and initTimeout are only used with connection = serial.

Optional receive watchdog (off by default; also in Edit settings, tab JeeLink): with [jeelink] watchdog = True the program exits (code 1) when the connected JeeLink sends nothing for watchdog_timeout seconds (default 300, min. 60), so that systemd or Docker restarts it. Only connected time counts; while the JeeLink is not connected the program keeps retrying.

Example ser2net (version 4, /etc/ser2net.yaml) on the machine with the JeeLink:

connection: &jeelink
  accepter: tcp,2000
  connector: serialdev,/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_XXXXXXXX-if00-port0,57600n81,local
  options:
    kickolduser: true

InfluxDB

Writes are done in a background thread. While an InfluxDB instance is unreachable, points are buffered in memory and written later (with their original timestamps). Options in jeelink2mqtt.ini:

[main]
influxdb_timeout = 10          timeout in s for one write
influxdb_buffer_size = 10000   max. buffered points per instance (oldest are dropped)

configuring InfluxDB-Instances

The instances can also be edited on the web page (Edit settings, tab InfluxDB), see Changing settings from the web page.

jeelink2mqtt_influxdb.yml format:

temphum:                            instance name used in sensor configuration
    host: localhost
    port: 8086
    username: jeelink2mqtt            [optional] comment out if authentication is not used
    password: password              [optional] comment out if authentication is not used
    database: TempHum               InfluxDB database name - must already exist
    measurement: TempHum            InfluxDB measurement name, will be added automatically if it does not already exist
    fieldnames:
        temperature: temp
        humidity: hum
    datatypes:
        temperature: float
        humidity: int

You can add as many InfluxDB instances as you need. Please mind correct indenting in YAML files!

configuring Sensors

jeelink2mqtt_sensors.yml format:

Aussen:                             Sensor name
    LaCrosseID: 1                   LaCrosse Sensor ID, randomly generated on battery change
    Topic_Temp: "Test/Atemp"        [optional] additional MQTT topic to publish temperature values of that sensor
    Topic_Hum: "Test/Ahum"          [optional] additional MQTT topic to publish humidity values of that sensor
    Topic_Dew: "Test/Dewpoint"      [optional] additional MQTT topic to publish the dew point of that sensor
    Topic_AbsHum: "Test/AbsHum"     [optional] additional MQTT topic to publish the absolute humidity of that sensor
    InfluxDB_Instance: TempHum      InfluxDB instance name to use (as set in jeelink2mqtt_influxdb.yml)
    isOutsideTempSensor: true       true or false
    HA_ID: aussen                   [optional] stable Home Assistant id, default: the sensor name
    Location: north wall            [optional] where the sensor is (shown on the web page)
    Note: TX29 DTH-IT               [optional] free text, may have several lines (shown on the web page)
    BatteryChanged: 2026-11-21      [optional] date of the last battery change (YYYY-MM-DD)

Topic_Temp, Topic_Hum, Topic_Dew and Topic_AbsHum are optional, can be left commented or removed. InfluxDB_Instance MUST be a valid name configured in jeelink2mqtt_influxdb.yml. Sensors without a valid LaCrosseID (0..255) or with an ID already used by another sensor are skipped with a warning. HA_ID is only used for Home Assistant discovery (see below).

Temperature-only sensors

Sensors without humidity (e.g. TX35-IT/TX25 or freezer sensors) send the humidity value 106. For these only the temperature is published and stored - no humidity, dew point or absolute humidity.

Outside sensors

isOutsideTempSensor: true will include that sensor in mean/average outside temperature calculation. Set it to true on all sensors that are (properly) located outside to enhance accuracy. You can add as many sensors as you need. Please mind correct indenting in YAML files!

Battery change and ID conflicts

LaCrosse sensors pick a random ID on every battery change. A new sensor ID is reported as NEW sensor with ID x on the <topic_prefix>/Notify topic (subtopic_notify) - put that ID into jeelink2mqtt_sensors.yml, or use Assign to... in the unknown sensor IDs of the web page (with config_editing on). The new ID can also be one that is already used by another configured sensor. Then two sensors send with the same ID and their values get mixed up. This is detected and reported on the NOTIFY topic as well (message starting with ID CONFLICT?):

The battery flags of a packet (new battery, low battery) only count after 2 packets in a row with the same value, in both directions: a sensor with a weak signal sometimes delivers single packets with a flipped flag. This applies to the ID conflict check, the NEW sensor and battery notifications, the battery / batteryNew topics and the status page.

  • a configured ID reports a NEW battery: if you did not just change the battery of that very sensor, another sensor has taken its ID. Change the battery of the new sensor again to get another ID. No warning and no "ID conflict?" badge on the status page if BatteryChanged of that sensor is today or yesterday (the sensor reports "new battery" for a while after the change) - only an INFO line in the log.
  • the values of a configured ID keep jumping (6 jumps within 5 minutes; a jump is a temperature difference of more than id_conflict_temp_jump or a humidity difference of more than id_conflict_hum_jump to the previous packet, or packets with and without humidity mixed). This also finds conflicts with sensors whose new-battery flag is already gone.

Each hint is reported once and again only after it has not been seen for an hour.

[sensors]
detect_id_conflicts = True
id_conflict_temp_jump = 0.6
id_conflict_hum_jump = 5

All notifications go to <topic_prefix>/<subtopic> (default JeeLink2MQTT/Notify, not retained, also in the log). Subtopic and sources are set in jeelink2mqtt_notifications.yml (see jeelink2mqtt_notifications.sample.yml) or on the web page (Notifications on the Settings card, needs config_editing), applied without restart. A switched-off source is only written to the log. Without the file all sources are on and the subtopic is the former [mqtt] subtopic_notify of the ini, else Notify.

Key Message When
new_sensor NEW sensor with ID x an unknown ID reports a new battery in 2 packets in a row (once per ID and run)
sensor_no_data received no data from sensor 'x' with ID y since start / for 12 min a configured sensor sent nothing since start or for data_maxage seconds; once per outage, not within 15 minutes after the start (the availability topic is set on every check)
sensor_back sensor 'x' with ID y sends data again (no data for 24 min) after such an outage (with its second packet, the first one is only the reference of the off-value filter)
conflict_new_battery ID CONFLICT? ... reports a NEW battery see above (each hint once, again after an hour without it); not when BatteryChanged of the sensor is today or yesterday
conflict_jumping ID CONFLICT? ... receives jumping values see above
battery_low battery of sensor 'x' with ID y is LOW once when a configured sensor reports a low battery in 2 packets in a row
battery_ok battery of sensor 'x' with ID y OK again after a LOW, when 2 packets in a row report OK (e.g. after a battery change)
jeelink_lost JeeLink on ... not connected for 2 min (reason), retrying only when the JeeLink stays disconnected for more than 2 minutes
jeelink_back JeeLink on ... connected again (not connected for 5 min) after such a lost connection
(always) TEST notification from JeeLink2MQTT-InfluxDB (web page) / (Home Assistant) test button of the web page / of the bridge device in Home Assistant

Home Assistant automation for a push message on every notification:

alias: JeeLink2MQTT - push notification to HA Companion App on phone xyz
description: ''
trigger:
  - platform: mqtt
    topic: LaCrosse/NOTIFY
action:
  - service: notify.mobile_app_<your_phone>
    data:
      title: JeeLink2MQTT
      message: "{{ trigger.payload }}"

Home Assistant automation for persistent notifications:

alias: JeeLink2MQTT - persistent notifications
triggers:
  - trigger: mqtt
    options:
      topic: LaCrosse/NOTIFY
actions:
  - action: notify.persistent_notification
    metadata: {}
    data:
      message: '{{ trigger.payload }}'
      title: JeeLink2MQTT
mode: single

To be notified about ID conflicts only, add a template condition {{ trigger.payload.startswith('ID CONFLICT') }}.

MQTT output

All data is published below the topic prefix JeeLink2MQTT/ (default, can be configured in jeelink2mqtt.ini or in Edit settings).

[mqtt]
topic_prefix = JeeLink2MQTT

For sensors with a configured Topic_Temp and/or Topic_Hum in jeelink2mqtt_sensors.yml, values will be published to these topics additionally.

Outside temperature/humidity (combined from multiple sensors if configured) is published below JeeLink2MQTT/CombinedOutsideSensors/ (default) and, if set, to additional single topics:

[mqtt]
topic_prefix_outside_temphum = wetter/atemphum
# additional single topics for outside temp/hum
topic_outside_temp = wetter/atemp
topic_outside_hum = wetter/ahum
topic_outside_dew = wetter/dewpoint        dew point
topic_outside_abshum = wetter/abshum       absolute humidity in g/m³

<topic_prefix>/status is set to online on connect and to offline on exit (retained, also set as MQTT last will).

Example output:

Topic Payload
JeeLink2MQTT/Sensorname/temperature 20.2
JeeLink2MQTT/Sensorname/humidity 56
JeeLink2MQTT/Sensorname/battery OK
JeeLink2MQTT/Sensorname/batteryNew NO
JeeLink2MQTT/Sensorname/availability available
JeeLink2MQTT/Sensorname/lastUpdate 2022-11-08 09:22:42
JeeLink2MQTT/Sensorname/lastSeen 2022-11-08T09:22:31+01:00 (time of the last received packet, retained)
JeeLink2MQTT/Sensorname/dewpoint 11.1
JeeLink2MQTT/Sensorname/absoluteHumidity 9.79
JeeLink2MQTT/Sensorname/json {"temperature": 20.2, "humidity": 56, "battery": "OK", "dewpoint": 11.1, "absoluteHumidity": 9.79}
JeeLink2MQTT/Sensorname/TempHumText 20.2° 56%

Home Assistant

With MQTT discovery enabled (default) every configured sensor shows up in Home Assistant as a device (named like the sensor in jeelink2mqtt_sensors.yml):

[mqtt]
homeassistant_discovery = True
homeassistant_discovery_prefix = homeassistant
Entity enabled by default Notes
Temperature yes
Humidity yes not for temperature-only sensors
Dew point yes needs calculate_dewpoint = True
Last seen yes timestamp of the last received packet, stays available when the sensor is gone
Absolute humidity no needs calculate_absolute_humidity = True
Battery yes binary sensor, on = battery low
Availability yes binary sensor (connectivity), on = sensor sends data; stays available when the sensor is gone
Battery new, Last update, JSON, Text no the remaining per-sensor topics (batteryNew, lastUpdate, json - also as attributes, TempHumText)

The discovery messages are retained and sent when a sensor is published for the first time, after every MQTT reconnect and when Home Assistant comes online (<prefix>/status). Unique IDs are built from the sensor name (jeelink2mqtt_<name>_<entity>), so a new LaCrosse ID after a battery change keeps the device - renaming a sensor creates a new device, unless HA_ID is set.

Device ids are jeelink2mqtt_<id>. Devices from before the rename to JeeLink2MQTT-InfluxDB (jeelinklog_<id>) are removed automatically on start and announced again with the new id (see CHANGELOG).

To rename a sensor without losing its Home Assistant device, entity IDs and history, set HA_ID to the old name before renaming it:

Vorgarten:                  new name (device name and MQTT topics JeeLink2MQTT/Vorgarten/...)
  LaCrosseID: 9
  HA_ID: Garten             old name: unique IDs stay jeelink2mqtt_garten_...

HA_ID is converted like the name (lower case, umlauts replaced, other characters as _). Two sensors with the same id, or the id combined_outside (used by the combined outside sensor), give a warning at start. Only the Home Assistant device keeps its identity: MQTT topics and the InfluxDB sensor tag still follow the new name. A sensor removed from jeelink2mqtt_sensors.yml stays in Home Assistant until you delete the device there. Values are shown as unavailable when the program is offline (<topic_prefix>/status) or the sensor sent no data for data_maxage seconds.

The combined outside sensor is announced as its own device too, named after influxdb_sensorname_combined_outside_sensors (or "Outside"): temperature, humidity and dew point (enabled), absolute humidity and the number of used sensors (disabled) and the time of the last update. It uses the topic_prefix_outside_temphum topics, or the single topic_outside_* topics if no prefix is set; entities without a topic are left out. Its values are retained, so they are marked unavailable after data_maxage seconds (at least 3 outside publish intervals) without an update.

Parent device "JeeLink2MQTT" (bridge, id jeelink2mqtt_bridge_<topic prefix>, so several instances stay apart): all sensor devices and the combined outside device are linked to it ("Connected via JeeLink2MQTT" on their device page, the bridge lists them as connected devices). Its entities (topics below <topic_prefix>/bridge/):

Entity Type Topic / notes
Status connectivity <topic_prefix>/status (online / offline, MQTT last will)
JeeLink connection connectivity bridge/jeelink (connected / disconnected, retained)
Last notification sensor bridge/notification (retained, max. 255 characters)
Notification event bridge/event, {"event_type": "<source>", "message": "..."} per notification; event types are the notification keys (new_sensor, battery_low, ...) and test - a trigger for automations
Unknown sensor IDs sensor bridge/unknown_sensors, {"count": 2, "ids": [77, 91]} (count as state, IDs as attribute)
Test notification button bridge/test_notification (command)
Version sensor bridge/version

Device info instead of a name prefix: the sensors have the model "LaCrosse temperature/humidity sensor (JeeLink)" (or "... temperature sensor ..."), their Location as suggested area (Home Assistant only uses it when it creates the device) and a "Visit" link to the web page: in Home Assistant OS the sidebar panel of the app, elsewhere [web] public_url if set.

Web status page

A status page shows all configured sensors with their current (averaged) values, the last received packet, last seen time, battery state and ID conflict hints, the unknown sensor IDs received since start (handy after a battery change), the combined outside values and the connection state of the JeeLink, MQTT and InfluxDB. Click a sensor for a dialog with all its details (reception, configuration, Home Assistant id, MQTT topics).

[web]
enable = True
bind = 0.0.0.0        all network interfaces, 127.0.0.1 = this computer only
port = 8080
config_editing = True  allow changing the sensors and settings from the page (default True)

Then open http://<raspberry-pi>:8080/. The page refreshes itself every 5 seconds. The same data is available as JSON at /api/status. There is no login - only enable it in a trusted network or behind an authenticating proxy (like Home Assistant ingress).

Changing sensors from the web page

With config_editing = True:

  • Edit in the sensor dialog: name, LaCrosse ID, Home Assistant id (HA_ID), location, note, battery changed date (the Battery changed button sets today), InfluxDB instance, outside sensor and the additional MQTT topics. When you rename a sensor that has no HA_ID, the form fills in its current Home Assistant id, so the device and its history are kept (clear the field to get a new device).
  • Delete sensor… in the edit form (after a confirmation): removes the sensor from jeelink2mqtt_sensors.yml (previous version as .bak) without restart, removes its device and entities from Home Assistant and clears its retained lastSeen topic. Data in InfluxDB stays; if the ID is still received, it shows up as unknown sensor ID again (POST /api/sensors/delete)
  • Add sensor above the sensor table: a new sensor with all settings.
  • Add as new sensor in the unknown sensor IDs: the same form with the ID filled in.
  • Assign to... in the unknown sensor IDs: after a battery change, give a configured sensor the new ID. The dialog shows the last packets of both to compare; the sensor keeps its name, Home Assistant device, topics and InfluxDB data. If the new ID reports a new battery, BatteryChanged is set to today. The new-battery flag of an ID that was just assigned or added is not reported as an ID conflict (until the sensor stops sending the flag).

Changes are written to jeelink2mqtt_sensors.yml and applied right away, without a restart. Values already received are kept. When a sensor is renamed, its retained lastSeen topic under the old name is cleared, and a Home Assistant device that no sensor uses any more is removed. The previous file is kept as jeelink2mqtt_sensors.yml.bak. Comments in jeelink2mqtt_sensors.yml are lost on the first change from the web page (the .bak file still has them), other keys of a sensor entry are kept.

The InfluxDB instances offered are those of jeelink2mqtt_influxdb.yml (also when storing is switched off); without that file the instances already used by the sensors.

Notifications from the web page

With config_editing = True the Notifications button on the Settings card opens the notification subtopic and one switch per source (see the table above), plus Send test notification. Saving writes jeelink2mqtt_notifications.yml (previous version as .bak) and applies it immediately, without restart.

Changing settings from the web page

With config_editing = True the Edit settings button on the Settings card opens the program settings of jeelink2mqtt.ini, in tabs:

  • JeeLink: connection (serial / tcp), serial port, baud rate, wait after opening, TCP host and port, init command. The serial port is a dropdown of the ports of the machine (read when the dialog opens, Refresh reads them again, e.g. after plugging in the JeeLink): USB adapters under their stable /dev/serial/by-id/... name with description and kernel name, other ports (e.g. /dev/ttyAMA0) as they are; Other… takes any path. A configured port that is not present is shown as "not found" (JSON: /api/serialports)
  • MQTT: enable, server, port, user, password, topic prefix, notification subtopic, unknown sensors, Home Assistant discovery and prefix. Send test notification (below the notification subtopic, also Test notification on the Settings card of the status page) publishes a test message to <topic_prefix>/<subtopic_notify> with the MQTT connection of the running program, i.e. with the saved settings (POST /api/mqtt/test-notify)
  • InfluxDB: enable, store dew point / absolute humidity, and the instances of jeelink2mqtt_influxdb.yml: add, edit (name, host, port, user, password, database, measurement; field names and data types under "Advanced"), delete, Test connection (connects with the entered values without saving and checks that the database can be read). Renaming an instance renames it in the sensors and the combined outside sensor too; an instance still in use cannot be deleted. Instance passwords are never sent to the browser (empty keeps them). The file is written with PyYAML (comments are lost, previous version as .bak)
  • Sensors: averaging, off-value filter, intervals, max. data age, dew point / absolute humidity, ID conflict detection
  • Outside: intervals, combine by average / median / minimum (outside_sensors_method), MQTT topics, InfluxDB instance and name of the combined outside sensor

"Enable MQTT" sets both [main] publish_on_mqtt and [mqtt] enable. The MQTT password is never sent to the browser: leave the field empty to keep it. [web] and the paths in [main] can only be changed in the file.

jeelink2mqtt.ini is changed in place: only the changed values are replaced, comments and order are kept (previous version as jeelink2mqtt.ini.bak). Saving restarts the program in the same process (same PID, works under systemd, Docker and in a terminal), so for a few seconds no data is received and the averages start over. The page shows "Restarting..." and reconnects by itself.

Changes are only accepted as JSON requests with the header X-Requested-With: jeelink2mqtt, so other web sites open in your browser cannot send them. Example:

curl -H 'Content-Type: application/json' -H 'X-Requested-With: jeelink2mqtt' \
     -d '{"name": "Garten", "id": 42}' http://<host>:8080/api/sensors/assign

Log page

http://<host>:8080/log (link "Log" at the top of the status page) shows the program log live:

  • filter by level (debug / info / warnings and errors / errors), text search with highlighting
  • follows new lines automatically (scrolling up pauses it), download as a text file
  • Clear hides the lines shown so far in this browser tab (also after a restart of the program); nothing is deleted, reloading the page shows them again
  • warnings and errors in color; the "Log" link on the status page shows how many new ones arrived since the log page was last open
  • Debug output switch: also log debug output (every received packet ...) in the log page and the log file, until the next restart. stdout (journal, docker logs) only gets debug output with -v
  • Web log: also shows the HTTP requests to the web interface (web: <ip> - "GET ...", marked WEB), merged in by time. They are recorded only while debug output is on, in a separate buffer of 1000 lines (the polling of the pages would push out the real log lines otherwise), and never written to the log file; on stdout with -v. Off when the page opens; then they are not counted either. Download includes them while it is on. Changes made via the page (web: sensor ... saved, web: settings changed) are normal log lines

The page keeps the last 5000 lines. With the log file switched on (default) they are also written to jeelink2mqtt.log in the data folder, rotating, and the page shows the lines from before a restart too:

[main]
log_file = True         rotating log file in the data folder
log_file_size_mb = 1    a new file is started at this size
log_file_count = 5      current file + older ones

These three are also in the Log tab of Edit settings.

Code structure

jeelink2mqtt/
    jeelink2mqtt.py       start script: command line, wiring, main loop
    jeelinklib/
        config.py       jeelink2mqtt.ini / yml loading
        jeelink.py      data source: local serial port or remote TCP socket
        lacrosse.py     parsing of the sensor lines
        humidity.py     dew point, absolute humidity, Measurement
        sensors.py      per-sensor averaging and filtering, combined outside sensor
        conflict.py     detection of two sensors sending with the same ID
        web.py          web status page, sensor editing endpoints
        sensorconfig.py validating and writing jeelink2mqtt_sensors.yml (web page)
        settingsconfig.py settings of jeelink2mqtt.ini for the web page (schema, in-place writing)
        logview.py      log buffer for the log page, rotating log file, debug switch
        mqtt.py         MQTT client and all MQTT topics/payloads
        influx.py       InfluxDB points and background writer
        app.py          application logic (what is published/stored when)

When updating, copy the whole folder (including jeelinklib/), not only jeelink2mqtt.py.

Tests

python3 -m unittest discover -s tests

Docker

The image (python:3.13-slim, runs as user jeelink2mqtt, uid 1000) keeps the configuration in the volume /config and the program's files (log file, new/unknown sensor markers) in /data; both must be writable for uid 1000. The web page is on port 8080.

docker build -t jeelink2mqtt .
mkdir -p config data && sudo chown 1000:1000 config data
docker run -d --name jeelink2mqtt --restart unless-stopped -p 8080:8080 \
    -v ./config:/config -v ./data:/data -e TZ=Europe/Vienna jeelink2mqtt

or with the example docker-compose.yml: docker compose up -d --build.

On the first start the configuration is created in /config and the program runs in setup mode: open http://<host>:8080/ and configure everything in "Edit settings" (see Config and data folders). For a JeeLink on a local USB port add --device /dev/serial/by-id/usb-FTDI_...:/dev/ttyUSB0 and set serialport = /dev/ttyUSB0; with a serial-to-TCP bridge (connection = tcp) no device is needed. Extra arguments are passed on (docker run ... jeelink2mqtt -d). The container has a health check on /api/status (healthy as well when the web page is switched off). Logs: docker logs jeelink2mqtt or the log page.

Home Assistant OS app

This repository is also a Home Assistant app repository (repository.yaml, app in haos/jeelink2mqtt/). In Home Assistant: Settings > Apps > App store > ⋮ > Repositories, add https://git.flokra.at/flo/JeeLink2MQTT-InfluxDB (must be readable over HTTPS without login), then install JeeLink2MQTT-InfluxDB.

  • The app is built on the Home Assistant machine (base python:3.13-slim, runs as root). The build downloads the program as a tarball of the branch or tag JEELINK2MQTT_REF from JEELINK2MQTT_SOURCE (ARG defaults in haos/jeelink2mqtt/Dockerfile, fixed base image there; no build.yaml, which the Home Assistant builder no longer uses since Supervisor 2026.04). Home Assistant only offers an update when version in haos/jeelink2mqtt/config.yaml is raised; "Rebuild" builds the current state of the branch again.
  • Configuration in jeelink2mqtt/ in the Home Assistant config folder (next to configuration.yaml; the app maps the whole config folder writable at /config, like Zigbee2MQTT), data in /data. The first start runs in setup mode like the Docker image.
  • The web page is a sidebar panel behind the Home Assistant login (Ingress, port 8080, keep [web] port = 8080); direct access on port 8080 is off by default and can be switched on in the app's network settings.
  • MQTT: an empty [mqtt] server takes broker host and port from the Supervisor (Mosquitto app), empty user and password take its credentials (only both together); values in the ini win. The configuration created in the app has an empty server. Outside Home Assistant OS an empty server is an error.
  • A USB JeeLink is reachable (uart: true); use /dev/serial/by-id/... as serial port.

Details for users: haos/jeelink2mqtt/DOCS.md (Documentation tab of the app).

tools/demo.sh runs jeelink2mqtt against a simulated JeeLink (tools/fakejeelink.py, a TCP server sending LaCrosse packets), with MQTT and InfluxDB off and the web page with config editing on, port 8099. Your real configuration is not touched: the demo uses its own config folder (/tmp/jeelink2mqtt-demo, set DEMO_DIR for another one outside the repository), starting from the sample sensors.

tools/demo.sh            start (sensor changes from the web page are kept between runs,
                         settings changes until the next start of demo.sh)
tools/demo.sh --reset    start again from the sample sensors
tools/demo.sh -v         jeelink2mqtt options are passed on

Ctrl+C stops both. The simulated sensors match the sample sensors, plus ID 77 with a new battery (try "Assign to..." with Garten) and the unknown ID 91 (try "Add as new sensor"). Other sensors: tools/fakejeelink.py --sensor ID:TEMP:HUM[:new] (repeatable, HUM 106 = temperature only); WEB_PORT and JEELINK_PORT change the ports.