kilker12
Posts: 12
Joined: Thu Mar 14, 2013 12:27 am

Home Automation Interface Release-0.2.0 ALPHA

Thu Mar 14, 2013 12:48 am

Home Automation Software!

Here is my home automation software built for the Rasberry Pi released to everyone in hopes that someone will find it useful. I just got into Python with this project so it may be pretty bad coding on the server side. Any tips would be greatly appreciated.

What I'm working on now
Just got done with 0.2.0 ALPHA release. Will start on security and getting the rest of the overview page done. I'm also noticing some problems in the server side with some noise when an event is triggered. Ill have to look into getting this right. I think it has to do with the way my relay board is setup and connected to my Pi. I'm really focused on this issue before I get started on the other things.

The Goal
My aim is to turn the Rasberry Pi into a full home automation controller. This means lights, A/C, security, events, multi-room audio, and a nice interface to manage it all!

Features (0.2.0 Alpha):
  • Full light control over Pis GPIO ports to a relay board
    Curses-based server GUI
    Add/Delete lights with names
    Add/Delete sensors with names
    Mass light control (all lights off)
    Create events to be ran when certain conditions are met (i.e channel 3 is triggered so turn on channels 2, 5, and 6)
    Enable/Disable events from being ran
    Set time constraints for events and lights
    System overview (currently only shows lights on out of total lights i.e 5/8 on)
    Multithreaded websocket server for multiple clients to control at once
Todo
  • MAKE THE INTERFACE MORE PRETTY! Its really only proof of concept right now. Once the actual coding is complete I will work on this
    Get the security page going. What kind of device should handle this? Let me know
    Dimmable / PWM lighting support
    A/C control using thermometers, humidity sensors, etc. Or just control a networked thermostat (examples of such devices?)
    Multi-Room audio
    Multi-Pi setups to allow for more inputs/outputs maybe some load balancing
    Very lastly bundle it into a minimal OS and call it HomeOS! :D
    And the never ending task of performance enhancement
    Give me more ideas...
Changelog:
Release 0.2.0 ALPHA
- Server script now has a curses based GUI to show you info about current states of everything
- Renamed Macros to Events
- Removed Timers section. Events now have timer options on setup. Lights have timer options in their settings page.
- Many server side improvements such as running events in seperate process instead of scripts
- Server now communicates with MySQL directly instead of through polling PHP scripts to do the work
- Web interface now takes advantage of 2 way websocket server to get the GPIO/event states from server instead of MySQL
- Added installation of python-tornado dependency in the install script
- Install script now only asks for the password once ;)

Release 0.1.9 ALPHA
- Adding lights and macros now checks to make sure there is something entered for a name instead of submitting without a name
- Setup script new sets the correct file permissions to allow macros and crons to be created
- Websocket server is now threaded. Multiple clients can now use the interface at once! :D
- Shell script now asks for the mysql password and puts it in the appropriate scripts automatically

Release 0.1.1 ALPHA
- Minor fix to the websocket server to allow it to run without any GPIOs setup

Release 0.1 ALPHA
- First public release

About
Now a bit about the actual project. I am working with a Rasberry Pi Rev B. (512MB model) as the controller. I have an 8 channel sainsmart relay board that I am controlling. For inputs I have a PIR motion sensor from Adafruit and a magnetic door switch.

The lights and macros control communicate with the web interface through the Python-based web socket server for quick responsiveness. Its more of a one way communication because the server cant send any data back to the client at this point. Light states are stored in a MySQL database along with configurations, lights, sensors, etc.

Setup instructions and other information is located in the readme.txt.
Also make sure you look at the Channel Reference.txt!

Contributions are more then welcome!

Download:
http://www.mediafire.com/?rgcdsi8smglic7i
Last edited by kilker12 on Mon Apr 15, 2013 2:20 pm, edited 19 times in total.

amer64
Posts: 1
Joined: Sat Mar 16, 2013 4:34 pm

Re: Home Automation Interface ALPHA

Sat Mar 16, 2013 4:44 pm

Can you please post the link?

kilker12
Posts: 12
Joined: Thu Mar 14, 2013 12:27 am

Re: Home Automation Interface ALPHA

Mon Mar 18, 2013 3:01 pm

amer64 wrote:Can you please post the link?
Just posted the download link. Sorry it took so long! I realized I had alot to do to get ready for releasing it.
Anyway, please try it out! If you have any comments and/or suggestions please comment below!

Nitrogen_Widget
Posts: 38
Joined: Tue Aug 28, 2012 5:52 pm

Re: Home Automation Interface Release-0.1.1 ALPHA

Mon Mar 18, 2013 5:32 pm

Thanks!
I've been looking for something like this.
I'll give it try.

kilker12
Posts: 12
Joined: Thu Mar 14, 2013 12:27 am

Re: Home Automation Interface Release-0.1.1 ALPHA

Mon Mar 18, 2013 5:50 pm

Nitrogen_Widget wrote:Thanks!
I've been looking for something like this.
I'll give it try.
Thanks! Please let me know if you have any problems with setup. The script isn't fully tested :) I did notice one thing that needs to be changed. Edit /var/www/lib/custom.js and change the websocket address to that of your rasberry pi. Also the server script in /var/www/websocket/server.py may need to have the address changed to your pis

mfs7772
Posts: 1
Joined: Thu Mar 21, 2013 3:28 am

Re: Home Automation Interface Release-0.1.9 ALPHA

Thu Mar 21, 2013 3:33 am

this is great. i would love to be able to build all corners of home automation (light, security, A/V, cameras, and temperature) using the Raspi. Thanks. i'm just starting to program using this great device and i just bought a 2 channel relay for exactly this:) now i'll be able to jump right in.

kilker12
Posts: 12
Joined: Thu Mar 14, 2013 12:27 am

Re: Home Automation Interface Release-0.1.9 ALPHA

Thu Mar 21, 2013 3:05 pm

Thanks! It really is amazing isn't it? Covering the entire home automation spectrum is my goal but I think once I get into AV it will have to be handled by a seprate Pi. I'd also like to implement multi room audio. I've gotten GMediaRenderer going and it seems to work well but using it in a multi room situation is a whole different story. Also if anyone has any insight on AC control it would be greatly appreciated.

Corps
Posts: 1
Joined: Sat Mar 23, 2013 8:04 am

Re: Home Automation Interface Release-0.1.9 ALPHA

Sat Mar 23, 2013 8:11 am

kilker12 wrote: Also if anyone has any insight on AC control it would be greatly appreciated.
If thats air con you could use an IR blaster to act as the remote. http://www.raspberrypi.org/phpBB3/viewt ... =45&t=7798
If thats mains sockets you could use remote control sockets. http://www.raspberrypi.org/phpBB3/viewt ... 5&start=75

Abishek22
Posts: 5
Joined: Mon Mar 25, 2013 2:39 pm

Re: Home Automation Interface Release-0.1.9 ALPHA

Wed Mar 27, 2013 6:14 am

What kind of hardware do I need to get this to work
Other than a pie and breadboard

kilker12
Posts: 12
Joined: Thu Mar 14, 2013 12:27 am

Re: Home Automation Interface Release-0.1.9 ALPHA

Mon Apr 01, 2013 4:41 pm

Abishek22 wrote:What kind of hardware do I need to get this to work
Other than a pie and breadboard
All I am using is a Sainsmart 8 channel relay board (http://www.sainsmart.com/8-channel-dc-5 ... __store=en), a PIR motion sensor (http://www.adafruit.com/products/189), and a magnetic door switch (http://www.adafruit.com/products/375). All my periphrials are hooked up to the relay board and I trigger them using this suite through the RPi's GPIO ports. Its a pretty simple setup. Id like to get a video out soon with my setup Im using but Im currently doing some cool things with the server end including redesigning the macros/event handlers.

Nitrogen_Widget
Posts: 38
Joined: Tue Aug 28, 2012 5:52 pm

Re: Home Automation Interface Release-0.1.9 ALPHA

Mon Apr 01, 2013 6:01 pm

If you don't mind waiting a few weeks, dx.com sells relay boards like this cheaper.

http://dx.com/p/8-channel-5v-solid-stat ... lue-121337

danneman
Posts: 19
Joined: Thu Jun 21, 2012 9:57 am

Re: Home Automation Interface Release-0.1.9 ALPHA

Mon Apr 01, 2013 6:17 pm

Kilker12, can this be some interested hardware for your project?

http://www.expansionboard.org/?p=87

/Daniel

kilker12
Posts: 12
Joined: Thu Mar 14, 2013 12:27 am

Re: Home Automation Interface Release-0.1.9 ALPHA

Mon Apr 01, 2013 7:31 pm

danneman wrote:Kilker12, can this be some interested hardware for your project?

http://www.expansionboard.org/?p=87

/Daniel
That actually looks like a nice piece of hardware. I saved it in my bookmarks and will look into it sometime after I get my software out of alpha stages :)

I really need someone to help me with a pretty big bug on the python script. It deals with multiprocessing on the macros so if there's any Python gurus out there please add me on Skype so I can show you my problems. Skype is jster1324 Thank you!

jessejamesrichard
Posts: 4
Joined: Tue Apr 09, 2013 11:07 pm

Re: Home Automation Interface Release-0.1.9 ALPHA

Tue Apr 09, 2013 11:14 pm

I'm a web-based programmer with about 15 years experience. I've recently gotten into Pi because I want to build a multi-room audio controller. Previously I'd built something cool by putting my media on the cloud and using comet (long polling ajax) to send commands from any smart device to any other smart device. Basically like cloud-based DLNA. Send movies to my TV from my phone.

I was interested in implementing multiroom audio / video in the say approach, but using Pi as the controller rather than a $1000 TV or an iPad.

If you need cloud-based control I can help.

kilker12
Posts: 12
Joined: Thu Mar 14, 2013 12:27 am

Re: Home Automation Interface Release-0.1.9 ALPHA

Wed Apr 10, 2013 12:13 am

jessejamesrichard wrote:I'm a web-based programmer with about 15 years experience. I've recently gotten into Pi because I want to build a multi-room audio controller. Previously I'd built something cool by putting my media on the cloud and using comet (long polling ajax) to send commands from any smart device to any other smart device. Basically like cloud-based DLNA. Send movies to my TV from my phone.

I was interested in implementing multiroom audio / video in the say approach, but using Pi as the controller rather than a $1000 TV or an iPad.

If you need cloud-based control I can help.
Sounds interesting. If you have a Skype please add me and we can talk about your piece of software as Id be more then delighted to add it in on a future release. My Skype name is jster1324 and I hope to hear more from you!

jessejamesrichard
Posts: 4
Joined: Tue Apr 09, 2013 11:07 pm

Re: Home Automation Interface Release-0.1.9 ALPHA

Wed Apr 10, 2013 12:21 am

The server software is pretty robust. It ties into social media, has logins, etc. The polling aspect uses either interval polling AJAX or long polling AJAX. There would be two things missing from this approach:

1) You need to build a curl client to communicate with the cloud.
2) You need to build a command matrix for all the different types of commands you'd want to run at the home level.

The big ones for me are media control and something to do with security (locks). Beyond that the world is your oyster. I even have a cool name for the product. |

But I am very new to Raspberry Pi. I do have considerable linux experience, but in a very limited capacity. DHCP, networking, LAMP infrastructure, etc.

ryanjennings
Posts: 8
Joined: Mon Jul 09, 2012 4:14 pm

Re: Home Automation Interface Release-0.1.9 ALPHA

Sun Apr 14, 2013 4:47 pm

Anyone else get this error message?


Traceback (most recent call last):
File "/var/www/websocket/server.py", line 1, in <module>
import tornado.ioloop
ImportError: No module named tornado.ioloop

ryanjennings
Posts: 8
Joined: Mon Jul 09, 2012 4:14 pm

Re: Home Automation Interface Release-0.1.9 ALPHA

Sun Apr 14, 2013 5:01 pm

sudo apt-get update
sudo apt-get install python-tornado

fixed my problem

ryanjennings
Posts: 8
Joined: Mon Jul 09, 2012 4:14 pm

Re: Home Automation Interface Release-0.1.9 ALPHA

Sun Apr 14, 2013 5:13 pm

On to the next trouble ...

No GPIOs to setup! You probably havent added any yet

Any ideas on how to setup the GPIOs?

Thanks for the help,
Ryan

bprats99
Posts: 30
Joined: Thu Apr 04, 2013 4:54 am
Location: Southern California USA

Re: Home Automation Interface Release-0.1.9 ALPHA

Sun Apr 14, 2013 5:32 pm

Is Mediafire.com safe? I'd like to download the file for my RPi but have never heard of mediafire.

kilker12
Posts: 12
Joined: Thu Mar 14, 2013 12:27 am

Re: Home Automation Interface Release-0.1.9 ALPHA

Sun Apr 14, 2013 10:35 pm

ryanjennings wrote:On to the next trouble ...

No GPIOs to setup! You probably havent added any yet

Any ideas on how to setup the GPIOs?

Thanks for the help,
Ryan
This is basically saying that you have no lights or sensors setup. Once the server is running, visit the web interface and setup some lights in Setup->Add/Remove Lights. The next time the server starts up this message will be replaced with one for each light you have setup.

kilker12
Posts: 12
Joined: Thu Mar 14, 2013 12:27 am

Re: Home Automation Interface Release-0.2.0 ALPHA

Mon Apr 15, 2013 1:56 am

Version 0.2.0 ALPHA has just been released!

Give it a try! ;D

mylabsql
Posts: 3
Joined: Sun Apr 28, 2013 5:58 pm

Re: Home Automation Interface Release-0.2.0 ALPHA

Mon Apr 29, 2013 5:55 am

Thanks for share :)
I try the button to turn on & turn off but no changes. is there somethink wrong??

mylabsql
Posts: 3
Joined: Sun Apr 28, 2013 5:58 pm

Re: Home Automation Interface Release-0.2.0 ALPHA

Mon Apr 29, 2013 9:44 am

:D
I've done testing using firebugs, and found that after turning off / turn on GPIO following message appears.

│ SERVER: Connection opened. │
│ {"action": "newlight", "gpio": 15} │
│ SERVER: Light added on GPIO 15 │
│ {"action": "gpiostate", "gpio": "15"} │
│ {"action": "lightoff", "gpio": 15} │
│ SERVER: Connection closed.

mylabsql
Posts: 3
Joined: Sun Apr 28, 2013 5:58 pm

Re: Home Automation Interface Release-0.2.0 ALPHA

Thu May 02, 2013 7:01 am

I finally found the cause of the server closes the connection.

Code: Select all

  WSHandler.write_message('{"message": "gpiostate", "gpio": ' + str(pin) + ', "status": 0}')
Maybe someone can explain & fix the bug's this? ;)
mylabsql wrote::D
I've done testing using firebugs, and found that after turning off / turn on GPIO following message appears.

│ SERVER: Connection opened. │
│ {"action": "newlight", "gpio": 15} │
│ SERVER: Light added on GPIO 15 │
│ {"action": "gpiostate", "gpio": "15"} │
│ {"action": "lightoff", "gpio": 15} │
│ SERVER: Connection closed.

Return to “Automation, sensing and robotics”