Anth's Computer Cave

AAIMI Home Automation archive page version 0.88

This article covers an older version of AAIMI Home Automation. It is here purely for historical purposes.

Use the buttons below to go to the current article series or view other archived articles.

New features in AAIMI Home Automation 0.88

6th September 2017

The main AAIMI Home Automation web GUI. Picture: Anthony Hartup
The main AAIMI Home Automation web GUI. Click for larger image.

The latest version of AAIMI Home has RFID access-control, more settings and options in the web GUI, and heaps of under-the-hood improvements.

RFID Access Control

As well as using your phone to arm and disarm the security system you can now use RFID cards and keyrings. This is a great option if your phone is flat or lost, or you need to give someone access to the house while you are away.

An RFID card-reader with a card and keyring.

The card reader pictured above costs around nine dollars on Ebay and comes with one card and one keyring. You can buy more cards, and also re-use most existing RFID cards or tags you have lying around.

I've been usings these card readers for our super-simple AAIMI RFID car and garage alarm system and they work well, so I decided to include RFID in AAIMI Home Automation.

Setup is quick and easy. There is a wiring diagram and installation instructions in our setup article. To add your card in the web GUI, just give it a name, assign it to a user and swipe the card when prompted.

After that it's super easy. Just swipe your card when you leave home and the alarm will arm as normal. Swipe the card again when you get home and the system disarms.

The reader is operated by the Arduino, with the authentication done on the Raspberry Pi.

New settings

There are new options in the main web GUI for changing security and program settings.

Along with the new RFID card section, the security tab now also lets you exclude rooms from the alarm system, and set rooms as 'chime' rooms.

Chime rooms will play a sound any time somebody enters the area. This is great for a store-entry, or your front door to alert you of visitors without them needing to press a door bell

In the General Settings tab you can adjust some of the main program timings and intervals.

You can change the main loop time that controls the overal responsiveness of the system. The default loop time is one second, which works well, but you may want to play with it.

You can also change the save-interval. This is how often the program saves data to file.

The other timing option is the IP Check frequency. This is how often AAIMI checks the public IP address for your home. The default is 15 minutes, but you could decrease that if you wish to be emailed sooner about an IP change.

There is another section in the General Settings tab that allows you to safely change the secondary encryption key for user data.

Under the hood

Encryption

We've added encrytpion for the RFID card UID's, and we've also modified the existing encryption for user passwords and PINs. The primary encryption key is now created automatically from the admin password and, as mentioned before, the secondary key can be changed from within the web GUI. If you change your admin password or the secondary key the program will seamlessly update the key and re-encrypt the user data with the new key.

Communication and file-reads/writes

AAIMI maintains more than a few files for communication between the various parts of the program, and both the browser and any AAIMI Remote systems. Updating many of these communications is unnecessary until someone is actually using the web GUI, so we've reduced the frequency of file writes when nobody is viewing.

Code layout

AAIMI Home Automation is a large program with thousands of lines of code across many files. I want people to dig into the code and try their own things, so I'm trying to make that easier with more detailed code comments.

I've gone though the main files and added more details for each function. I probably still need to add more, I'll keep at it. It's actually given me a refresher on how the various functions work. After two-and-a-half years of writing the code there were lots of details I had forgotten.

I've also made a scroll file to help navigate the main Python file, aaimi_room_control.py. With nearly 4000 lines you can spend a long time scrolling randomly looking for a particular function, so the scroll file docks beside the main file on my screen and I can move the curser straight to a specific function.

A scroll file to navigate between functions in a large code file. Picture: Anthony Hartup

If you click the image above you can see I've found the add_cams() function on the left by dragging the scroll bar down to the add_cams() entry in the scroll file on the right. It's a valuable tool for me, and I hope it can also help you navigate the code.

Article series

As always with a new release we have a full series of articles covering the setup and use of AAIMI Home Automation.

In this first article we've covered the new features, and in the next article we'll cover our slightly mad prototype hardware. In the third article we'll download and configure AAIMI Home and set up our home GPS perimeter with AAIMI GPS Mapper.

In article four we'll start AAIMI Room Control, the program to rule them all, while article five and six will cover controlling and using AAIMI Home with the web-based GUI. Article seven covers the Python GUI used to visualize your long-term data, then article eight is the advanced article for everything else.

Cheers

Anth


_____________________________________________


Comments

Leave a comment on this article