Skip to content
Drainbee
Buy
Smart home · Local API

Connect Drainbee to Home Assistant, ioBroker & Node-RED

Drainbee serves the current level as JSON on your home network. Here's how to pull that value into your smart home as a sensor — a few lines of configuration, no detour through the cloud.

View API documentation → From firmware 1.2.5
Request
GET /status
Response
level in cm
Access
local network only

What you get

Drainbee measures the water level in your pump sump with a hydrostatic submersible probe (0–1 m, ±1 cm). You can query the current level directly on your home network and use it anywhere in your smart home:

  • The level as a sensor in Home Assistant, ioBroker or Node-RED — in whole centimetres.
  • Your own dashboards and automations, such as a message above a certain level or a history graph across the week.
  • Combined with other sensors, for example rainfall data or a smart plug measuring the pump.

Alerts stay in the Drainbee app: threshold, power outage and Wi-Fi loss. The local query adds to the app, it doesn't replace it.

What you need

  • Drainbee is set up and connected to your Wi-Fi. If it isn't yet, the installation guide walks you through it in 15 minutes.
  • The device's IP address. You'll find it in the Drainbee app under the device information. Your router's list of connected devices shows it too.
  • Your smart-home system on the same network. Home Assistant, ioBroker or Node-RED have to be able to reach Drainbee directly.

Tip: give Drainbee a fixed IP address in your router (a DHCP reservation). Otherwise the address can change after a restart and your query points nowhere.

Test the connection

On the same network, open http://device-ip/status in a browser — for example http://192.168.1.50/status. From a terminal, use curl:

Terminal
curl http://192.168.1.50/status

Drainbee answers with a small JSON object:

Response
{
  "deviceId": "drainbee",
  "firmwareVersion": "1.2.5",
  "uptimeMs": 86400000,
  "measurement": {
    "cm": 42,
    "ageMs": 3200
  },
  "wifi": {
    "isConnected": true,
    "localIp": "192.168.1.50",
    "rssiDbm": -61
  },
  "mqtt": {
    "isConnected": false
  },
  "memory": {
    "freeHeapBytes": 142000,
    "minFreeHeapBytes": 98000,
    "largestFreeBlockBytes": 86000
  }
}

One endpoint, one field for the water level: measurement.cm. It can be null.

Polling interval: 30–60 s is sufficient. Queries do not speed up measurements; use measurement.ageMs to detect stale values.

Home Assistant

Home Assistant already has everything you need in its RESTful integration. Add this block to your configuration.yaml, set your IP address and restart Home Assistant:

configuration.yaml
rest:
  - resource: http://192.168.1.50/status
    scan_interval: 30
    sensor:
      - name: "Sump level"
        unique_id: drainbee_level
        availability: "{{ value_json.measurement.cm is number }}"
        value_template: "{{ value_json.measurement.cm }}"
        unit_of_measurement: "cm"
        device_class: distance
        state_class: measurement

That gives you the entity sensor.sump_level. scan_interval: 30 polls every 30 seconds, and state_class: measurement keeps long-term statistics. In the history you'll see the pump cycles as a sawtooth: the level climbs slowly and drops sharply as soon as the pump runs. If you already have a rest: entry, just add the block as another list item.

Notify on a high level

This automation speaks up when the level stays above 60 cm for two minutes. Create a new automation in Home Assistant, switch to the YAML view and paste it in. Adjust the threshold to your sump.

Automation · YAML
alias: "Sump: level too high"
triggers:
  - trigger: numeric_state
    entity_id: sensor.sump_level
    above: 60
    for:
      minutes: 2
actions:
  - action: notify.notify
    data:
      title: "Pump sump"
      message: "Level at {{ states('sensor.sump_level') }} cm - please check the pump."
mode: single

notify.notify goes to your default service, usually the Home Assistant app. The automation only works while Home Assistant is running and can reach Drainbee — so keep the alerts in the Drainbee app switched on.

Ideas to build on

  • A template or derivative sensor showing how fast the level is rising.
  • Count pump cycles per day — every cycle is a sharp drop in the level.
  • Level and rainfall in one chart, to see how strongly your sump reacts to rain.

Node-RED

In Node-RED, three nodes are enough to fetch the level:

Set an HTTP Request node to http://192.168.1.50/status and return a parsed JSON object. Trigger it with an Inject node every 60 seconds, then add this Function node.

One endpoint, one field for the water level: measurement.cm. It can be null.

function node
const measurement = msg.payload?.measurement;
const cm = measurement?.cm;
if (typeof cm !== "number") return null;

msg.ageMs = measurement.ageMs;
msg.payload = cm;
return msg;

From there the value goes wherever you need it: a dashboard gauge or chart, an mqtt out node to your broker, or a database. If Drainbee can't be reached, the http request node raises an error you can pick up with a catch node.

ioBroker

The quickest route is the JavaScript adapter, where httpGet is available from version 7.9 onwards. Create a new script, set your IP address and start it:

ioBroker · JavaScript
const DRAINBEE_URL = "http://192.168.1.50/status";
const STATE_ID = "0_userdata.0.drainbee.level";

createState(STATE_ID, null, {
    name: "Sump level",
    type: "number",
    role: "value",
    unit: "cm",
    read: true,
    write: false
});

schedule("*/30 * * * * *", () => {
    httpGet(DRAINBEE_URL, { timeout: 5000 }, (err, response) => {
        if (err || response.statusCode !== 200) {
            setState(STATE_ID, null, true);
            log("Drainbee not reachable: " + (err || response.statusCode), "warn");
            return;
        }
        try {
            const cm = JSON.parse(response.data).measurement?.cm;
            setState(STATE_ID, typeof cm === "number" ? cm : null, true);
        } catch (e) {
            setState(STATE_ID, null, true);
            log("Drainbee: " + e, "warn");
        }
    });
});

The script creates the state 0_userdata.0.drainbee.level and writes the current level into it every 30 seconds. From there you can show it in VIS, use it in Blockly rules or record it with the History adapter. Without the JavaScript adapter, the same URL can be polled with the Parser adapter.

Security

The local API is intended for your trusted home network. It has no authentication or HTTPS. Anyone who can reach Drainbee on the network can read its status, but cannot change anything through this API.

Do not forward port 80 to Drainbee on your router. For remote access, use the Drainbee app or a VPN into your home network.

Troubleshooting

No response to the request

  • The IP address changed: check the current address in the app or your router and set up a DHCP reservation.
  • Different network: a guest Wi-Fi, separate VLANs or an active VPN on your computer will block access. Both devices have to reach each other on the same network.
  • Drainbee is offline: if the app shows no current level, check power and Wi-Fi at the device first.

Wi-Fi connection

Drainbee uses the 2.4 GHz band only. Make sure your router offers a 2.4 GHz network and that the signal is stable where the device is mounted.

How often should you poll?

Every 30 to 60 seconds is plenty — in practice the level rarely changes faster than that. Very short intervals put needless load on the device and your Wi-Fi. The odd gap on a weak signal is normal; Home Assistant will briefly show the sensor as unavailable.

Frequently asked questions

Does Drainbee have a local API?
Yes. On your home network, Drainbee answers GET http://device-ip/status with JSON such as {"measurement":{"cm":37,"ageMs":3200}} — the current level in whole centimetres. The endpoint is read-only, needs no authentication and cannot be reached from the internet.
Does Drainbee work with Home Assistant?
Yes, through Home Assistant's RESTful integration. A few lines of YAML turn the level into a sensor you can use in dashboards, history and automations. There is no dedicated Drainbee integration — and none is needed.
Do I need the cloud for this?
Not for the local query: Home Assistant, ioBroker or Node-RED read the value straight from the device on your network. Setup, the app and the alerts do run through the Drainbee cloud, so Drainbee still needs Wi-Fi with internet access for you to be alerted while you're away.
Does Drainbee work with HomeKit?
Not directly: Drainbee has no native support for HomeKit, Matter, Bosch Smart Home or FRITZ!Box. Home Assistant can, however, pass entities on to Apple Home through its HomeKit bridge. Which sensor types arrive there is up to HomeKit; one workable route is a binary sensor derived from the level, such as “level too high”.
Can I give Drainbee a fixed IP address?
Yes, in your router. Most routers offer a DHCP reservation in the settings of the individual network device. Drainbee then keeps its address across restarts and your query stays valid.

Don't have a Drainbee yet?

Probe, app and local query for a one-time €298 — no subscription.