BlinkStick as an Internet connectivity status indicator

A member on BlinkStick forums asked for some guidance on how it would be possible to use BlinkStick to display Internet connectivity status. Loved the idea so I build a quick sample script in Python to accomplish this.

Script works by checking connectivity to Google DNS server’s IP address. This¬†approach¬†avoid errors when DNS is not available, but the Internet connection is still up and running. When connection can be established, BlinkStick will light up green. When connection is not available, BlinkStick will start pulsing red and will turn green back again when connection is reestablished. Script tries to connect to Google DNS server every second so the notification is almost instant.

I tried to make the script as compact as possible and also documented most of the code to make it easier to understand and change.

Example: Display Internet connectivity status