If your home already runs on MQTT — Mosquitto broker, Node-RED, ESPHome devices, OpenHAB, Home Assistant’s MQTT integration — bridging the MathNet webhook in takes a small relay.
The relay
MathNet sends HTTPS POSTs; MQTT brokers don’t natively accept HTTPS. The simplest bridge is a tiny HTTP-to-MQTT relay you run alongside your broker.
Option 1: Node-RED (recommended if you already run it)
Drop in an http in node listening on a path, then an mqtt out node publishing to a topic:
[http in: POST /mathnet] → [function: extract payload] → [mqtt out: family/math/redeem]
Function node body:
msg.payload = JSON.stringify({
device: msg.payload.device_name,
balance: msg.payload.balance_after,
ts: msg.payload.timestamp
});
msg.topic = 'family/math/redeem';
return msg;
Point MathNet’s webhook URL at https://your-node-red-host/mathnet (Node-RED behind a reverse proxy with TLS).
Option 2: A tiny standalone bridge (Python)
from flask import Flask, request
import paho.mqtt.publish as publish
import json
app = Flask(__name__)
@app.route('/mathnet', methods=['POST'])
def webhook():
data = request.json
publish.single(
topic='family/math/redeem',
payload=json.dumps(data),
hostname='localhost' # your MQTT broker
)
return '', 200
Stick that behind nginx/Caddy with TLS, and you have an MQTT bridge.
On the MQTT side
Once redemptions land on a topic, any subscriber can react:
- ESPHome devices flashing an LED strip
- A Node-RED flow logging to InfluxDB
- An OpenHAB rule running an action
- Home Assistant’s MQTT trigger (alternative to its native Webhook trigger)
If you’re new to MQTT and only need MathNet integration, the Home Assistant native webhook approach is simpler — no MQTT broker needed. MQTT shines when you already have one running.