Network performance monitor.
npm install homebridge-grumptech-netnannyHomebridge Net Nanny, by GrumpTech, is a Homebridge dynamic platform plug-in that publishes metrics measuring the health of a network.
This plugin was inspired by Dave Hamilton's, of the Mac Geek Gab, 3-Ping strategy for evaluating network health.
When we suffer network problems, it's sometimes hard to figure out whether the problem is on the local area network, a problem with your Internet service provider, or a problem with a service to which you're trying to connect. In order to isolate the problem, a good practice is to open a terminal window and ping your router, then your modem, and then a known-reliable server on the Internet.
The Net Nanny Homebridge plugin is designed to give you this information at a glance from within HomeKit. The Homebridge plugin creates several services to HomeKit:
- a collection of switches called _NetNanny Switches_. At the present time this collection contains only one switch, called _Export History_, which will generate an on-demand log of all ping data collected thus far.
- a switch for each ping target that allows the user to control each target separately.
- a set of fake carbon dioxide (CO2) services that will report your network health.
When configured properly, in the Home app, you'll see a set of "Alarm Sensors". These sensors will represent the targets you set up for network testing, e.g. your router, modem, and external server(s). Each target will have three sensors associated with it: one for latency, one for jitter, and one for packet loss. Because we're simulating these services, the sensors will report their metrics in units of ppm (parts per million), but the values are actually milliseconds for latency and jitter and percent for packet loss. In other words, if you see a latency of 8 ppm and a packet loss of 10 ppm, that means its latency is 8ms and the packet loss is 10%.
By having these sensors reporting these three metrics, you can get a sense of what normal looks like, and when things go wrong they could help you isolate the problem between your network and your ISP.
alt="Net Nanny bridge in Apple Home"
style="padding:2px 2px 2px 2px;"
height="600px">
alt="Alarms shown in Home app on iOS. 2 are real sensors but the other 12 represent 4 Net Nanny network targets"
style="padding:2px 2px 2px 2px;"
height="600px">
alt="Example sensor to check latency to apple.com. Shows current level at 5ppm (ms) and peak at 6ppm (ms)."
style="padding:2px 2px 2px 2px;"
height="600px">
To install the plugin manually:
_npm install -g homebridge-grumptech-netnanny_
alt="homebridge-config-ui-x plugin settings screen for Net Nanny"
alt="homebridge-config-ui-x plugin configuration JSON settings for Net Nanny (Page 1)"
alt="homebridge-config-ui-x plugin configuration JSON settings for Net Nanny (Page 2)"
alt="homebridge-config-ui-x plugin configuration JSON settings for Net Nanny (Page 3)"
alt="homebridge-config-ui-x plugin configuration JSON settings for Net Nanny (Page 4)"Additionally, especially if this system will be running other homebridge modules, it is strongly encouraged to run this plugin as an isolated child bridge. This setting page can be found by clicking on the _wrench_ icon on the plugin and then selecting _Bridge Settings_. With the child bridge enabled, revisiting the setting page after homebridge is rebooted will show a QR code for pairing to the child bridge. The username (MAC address) and port are randomly generated by homebridge-config-ui-x.
alt="homebridge-config-ui-x plugin configuration showing the child bridge disabled"
style="padding:2px 2px 2px 2px; border:2px solid; margin:0px 10px 0px 0px; vertical-align:top;"
width="51.5%">
alt="homebridge-config-ui-x plugin configuration showing the child bridge active (unpaired)"
style="padding:2px 2px 2px 2px; border:2px solid; margin:0px 10px 0px 0px; vertical-align:top;"
width="30%">
./config folder. It is left to the user to get the plugin up and running within homebridge. Refer to the section above for specifics on the configuration parameters.- Power: A switch, with the name of the Target Destination, that controls the active state of the network performance target.
- Latency: The average ping latency, in milliseconds. The peak value is also displayed. Alerts are triggered when the reported value exceeds: Expected Latency + (3 * Expected Jitter)
- Jitter: The jitter, in milliseconds, of the ping latency results. The peak value is also displayed. Alerts are triggered when the reported value exceeds: Expected Jitter
- Packet Loss: The packet loss, in percent. The peak value is also displayed. Alerts are triggered when the reported value exceeds: Packet Loss Limit
- NetNanny-Switches: A collection of switches. At the present time, this collection contains a single switch. This switch will be used perform an off-cycle export of the database and flush all existing data.
When the current value for any of the carbon dioxide sensors exceeds the user-specified expected limits, the sensor’s alert will be set and, in addition, the sensor’s _Detected_ value will be set to abnormal levels, if configured. Each Carbon Dioxide sensor can be configured to not set the _Detected_ value to abnormal when a fault is encountered. Setting the _Detected_ value to abnormal levels should result in am alert noticiation from HomeKit.
Because the ping results can be noisy, the results are filtered using the AVT (Antonyan Vardan Transform) algorithm. The amount of data considered in the filter is implicitly set via the _Data Filter Time Window_ configuration parameter on each network target. The size of the data buffer is computed as the ratio _Data Filter Time Window_ to _Ping Period_. The larger this ratio, the more ping results that will be considered in the filter. The value reported by the filter is the _median_ value after excluding the data points that are beyond one standard deviation. Therefore, one can assume that the alerts will not be detected until at least half of the _Data Filter Time Window_ has elapsed with raw results that exceed the user specified limits. This should have the tendency to limit false positive detections. However, if the ratio is too small (not enough data in the buffer), then the reporting will be more responsive and alerts will be issued for transient _glitches_ in the network performance that do not necessarially indicate a systemic problem.
It should also be noted, that the _Detected_ value will not be set to abnormal until the _Data Filter Time Window_ has elapsed after startup. This will prevent an occasional bad result from immediately resulting in the detection of abnormal carbon dioxide levels at startup.
When the accessory is inactive, the _Active_ and _Low Battery Status_ are set.
When _Enable History Logging_ is active, the filtered ping results will be stored in an in-memory database. The data will be exported to a CSV data file periodically or upon manual request. The exported data will be saved to a folder named _GrumpTechHomebridgeNetNanny_ located in the homebridge configuration folder. For example, on macOS ~/.homebridge/GrumpTechHomebridgeNetNanny/.
ping and route programs. At this time, the plugin assumes macOS output when parsing the results. While the ping output is consistent across operating systems, the route output is operating system specific. As a result, the gateway/router type selection is limited to macOS and linux.git checkout -b my-new-featuregit commit -am 'Add some feature'git push origin my-new-feature