Skip to main content

No project description provided

Project description

WarpMQTT2Api

Tinkerforge Warp MQTT 2 API bridge

pypi Github Actions Build PyPI Status GitHub issues GitHub closed issues API Docs License

Motivation

Tasmota based power meter sending MQTT messages such as:

{"Time":"2025-05-10T08:24:13","eHZ":{"E_in":67299.845,"E_out":50268.783,"Power":0,"Power2":4111}}

see Tasmota scripts

While the values can be send directly in the script e.g. via:

=>WebQuery http://192.168.XXX.XXX/meters/1/update POST [Content-Type:application/json] [%sml[3]%]

there is still a problem with the sign of the power. See also https://www.tinkerunity.org/topic/13014-tasmota-mqtt-middleware/

Installation

git clone https://github.com/WolfgangFahl/WarpMQTT2Api
pip install .

🧪 Example Configuration

Store this as ~/.warp3/config.yaml:

# WF 2025-09-05
# warp3 middleware configs
# this is for a Tasmota device reading the energy meter

# Wallbox
wallbox_host: "http://wallbox" # replace with your wallbox address
power_tag: "eHZ"
power_field: "Power2"
in_field: "E_in"
out_field: "E_out"
time_field: "Time"
meter_id: 2

# MQTT
mqtt_broker: "mqtt.bitplan.com"
mqtt_port: 1883
mqtt_topic: "tele/tasmota_*****/SENSOR" # replace with your tasmota device
mqtt_username: "*****" # replace with your user
mqtt_password: "********"  # replace with your actual password
update_interval: 1  # every second
dry_run: false

Command line usage

warp3 -h
warp3 -h
usage: warp3 [-h] [--config-path CONFIG_PATH] [--mqtt-broker MQTT_BROKER]
             [--mqtt-port MQTT_PORT] [--mqtt-topic MQTT_TOPIC]
             [--mqtt-username MQTT_USERNAME] [--mqtt-password MQTT_PASSWORD]
             [--dry-run] [--wallbox-host WALLBOX_HOST] [--power-tag POWER_TAG]
             [--power-field POWER_FIELD] [--in-field IN_FIELD]
             [--out-field OUT_FIELD] [--time-field TIME_FIELD]
             [--meter-id METER_ID] [--update-interval UPDATE_INTERVAL]
             [--debug]

MQTT to Warp3 Wallbox Middleware

options:
  -h, --help            show this help message and exit
  --config-path CONFIG_PATH
                        Path to YAML configuration file
  --mqtt-broker MQTT_BROKER
                        MQTT broker address
  --mqtt-port MQTT_PORT
                        MQTT broker port
  --mqtt-topic MQTT_TOPIC
                        MQTT topic to subscribe to
  --mqtt-username MQTT_USERNAME
                        MQTT username
  --mqtt-password MQTT_PASSWORD
                        MQTT password
  --dry-run             Run without updating the wallbox
  --wallbox-host WALLBOX_HOST
                        Wallbox host URL
  --power-tag POWER_TAG
                        Tag in MQTT data containing power information
  --power-field POWER_FIELD
                        Field name in MQTT data containing active power value
  --in-field IN_FIELD   Field name in MQTT data containing energy input
  --out-field OUT_FIELD
                        Field name in MQTT data containing energy output
  --time-field TIME_FIELD
                        Field name in MQTT data containing timestamp
  --meter-id METER_ID   Meter ID to use
  --update-interval UPDATE_INTERVAL
                        Minimum update interval in seconds
  --debug               Enable debug logging

Example output

warp3 --config-path $HOME/.warp3/config.yaml
2025-05-09 16:33:33,286 - INFO - Starting MQTT to Warp3 middleware
2025-05-09 16:33:33,286 - INFO - MQTT broker: mqtt.bitplan.com
2025-05-09 16:33:33,286 - INFO - MQTT topic: tele/tasmota_B13330/SENSOR
2025-05-09 16:33:33,286 - INFO - Wallbox host: http://wallbox.bitplan.com
2025-05-09 16:33:33,286 - INFO - Power tag: eHZ
2025-05-09 16:33:33,286 - INFO - Meter ID: 2
2025-05-09 16:33:33,303 - INFO -  Connected to Warp3 - Firmware version: 2.8.0+6810d7c9
2025-05-09 16:33:33,312 - INFO -  Meter 'Hausanschluss' at location 4 measures: 74: Summe der Phasenwirkleistungen (Bezug - Einspeisung)
2025-05-09 16:33:33,316 - INFO - Connected to MQTT broker at mqtt.bitplan.com
2025-05-09 16:33:33,316 - INFO - Subscribed to tele/tasmota_B13330/SENSOR
2025-05-09 16:33:43,423 - INFO - Power value: -360W
2025-05-09 16:33:43,433 - INFO -  -360 Watt set

Config on raspberry pi

## startup script
#!/bin/bash
# WF 2025-05-10
# Start Warp3 with nohup and log to /var/log/warp3

LOGDIR="/var/log/warp3"
LOGFILE="$LOGDIR/warp3.log"
APP="warp3"
OPTIONS="--config-path /home/wf/.warp3/config.yaml"

sudo mkdir -p "$LOGDIR"
sudo chmod 755 "$LOGDIR"
sudo chown wf:wf $LOGDIR

timestamp=$(date '+%F %T')
echo "$timestamp - INFO - 🚀 Starting warp3" >> "$LOGFILE"

nohup "$APP" $OPTIONS >> "$LOGFILE" 2>&1 &

crontab entry

# run warp3 on reboot
@reboot /home/wf/bin/warp3start

logrotate entry

cat /etc/logrotate.d/warp3
/var/log/warp3/warp3.log {
    daily
    rotate 7
    compress
    missingok
    notifempty
    delaycompress
    copytruncate
}
``

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

warpmqtt2api-0.1.1.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

warpmqtt2api-0.1.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file warpmqtt2api-0.1.1.tar.gz.

File metadata

  • Download URL: warpmqtt2api-0.1.1.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for warpmqtt2api-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aa3575712fc66b61d9f744b97dcdc76d19098de52e203370af5cb1f445703282
MD5 47100ac2a95c709fa7326acc1c3d85df
BLAKE2b-256 2760dc4c0d6d591fe9713565192e7f297cf38a43b9f4199af4bf0c382be9cae1

See more details on using hashes here.

Provenance

The following attestation bundles were made for warpmqtt2api-0.1.1.tar.gz:

Publisher: upload-to-pypi.yml on WolfgangFahl/WarpMQTT2Api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file warpmqtt2api-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: warpmqtt2api-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for warpmqtt2api-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c76182987262c3bc299f95c2f82bde00efe25d0bcfd020af1bcdbe583a5846a
MD5 f9939233cd96da8b3b9cad925e88e300
BLAKE2b-256 2a76484186403708f9179cae0d759a2344003c4b55421621be2bbe66d5dd4d37

See more details on using hashes here.

Provenance

The following attestation bundles were made for warpmqtt2api-0.1.1-py3-none-any.whl:

Publisher: upload-to-pypi.yml on WolfgangFahl/WarpMQTT2Api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page