Home Assistant is the most flexible target for the MathNet webhook. Once a redemption is plumbed through, you can hook any HA automation to it — lights, media players, TTS, locks, smart plugs, Google Home/Alexa speakers, the works.
This guide assumes you already have a Home Assistant instance accessible from your local network (or via Nabu Casa Cloud / your own reverse proxy if you want to use MathNet from outside your house).
1. Create the webhook trigger in Home Assistant
In HA, go to Settings → Automations & Scenes → Create Automation → Start with an empty automation.
Pick Webhook as the trigger. HA will generate a long random webhook ID — keep it. The full URL you give to MathNet will look like:
https://your-ha-instance/api/webhook/mathnet_redeem_<random>
(Or http://homeassistant.local:8123/api/webhook/... for purely-local installs.)
Save the automation. It won’t do anything yet — we still have to give it an action.
2. Paste the URL into MathNet
In MathNet → Settings:
- Toggle Enable reward system on
- Paste the HA webhook URL into Webhook URL
- Set Points per credit to whatever feels right
- Tap Save Settings
- Tap Test webhook to confirm reachability — you should see ✅
3. Wire up the action
Now pick what should happen when a credit is redeemed. Three examples below — combine and modify as you like.
Example A: Flash the play-room lights
trigger:
- platform: webhook
webhook_id: mathnet_redeem_<random>
allowed_methods: [POST]
local_only: false
action:
- service: light.turn_on
target:
entity_id: light.playroom
data:
brightness_pct: 100
rgb_color: [255, 215, 0]
flash: long
- delay: "00:00:03"
- service: light.turn_off
target:
entity_id: light.playroom
Example B: Speak an announcement on a Google/Alexa speaker
trigger:
- platform: webhook
webhook_id: mathnet_redeem_<random>
allowed_methods: [POST]
local_only: false
action:
- service: tts.google_translate_say
data:
entity_id: media_player.kitchen_speaker
message: >
Great job! You earned a credit. Your balance is now
{{ trigger.json.balance_after }} credit{{ 's' if trigger.json.balance_after != 1 else '' }}.
The trigger.json.balance_after template grabs the post-redemption balance from MathNet’s payload (see the payload spec).
Example C: Unlock 30 minutes of TV time
Assuming you have a smart plug controlling the TV and a timer.tv_allowance helper:
trigger:
- platform: webhook
webhook_id: mathnet_redeem_<random>
allowed_methods: [POST]
local_only: false
action:
- service: switch.turn_on
target:
entity_id: switch.tv_smart_plug
- service: timer.start
target:
entity_id: timer.tv_allowance
data:
duration: "00:30:00"
- service: notify.parents
data:
title: MathNet credit redeemed
message: TV powered on for 30 min ({{ trigger.json.balance_after }} credits left)
Pair this with a separate automation listening to timer.finished that turns the smart plug off again.
4. Securing the webhook (recommended)
Home Assistant webhooks are unauthenticated by default. If your HA instance is exposed to the internet, you’ll want one of these protections:
Option 1: Local-only webhook. Set local_only: true in the trigger config, then use a VPN (Tailscale, WireGuard) on the iPad/iPhone so MathNet’s request originates from inside your network. This is the most secure approach and works flawlessly with Tailscale.
Option 2: MathNet admin password. In MathNet Settings, set an Admin password. MathNet sends it as Authorization: Bearer <password> on every redeem. Use an HA template condition to verify:
condition:
- condition: template
value_template: >
{{ trigger.headers['authorization'] == 'Bearer your-shared-secret' }}
Option 3: Obscure path. HA webhook IDs are already long and random. Don’t paste yours into screenshots, public forums, or third-party services. Treat the URL like a secret.
I recommend Option 1 (Tailscale) if you’re already using Tailscale on the students’ devices. Otherwise the Admin password header is fine for a typical home setup.
5. Test it end to end
In MathNet’s Bank view, do an Exchange (if you have points to convert) and then Redeem. The HA automation should fire within a second or two. If nothing happens, check:
- HA’s Automations → Logbook for whether the trigger fired
- HA’s logs (
Settings → System → Logs) for any errors - MathNet’s transaction history — failed redemptions are logged with the response code
Going further
A few automations the MathNet community has built:
- Streak bonus — if
trigger.json.balance_aftercrosses a threshold (e.g. 10 credits in a day), trigger a bigger reward - End-of-week summary — log each redeem to InfluxDB or a Google Sheet via HA’s
rest_command, display weekly charts on a dashboard - Family dashboard — track per-device credits with
trigger.json.device_nameand show each student’s progress on a wall-mounted tablet
Home Assistant is genuinely the killer app for the MathNet webhook. Once it’s plumbed through, you can iterate on the reward side without ever touching the math side.