speedtest-go
can be found here. Place it in the same directory as the above files.
Build and fire up the container stack with docker-compose up --build -d
.
Configuration can be done through environment
variables in docker-compose.yml
:
MQTT_HOST
- mqtt server, defaults tolocalhost
MQTT_ID
- id to use for connecting to mqtt server, defaults tospeedtest
MQTT_TOPIC
- topic to push data to, defaults tospeedtest/status
MQTT_OPTIONS
- additional mqtt options, defaults to-V mqttv311
MQTT_USER
- user for mqtt serverMQTT_PASS
- password for mqtt serverSPEEDTEST_OPTIONS
- additional options forspeedtest-go
SPEEDTEST_INTERVAL
- interval in which to run speedtest, in seconds, defaults to 60
Configuration of sensors in Home Assistant:
sensor:
- platform: mqtt
state_topic: speedtest/status
unit_of_measurement: ms
icon: mdi:speedometer
name: Speedtest Ping
value_template: "{{ value_json.ping }}"
- platform: mqtt
state_topic: speedtest/status
unit_of_measurement: Mbit/s
icon: mdi:speedometer
name: Speedtest Download
value_template: "{{ value_json.download }}"
- platform: mqtt
state_topic: speedtest/status
unit_of_measurement: Mbit/s
icon: mdi:speedometer
name: Speedtest Upload
value_template: "{{ value_json.upload }}"