The Site Con­troller, some­times referred to as the Mas­ter Con­troller, is respon­si­ble for all automa­tion activ­i­ties at a Site. In this role, they act as con­trol and data con­duits between low­er-lev­el sys­tems such as RTUs and high­er-lev­el inter­faces such as web pages and smart­phone apps. In addi­tion, they man­age all of the data accu­mu­lat­ed at the site and provide alert ser­vices that noti­fy site oper­a­tors to oper­a­tional and secu­ri­ty prob­lems.

The Site Con­troller is writ­ten in the Python pro­gram­ming lan­guage and can there­fore run on near­ly any com­mon com­put­ing plat­form includ­ing Win­dows, Mac OS and Lin­ux. It uses SQLite as its data­base sys­tem, which sim­i­lar­ly runs on most com­put­ing plat­forms. The HAPI team has also devel­oped an Raspi­an-based image for the Rasp­ber­ry Pi, our hard­ware of choice for run­ning the Site Con­troller pro­gram.

The Site Con­troller code for HAPI v2.1 fea­tures:

  • Sim­ple, net­work-based con­trol inter­face for site oper­a­tors (The Lis­ten­er)
  • Robust job sched­ul­ing func­tion
  • User-defin­able alert sys­tem with text mes­sage and email sup­port
  • Auto­mat­ic dis­cov­ery of Remote Ter­mi­nal Units
  • Inte­gra­tion sup­port for Weath­er Under­ground
  • Com­plete site/system log­ging
  • Web­cam inte­gra­tion (on lin­ux-based sys­tems)

The Listener

The Lis­ten­er does just that, it lis­tens for a user or oth­er com­put­ers to con­nect to it and pro­vides the capa­bil­i­ty to man­age a site. Whether it’s gath­er­ing infor­ma­tion from the site, chang­ing the con­fig­u­ra­tion of the Mas­ter Con­troller or fir­ing off com­mands to RTUs, the lis­ten­er is their to help. Addi­tion­al­ly, a user con­nect­ed to the Lis­ten­er can tell the site con­troller to pause its job sched­uler, list all known RTUs, take pic­tures and report its cur­rent sta­tus.


  • Jobs can be con­trol tasks, polling for sen­sor data, check­ing for alerts, etc
  • Inter­val Sched­ul­ing — Allows for a job to be sched­uled every x min­utes, hours, days. So you can sched­ule a job for every 5 min­utes that gets sen­sor data from all of your RTUs and stores it in the data­base.
  • Calendar/Clock sched­ul­ing — Allows jobs to be sched­uled at speci­fic times and days. It’s a per­fect mode for sched­ul­ing your lights.
  • Job infor­ma­tion is stored in a data­base. It can be direct­ly manip­u­lat­ed by the user. A user-inter­face for man­ag­ing sched­uler infor­ma­tion will be avail­able in the next ver­sion of the HAPI plat­form.

User-definable Alert System

The alert sys­tem allows users to define low­er and upper thresh­olds for any sen­sor. A job is cre­at­ed that runs every min­ute and checks if sen­sor val­ues are with­in their assigned thresh­olds. For exam­ple, you could cre­ate an alert on a pH sen­sor that trig­gers when the pH falls out­side of some range, e.g. 5.8 — 6.8.

Trig­gered alerts are logged in the data­base. They can also be sent to site oper­a­tors via sms text mes­sages and email.

Automatic Detection of Remote Terminal Units

When the Site Con­troller pro­gram runs, it auto­mat­i­cal­ly scans the local net­work and iden­ti­fies every Remote Ter­mi­nal Unit that’s on the same net­work. Users do not have to con­fig­ure, store or main­tain infor­ma­tion about RTUs.

Virtual RTUs

The Site Con­troller sup­ports the con­cept of a vir­tu­al RTU. A vir­tu­al RTU can be any func­tion the user wants to incor­po­rate into the sys­tem. For exam­ple, we’ve incor­po­rat­ed an inter­face to Weath­er Under­ground (wunderground.com) in order to get local weath­er con­di­tions near our facil­i­ty.


Every­thing the Site Con­troller does is writ­ten down in log files. User con­nec­tions, sen­sor data, user-based com­mand exe­cu­tion, job exe­cu­tion. Every­thing is stored in the data­base.

Education and Support

  • Doc­u­ments
    • HAPI Sys­tem Descrip­tion
    • HAPI Mas­ter Con­troller Instal­la­tion and Con­fig­u­ra­tion
  • Videos
    • Sched­ul­ing Jobs
    • Work­ing with the Lis­ten­er
    • Set­ting up Vir­tu­al RTUS
    • Access­ing Site data
    • Work­ing Exam­ples
  • Sup­port
    • Github
    • Email