December 01, 2018

Homekit with broadband speed measure


Updated 2019-09-02 !

If you think it's ok that the broadband speed appears as temperature in Home apps this plugin is very nice.

The plugin, used with Homebridge(HB), measures Your broadband speed at chosen intervals. If You use the free app "Eve for Homekit", besides that it shows the last measured broad band speed, it also shows the speed history in a nice graph.

Other HomeKit posts on this Blogg


In this post I will refer to a cable connected Raspberry Pi(RPi) with HB installed. It is important that the RPi is cable connected otherwise the WiFi will be a bottleneck.

Log on to the RPi in a terminal/ssh session and issue the command


sudo npm install -g homebridge-broadband

edit the config.json and add the accessory "Broadband"

"accessories": [
   {
     "accessory": "Broadband",
     "name": "Broadband",
     "maxTime": 5,
     "interval": 15
   }
 ]

If You have used my autostart with systemd stop the homebridge server with 


sudo systemctl stop homebridge

and to check that everything is OK start HB manually


homebridge

and if everything is OK something like this will appear 

[2018-11-13 19:02:57] Loaded config.json with X accessories and X platforms.
[2018-11-13 19:02:57] ---
[2018-11-13 19:02:57] Loaded plugin: homebridge-broadband
[2018-11-13 19:02:59] Registering accessory 'homebridge-broadband.Broadband'
[2018-11-13 19:02:59] ---
.
.
[2018-11-13 19:03:01] [Broadband] Initializing Broadband accessory...
[2018-11-13 19:03:01] [Broadband] Starting broadband measurement...
.
.
[2018-11-13 19:03:13] Homebridge is running on port 51826.
[2018-11-13 19:03:21] [Broadband] Download: 10.201 Mbps
[2018-11-13 19:03:21] [Broadband] Upload: 1.087 Mbps
[2018-11-13 19:03:21] [Broadband] Ping: 63 ms
.
.

Stop with Ctrl + C and start the server with 

sudo systemctl start homebridge


Now You are up and running and can check the speed in some Home app.

In this post You will find links to other Homebridge projects and a config.json for all.

Remark

It seems that the reporting to the Eve databas is done every 8 minute despite what "interval" You have chosen  in the config.json

So I did a hack in index.js. from


 setTimeout(function() {

      self.getHistory();

    }, 8 * 60 * 1000); //every 8 mins
to 
 setTimeout(function() {

      self.getHistory();

    }, 15 * 60 * 1000); //every 15 mins


since I used interval 15 in config.json

Could be edited, after installation, with 


sudo nano ./usr/local/lib/node_modules/homebridge-broadband/index.js

No comments:

Post a Comment

Feel free to leave a comment ! ... but due to a lot of spam comments I have to moderate them. Will reply ASAP !