Anth's Computer Cave

AAIMI Home Automation Tutorial Hub

Use the buttons below to read all of the AAIMI Home Automation tutorials.

Control AAIMI Home Automation

13th February 2018

Most of the time you'll interact with AAIMI via one of the browser-based GUIs using Chrome, Firefox, etc. We'll cover the main GUI first and the keypad GUI after that. These is also a Python based GUI you can use to visualize your home data, but I'll cover that in the next article. There is also an optional email-based control system you can enable that acts as a backup communication system, but that's more for people using IP filtering so they can whitelist a new IP address.

Access the AAIMI GUI

To access the browser-based control-conter, open a web browser on any computer on your home network. Don't use your smartphone yet. Type YourIp/aaimihome.html. Substitute the Raspberry Pi LAN IP address for YourIp. My Pi is 10.0.0.4, so I type 10.0.0.4/aaimihome.html

You'll be prompted for your username and password, then asked to allow location.

The first time you login from a device you'll see a popup window asking which device you are using. As you have not added any devices yet, type 'new' without the quotes.

The control-center will open with the devices panel dislayed in the left column so you can add your computer.

Click Add Device.

Under Device user, enter the name of the person who will use the device, in this case your name.

In the LAN drop-down menu you choose whether this is a fixed or mobile device. In this case we are adding a LAN-based computer so we'll choose LAN.

Under Device name, give your device a unique name.

What you select under IP Filtering level depends on whether you enabled IP filtering during the setup wizard. If (as recommended) you are not using Ip filtering choose None. In this article we'll focus on no IP filtering. I'll provide details on using IP filtering in the upcoming advanced article.

Leave the IP field blank unless you are using IP filtering.

Click Add. The main control-center will load. AAIMI will remember your computer from then on.

The control-options for AAIMI Home Automation

You can toggle four rows of buttons to see the various features and functions available. These buttons control what is displayed in the left-hand column.

System details

The System Details panel displays in the left column on startup.

The Last System write tells you the last time AAIMI wrote system details to file This will always be within the last 90 seconds. The System Temp is the Raspberry Pi CPU temperature.

The Safety status of 0 means all smoke detectors are reporting normal levels. The Security status is the current security setting, either Armed, Disarmed, Exiting or Entering. The uptime is the time since last program reboot.

The Public IP is the IP address you use to connect to the system remotely from the Internet.

The RFID is the room containing the RFID reader if you have one. GPS denotes whether GPS location awareness is enabled.

The Last save field reports the last time AAIMI dumped data to the long-term save-file. The Save Days and First Day are the number of days' data in the file, and the date of the first entry.

The incoming email status tells you whether AAIMI's backup control-and-communication system is running (if enabled). The outgoing email displays whether email alerts are enabled.

The remote systems field lists any remote AAIMI systems connected to the main unit.

Add your phone

Now that you know the control-center is operating you can add your phone to the device list.

Because your phone is a WAN device, it forms part of AAIMI's occupancy-awareness system, so you don't login via the Raspberry Pi LAN IP address. In the System Details panel you'll find your public IP address. This is the address of your home's router on the Internet.

Note that you'll need to allow incoming HTTP traffic to your Raspberry Pi on your router. How you do this depends on the model and brand of your router.

Open a browser on your phone. If possible use a dedicated browser just for AAIMI. For example, if you use Chrome for your web browser, install Firefox and use that just for AAIMI.

Type http://YourPublicIP/aaimihome.html in the address bar substituting your public IP for YourPublicIP. Enter your AAIMI username and password when prompted and once-again type 'new' in the popup device window.

The control-center will once again load into the devices panel. This time when you add the device, choose WAN from the drop-down menu under 'Is this a LAN or WAN device?'.

The next time you log in remotely you will see the popup asking which device you are using. This time type the name you gave your phone in the device setup. AAIMI will remember the phone after that

If you have enabled GPS in the configuration GUI you can now head to the GPS tab to enable AAIMI to use your phone's GPS location to see if you are home.

Type your phone's name, select On, then press Submit

AAIMI will now monitor the GPS coordinates for your phone whenever the browser checks the server, and call AAIMI Mapper to determine if you are in your home perimeter.

If you don't wish to enable GPS AAIMI will instead monitor the phone's IP address. If your phone's IP matches the public IP for your house, AAIMI knows you are on the LAN, and therefore at home. If you login from away using your phone's data, the IP will be different and AAIMI will assume you are out.

Users

To take advantage of all of AAIMI's occupancy-awareness features you'll need to add your house mates. In the third article, Download and setup AAIMI, we uploaded an avatar image for each person. Now we just need to tell AAIMI who they are and how to contact them.

Click the More tabs to open the third row of options and click the User tab.

The form to add a new user to AAIMI

Enter a username for the person and their email address. Then select Home or Away under Occupancy status. Click Add, and that's it.

If outgoing email is enabled the person will receive a welcome email from AAIMI with their temporary password. From then on they can access the AAIMI GUI and control the home.

These users are unable to perform admin tasks like adding other users or configuring rooms and program settings. They can switch lights and appliances, view room details and alerts, and arm/disarm the alarm.

To see who is home at any given time, click on the People tab and you'll see the avatars for you and your housemates. If the image is grayed-out that person is away, otherwise they are home.

Control

We'll start with the lights. These work automatically, but there may be times you wish to override normal operation.

The Lounge lights in auto mode.
The web GUI showning the Lounge lights on.

To switch the light on or off, simply click the light symbol.

The Lounge lights in manual mode.
The web GUI showing the Lounge lights off and in manual mode.

The light will switch and an Auto button will appear. This tells you the Lounge light is now in manual mode. It will stay in manual mode until you press the auto button.

AAIMI can set different light-switching levels on the fly. To do this, click the Settings button for the room you wish to adjust.

Adjust switching levels in the kitchen.

Choose Bright to make your light switch on at higher than normal light levels and keep the room brighter. Choose Dim to make the lights switch on only at lower than normal light levels and leave the room dim.

I think of them as "work" and "relax" mode.

You can also click the Change button under Room Timeout to adjust the time in seconds AAIMI waits after the last-detected movement to declare the room vacant and switch off lights.

The more active you are in the room, the shorter you can set timeout. For example, a kitchen where you are always moving around the room may work well at a thirty-second timeout, where as a lounge room where you watch TV may need a 120 seconds. Basically, if your lights are switching off while you sit in the room, increase the timeout.

RFID Cards

You add RFID cards in the web GUI but the first time you'll need to enable the card reader in the configuration GUI, then restart the aaimi_home_control.py.

After that you can add RFID cards and keyrings to the whitelist. Go to the Security tab in the Control GUI, click Settings, then Add New Card.

The form to add a new user to AAIMI

Give the card a name, enter the valid AAIMI user who will use the card then click submit. You'll be prompted to swipe the card. Hold the card over the reader untill you see the CardOk LED light, then remove the card

You can now arm and disarm the system with that card. Repeat these steps to add cards for your housemates.

Security

We'll cover using the security system in manual mode in this tutorial, because you should use this mode until you have thoroughly tested the occupancy awareness system for all users.

To manually arm the system, go to the Security tab in the control center and select Arm in the dropdown menu. Press Submit.

The speakers will switch on and the arming sound will play. You now have 30 seconds to leave your home. Once the exit time expires, the armed LED will light, the Armed sound will play then the speakers will switch off.

If you check the system tab now you'll see the alarm status is Armed.

When you return home, simply open the security tab again, this time choosing Disarm in the drop-down menu and pressing Submit. If you forget to disarm before entering your home, you'll hear the Armed sound, and you have 45 seconds to disarm the system before the alarm is activated.

The disarmed sound will play and the disarmed indicator LED will light.

I the entry time expires an alarm event will play the Intruder sound in a loop and take pictures each loop from every camera. It will also send an email to you and place an alert in the Alerts tab in any open control devices. When the siren timout (Default 30 seconds) expires, the Intruder sound loop will stop, and the system will enter IntruderQuiet mode. The alarm sound is off for your neighbours' sake, but the alarm event is still active until the system is disarmed by a valid user.

In the Security/Settings tab you can adjust the entry time, exit time and siren timeout.

In the Security/Logs tab you can see a list of all arming, disarming and alarm events, and details of any settings changes.

Cameras

We are using old Android phones with an app called IP Webcam that streams live video over the LAN. This can probably work with other types of IP cameras, but you'll need to determine the camera's details yourself.

Before you can access your security cameras you'll need to add them to AAIMI. Click on the Cams tab and click AddCam.

Name your camera using the name of the room.

Under Camera Type, select what type of camera you are using. The default camera type is the IP Webcam app on an Android phone. If you are using different cameras select Other.

Under IP Address and port, enter the basic IP address for the camera and the port it uses. For example, one of my Android cameras is 10.0.0.11 and it uses port 8080. I enter 10.0.0.11:8080.

If you are using the IP Webcam app that is the only IP you need to enter and you can skip the following three fields that say "Leave blank for Android IP Webcam app". AAIMI will automatically configure the rest.

If you are using a different camera you'll need to discover which URLs display the different functions on the camera. The IP address for control is the address you would type in a browser to access your camera's control panel The IP address for snapshot is the address you would type to take a still image. The IP address for video is the address you would use to display the camera's video in a browser.

You can find some of these details by looking in the address bar of your browser while you use the native interface for your camera. This should give you the control IP and the video IP. The snapshot IP can be trickier, because it is usually a button that hides the mechanism for taking and saving images. You may need to display the HTML and Javascript source-code for the camera's interface and trace the route from the button that takes a still image, to the URL the Javascript calls.

I'll try to provide more details in the advanced tutorial.

Under Password, select whether there is a password for the camera. If there is, it must be the same as your AAIMI username and password.

Under Privacy, select whether you want to allow other people in your house to view the cams.

Click Submit. You won't see your camera yet, because AAIMI needs to modify some web files. Restart your browser and log back into the system and return to the Cams tab. This time you should see your camera feed.

If you are at home you will see a live feed at the camera's default frame-rate.

Click the Control button below the video and you'll see the control panel for your camera.

If you are away and connected remotely you'll need to select Remote instead, which allows you to view live still-images that update every few seconds

To save the images, select record.

That's part one of the control and usage tutorial. Click here to read part two, where we'll cover using the rest of AAIMI's general features.

If you have any further questions leave a comment below.

Cheers

Anth


Previous: Configure and run AAIMI Room Control

Next: Use general features and functions.


_____________________________________________


Comments

Leave a comment on this article