Sunday, February 24, 2013

Pytomation 1.0 Released

We are pleased to announce the 1.0 release of Pytomation.

Pytomation is an extensible open source automation system written in Python. It's uses include home automation and lighting control but is certainly not limited to those functions.

Pytomation features include:
        - Written in Python (Multiplatform)
        - REST API
        - Unique language to describe devices and actions.
        - Smart objects: Doors, Lights, Motion, Photocell etc.
        - Regular python programming in Mainloop for more complicated control.
        - Easy interface to web browsers and other technology.
        - Time of day on and off control.
        - Delays for time off.
        - Idle command, device will return to "idle" state.
        - Map one command to another with optional source and time.
        - Good hardware support with more coming.
        - Very easy to add new hardware drivers.
        - Local Telnet and Web access.
        - Good documentation complete with examples.
        - Much more.

Pytomation currently has support for the following hardware interfaces
with more planned in the future.

        - Insteon / X10 (2412N, 2412S)
        - UPB (Universal Powerline Bus) (Serial PIM)
        - JDS Stargate (RS232 / RS485)
        - Weeder Digital I/O board (Wtdio/RS232)
        - W800RF32 X10 RF receiver (W800/RS232)
        - Arduino Uno, digital and analog

Future:
        - Z-Wave (Aeon Labs) DSA02203-ZWUS
        - CM11 X10 control
        - Others as requested.


Download links and documentation are at the bottom of the web page.
Please use the mail list for help at  this time, information about
subscribing can also be found on the home page.


Downloads, docs and mail lists http://www.pytomation.com

Cheers and enjoy.

Raspberry Pi Installation into Neato XV11 Robot

Just put the finishing touches on installing the Raspberry Pi embedded Linux computer into the Neato XV11 robot.

Following the guide at Dave's Home Robotics Notes I disassembled the Neato Vacuum, tapped the battery for 5V using a DC-DC converter per Ben's idea , and installed a Raspberry Pi in place of where the dustbin usually goes.

Cable management is extremely important in this configuration as the Pi is more consumer friendly with its plugs which means a bit of pain for us electronic geeks wielding soldering irons.   Having said that I didnt want to solder directly on the Pi board, so I managed to jam most of the cables / DC-DC into the blower area underneath the turret.  Because the Laser ( LIDAR ) is so close to the top of the robot, I needed to make sure everything in the dustbin area is as flat as possible.

Unfortunately I discovered that there doesnt appear to be an API command for the robot to return to its charger, and  signal strength may not be available through its API as well for a more obvious solution, so I would appear that my first task is to get a spatial Neural Network setup for this specific purpose.  More on this later....





Friday, January 11, 2013

Lowes Smart Home Product - IRIS

Last Summer Lowe's introduced a new smart home product called IRIS.  I am an avid supporter of Home Automation projects and the price point for an ethernet device that does z-wave and zigbee for $99 was too compelling so I bought one.   

Looking to integrate this hardware into my existing Pytomation / Misterhouse home automation system, I decided to see how "open" they are about third party integrations.

What I have found is that they have a REST based API available from their own servers in the cloud, however, I could not find a way to access this device locally within my own network.

I spent an hour or so sharking the device to see what was available and here are my results:


  • The device is created by AlertMe (has their MAC vendor address)
  • It has TCP ports 80 and 111 open (neither one of them does standard HTTP on it though) Unknown protocol.
  • It communicates with imgserver.irissmarthome.com for firmware updates on HTTPS
  • It communicates with hubserver.irissmarthome.com for general communication on HTTPS
  • It appears to run Linux 2.6 based on nmap -O
  • It appears to have support for SafetyNet protocol (UDP port 4000) Dont know much about it other than is supports secure connections for embedded devices on ethernet.
  • I have heard that it has a TTL serial port on the board, but login password is unknown.

Unfortunately for now, there does not appear to be a way to interface with the hardware component directly (and without their monthly fee).   This would leave my system to the mercy of internet connectivity to their cloud infrastructure and the lag associated with it, so I have decided to halt any further development with the devices.



Sunday, January 6, 2013

Install Ubuntu on Rockchip MK803-III ARM MiniPC

My daughter and I are beginning a quest to build a new robot based on a Neato XV11. Part of the "brains" of this machine will be a $60 Rockchip MK803-III RK3066 mini-pc. It ships with Android 4.1 "Jelly Bean" pre-installed, however, for the purposes of this project I will need a Linux Kernel and User-space that is far more capable.

 A developer by the alias "AndrewDB" has taken the time to configure a kernel, assemble a filesystem, and test it all for the RK3066 common platforms. This is what I will be using as the platform for my software development.


Steps to install Ubuntu 12.10:

Root the Android Installation:

  • The way I have found to get this done is to install a new Android ROM.   I have choosen to use popular ROM by the developer with the alias "Finless" called "UG802 Finless ROM 1.6 'custom' JellyBean" Obtained Here
  • The instructions of that thread pertain mostly to installing this on the UG802 based device with a ICS ROM already installed.  I suspect due to the 802-III already having JB on the device there is a crucial step that is missing:
    • There is a step in the ROM installation where you need to be able to put the device into Flash Mode.   The supplied RKFlashTool with that ROM does not work on our device to do that.  
      • You will need to additionallty install the RKBatchTool
      • If selecting the "Reboot To Flash Mode" button fails (as it did for me), run the RKBatchTool, and click the "Switch" button. 
      • The device will reboot and go to a blank screen and the RKFlashTool will then find the device correctly.  Continue following the instructions from the Finless ROM.
  • After completing the installation you will now have a new Android ROM that is pre-rooted.
Flashing Ubuntu:
  • From the rooted Android ROM:
    • Run the included "Reboot" application to get back into Flash Mode
  • Flash and follow the instructions provided by AndrewDB here.
You should now have a dual boot Android JB and Ubuntu 12.10 computer.



Wednesday, October 3, 2012

How To Respond to Negativity

Came across a good article that interested me and thought I'd reshare to others whom may derive some advice from it as well.

How to Respond to Negativity | Psychology Today

Saturday, September 15, 2012

Using the FitBit Ultra Activity Tracker with Ubuntu 12.04 Precise Pangolin

Just bought the FitBit Ultra Activity Tracker, needed to get it working with my Ubuntu 12.04 computers, and here is my tale:

 A google search yields an opensourced project started by Kyle @ Openyou.org and continued along by BenoĆ®t Allard that supports uploading data from the tracker to the FitBit personal website.

Steps I used to install:

  • Registration
    • If the device hasnt already been registered with FitBit website, unfortunately you will need to by using the windows software link provided by the device.  I have an emergency WinXP vm for just such purposes.   After registration you do not need it running anymore
  • Get the source from github (as superuser):
    • apt-get install git
    • mkdir /opt
    • cd /opt
    • git clone https://github.com/benallard/libfitbit.git
    • cd libfitbit
  • Allow the device to be used by non-superusers
    • cp ./platform/linux/* /etc/udev/rules.d
  • Install python libraries needed:
    • pip install pyusb
    • apt-get install python-yaml
  • Run the service:
    • python /opt/libfitbit/python/fitbit_client.py
Done!  Now the device will be syncing with the website as long as the service is running.

Wednesday, August 29, 2012

Asterisk (VoIP PBX) on the cloud with Amazon EC2 (NAT)

In my continuing effort to eliminate the need for a server at my home, I took on moving my Asterisk installation (of just about 10 years) locally run on a Linux server to the cloud using an Amazon EC2 micro-instance.

Background:  Home automation has always been my hobby and a part of that has extended into my phones.  What started off as a simple task of announcing Caller ID over the home intercom, turned in to  an elaborate Session Initiation Protocol (SIP) based Private Branch eXchange (PBX) using Interactive Voice Response (IVR) menus.    (If anyone is interested in what is all automated let me know and Ill write up the use cases.)

My setup was using an x86 based Linux server running Asterisk with various SIP devices as extensions; Zyxel WiFi Handsets, Seimans Gigaset, Grandsteam, Obi100 FXS -> POTS Dect 5.0 phones, and Android Handsets.   I have a VoIP provider giving me Plain Old Telephone Service (POTS) access with standard phone numbers via a SIP trunk.     This was all running on residential internet with a Dynamic IP address, behind a standard Wireless firewall / router (Asus RTN-16), and running Network Address Translation (NAT) on a private internal network.

For the most part this was a typical personal installation of Asterisk with the trunk connection going through NAT and  all of the clients connecting directly on the local private network.

Protocols Involved: What helps is a general understanding of how the SIP / Real-time Transport Protocol (RTP) works.  SIP is a text based protocol that coordinates communications between devices using User Datagram Protocol (UDP) generally on port 5060.  This handles authentication, routing, registry, status, and more importantly the port numbers established for RTP to commence.

RTP sends the actual voice data between devices also using UDP but its ports need to be allocated at time of transmission and generally range between 10,000 and 20,000.

Due to both of these protocols technically being stateless, NAT alone does not sufficiently allow these to route correctly without help.

On the cloud:  The Asterisk server is now running on a Amazon EC2 Microinstance with the clients still on my private network locally (for obvious reasons of needed to use my handsets at my house ;) )   

Here is what I needed to make this happen:
  • EC2 Server: Asterisk config remains setup to talk with my VoIP provider through a NAT,  as Amazon EC2 instances do not get a real IP address mapped locally to an interface. 
    • (sip.conf) [provider] nat=yes
    • (sip.conf) [provider] canreinvite=no
  • EC2 Server: Because clients will be connecting through the Wide Area Network (WAN) interface now, I need to tell Asterisk what its IP address and local network is
    • (sip.conf) [general] externalip=54.54.54.54
    • (sip.conf) [general] localnet=192.168.0.0/255.255.255.0
  • EC2 Server: Clients need to be configured as NAT devices as well
    • (sip.conf) [kitchen phone] nat=yes | canreinvite=no [den phone] nat=yes | canreinvite=no, etc
  • EC2 Firewall:  Ports need to be opened for SIP / RTP:
    • Security Policy -> (Allow) UDP 5060-5083
    • Security Policy -> (Allow) UDP 10000-20000
  • Client Router: NAT needs to be "helped" and configured:
    • (Tomato Firmware) Advanced -> Tracking / NAT Helpers -> SIP (enable) / RTSP (enable)
  • Client Handsets: The internal private network will not be recognized (or useful) to the Asterisk server so they need to register under a common domain:
    • [Domain] 54.54.54.54 (External IP of the server)
Woila, now we have a PBX system on the cloud.



***Trouble shooting tips:
  • Asterisk "set sip debug on" and "rtp set debug on" are your friends.
  • If your handsets register but you cannot hear / transmit sound, RTP is not routing to either the correct IP address or your firewall / nat is not allowing it to pass correctly.  Check domain and your router firmware for supporting SIP and RTP "helpers".
  • If your phones ring at 1:21am in the morning the following night, you may have forgotten to restrict the 5060 port to just your EC2 server / client IPs and you are being hacked.  Not a good night ;)