Supports Autodiscovery, no configuration is required in Home Assistant.
Using docker-compose.yml
:
version: "3"
services:
speedtest:
image: stonegray/speedtest2ha:main
container_name: speedtest2ha
environment:
- MQTT_HOST=mqtt://192.168.1.4
- MQTT_USER=AzureDiamond
- MQTT_PASS=hunter2
restart: unless-stopped
Settings you probably need to change:
MQTT_HOST
: FQDN or URL of the MQTT server. The default is "mqtt://127.0.0.1". Supports WebSocket connections. You must specify a protocol.MQTT_TOPIC
: Defaultspeedtest
MQTT_USER
/MQTT_PASS
: Credentials for the MQTT server.
Settings you probably don't need to change:
CRON
: Defaults to "0 0,6,12,18 * * *". This updates four times per day.SPEEDTEST_BACKEND_FAST
: Use the experimental Fast.com API. Currently does not report upload speed.SPEEDTEST_SERVER_ID
: Defaults to automatic. Set to the integer server ID (eg. 12345) to skip server selection and force connecting so a specific ID.SPEEDTEST_SERVER_EXCLUDE
: Defaults to none. Set to an integer server ID to ignore this server during selection.SPEEDTEST_SINGLE_MODE
: Use a single thread; may measure actual file transfer performance from a single host better. Equilvilent to--single
onspeedtest-cli
HA_ANNOUNCE
: Topic to send annoucements. Defaults tohomeassistant
.HA_ANNOUNCE_NAME
: Device name for Home Assistant. Defaults to "Speedtest Connector"MQTT_CLIENT_ID
: Client ID. Defaults to an autogenerated ID.MQTT_USE_V5
: Set to use MQTT v5. Defaults to v4.TRAFFIC_COUNTER_RESET
: Cron syntax to reset the bandwidth counters. Defaults to approximately never (0 0 29 2 1). This may be useful to reset monthly to determine impact of speedtesting on your traffic allowances, egTRAFFIC_COUNTER_RESET="0 0 1 * *"
AVAILABILITY_UPDATE_RATE
: Number of seconds to wait between availability updates. Default 3600.NO_TEST_ON_BOOT
: Disable testing on boot and only use the cron scheduled tests. This will show "Unavailable" in home assistant until data updates, but may prevent unexpected timing after updates.
It's strongly recommended to use Docker. To run without, just set the required
enviroment variables and run src/speedtest.mjs
:
MQTT_HOST=mqtt://10.0.0.10 node src/speedtest.mjs
You may wish to daemonize this using PM2 or similar software.
By default, the following topics are used. They will automatically be added to HA:
- Sensors:
speedtest/upload
,speedtest/download
,speedtest/ping
,speedtest/jitter
,speedtest/uploadtotal
,speedtest/downloadtotal
,speedtest/availability