# speedtest2mqtt [![mqtt-smarthome](https://img.shields.io/badge/mqtt-smarthome-blue.svg)](https://github.com/mqtt-smarthome/mqtt-smarthome) [![npm version](https://img.shields.io/npm/v/speedtest2mqtt.svg)](https://www.npmjs.com/package/speedtest2mqtt) [![CI](https://github.com/hobbyquaker/speedtest2mqtt/actions/workflows/ci.yml/badge.svg)](https://github.com/hobbyquaker/speedtest2mqtt/actions/workflows/ci.yml) [![License][mit-badge]][mit-url] > Measure internet download, upload, ping and jitter, and publish the results via MQTT. Built on [mqtt-interfaces-core](https://github.com/hobbyquaker/mqtt-interfaces-core), following the [mqtt-smarthome](https://github.com/mqtt-smarthome/mqtt-smarthome) architecture, with Home Assistant discovery, a systemd installer and a Docker image — like the other `xyz2mqtt` adapters. **A test runs only when you ask for it**, by publishing to `speedtest/set/run`. There is no interval option, on purpose: a speedtest saturates the line for half a minute and skews every other measurement taken while it runs, so _when_ it happens is a scheduling decision for whoever owns the network. See [Scheduling](#scheduling). Out of the box it needs **no external program** — the measurement is done by a pure JavaScript implementation of Ookla's protocol. If you would rather use an installed speedtest CLI, see [Backends](#backends). ## Install ``` sudo npm install -g speedtest2mqtt speedtest2mqtt -u mqtt://broker ``` As a systemd service (creates `speedtest2mqtt@speedtest`, an unprivileged user, and `/etc/speedtest2mqtt/speedtest.env`): ``` sudo speedtest2mqtt --install -n speedtest -u mqtt://broker ``` Remove it again with `sudo speedtest2mqtt --uninstall -n speedtest`. ### Docker ``` docker run -d --restart unless-stopped --name speedtest2mqtt \ -e SPEEDTEST2MQTT_MQTT_URL=mqtt://broker \ ghcr.io/hobbyquaker/speedtest2mqtt ``` Every option is available as an environment variable (`SPEEDTEST2MQTT_