Category Archives: Python hacking

PHAD: A Replacement for Pi-Hole’s Chronometer (and also PADD)

Pi-Hole is an amazing DNS based ad blocker. One of its ancillary features is it’s text-based “Chronometer” mode. If you invoke pihole with the “-c” option you will see a display like the following that refreshes automatically:

While this Chronometer is handy it’s still rather lacking in the information it provides. A drop-in replacement called PADD has been available for a while that provides significantly more data about your Pi-Hole’s activity. While PADD is a huge leap over the built-in Chronometer functionality I felt that it was also a little lacking. Many people run Pi-Hole on Raspberry Pi’s (not surprising given its name), and many people who use Chronometer or PADD use a TFT LCD screen, many of which are actually touchscreens.

It occurred to me that a highly customizable text display that leverages the features of LCD touchscreens would be a very powerful tool to complement Pi-Hole. The result of this thought is PHAD, the Pi-Hole Alternate Display. PHAD is a python app that uses the highly popular Jinja2 template engine to make it possible to create custom displays. PHAD also supports cycling between multiple templates by tapping on the Pi-Hole’s touchscreen or on a timed schedule.

For more details on installing and using PHAD see the projects README file over on GitHub.

height-solitude

height-solitude


Indigo Plugin for Haiku Fans with SenseME v 0.3

Version 0.3 of the Indigo plugin is now available.  This version mostly improves the internal handling of events from the fan, and also adds both state and address information to the Devices display in the Indigo GUI.

Download the plugin here.

If you have any questions, comments, suggestions, etc. please post them to the Indigo plugin forum.

Indigo Plugin for Haiku Fans with SenseME v 0.1

The Indigo Plugin for Haiku Fans with SenseME provides the ability to remotely control fans from Big Ass Solutions from within Indigo software. Currently the plugin is limited to support the following functionality:

  • Turn the fan on/off and adjust the fan speed
  • Turn the optional light, if installed, on/off and adjust its brightness
  • Turn the fan motion sensor on/off
  • Turn the light motion sensor on/off
  • Trigger actions based on changes to any of the above states

Disclaimer: The API for SenseME is not published by Big Ass Solutions, and this plugin is in no way supported by them.  This plugin was written by analyzing the network traffic between the SenseME iPhone app and a Haiku fan with SenseME. There is no guarantee that this plugin will continue to work if Big Ass Solutions releases new firmware/software for the fan.

To use this plug-in simply download this ZIP file and uncompress it, then double-click on the SenseME.indigoPlugin file to install it in Indigo.  Once installed, simply create a new Indigo “SenseME Fan” device.  In the device settings, enter the name of the fan and its IP address, both of which can be found in the SenseME smartphone app.

Once the SenseME Fan device is created simply create actions or triggers as you would for any other Indigo device.

If you are interested in learning more about the SenseME API for communicating with the fan then see this post. The source code for the plugin is also hosted on github.

 

pdmaint

We use PagerDuty where I work at Care.com to manage on-call notifications, escalations, etc. It’s a great tool to manage alerts from tools and services like Nagios, New Relic, and dozens of others. They also provide a handy dandy REST API, and it should be no surprise that somebody then wrote a Python module to encapsulate it (thanks DropBox!).  Thanks to that I wrote a handy-dandy command line tool called pdmaint for my company to schedule maintenance windows in PagerDuty. Since we’ve found it incredibly useful I was able to get the powers-that-be to let us open source it.  So you can find pdmaint over at Github if you’re interested.  There’s a full set of documentation there as well.

IMAPrunner

Here’s a handy little IMAP utility people may find useful. IMAPrunner was an excuse for me to learn a little more about Python programming and to also throw together something useful at the same time.  It’s a Python script that lets you associate scripts/commands with mail messages in individual mail folders.

I now have a cron job set up that checks for any e-mails I add to a “spam” folder.  If I receive any spam I just move it to that folder.  IMAPrunner will then pass the spam e-mail onto SpamAssassin, razor, pyzor, etc. and then delete the e-mail automatically. There’s really no limit to what you can trigger in response to an e-mail with it.  And I already have a few thoughts for improvements to it…