Project Home‎ > ‎


Feb 12th, 2018 - George

Note this pertains to the Python3 branch at this point.

I am announcing a new Raspberry Pi interface today.  It's called
RpiGpio.  The interface supports both INPUTS and OUTPUTS with various
options.  I've tried to cover all the types of I/O options that will
make this useful and easy to use.

There are two ways of numbering the IO pins on a Raspberry Pi. The
first is using the BOARD numbering system which equates to the physical
pin numbers on the P1 header of the Raspberry Pi. 

The second is using the BCM numbering systems which equates to the
Broadcom chip GPIO numbering scheme.

The advantage of using the BOARD numbering system is that your hardware
will always work, regardless of the board revision of the RPi. You will
not need to rewire your connector or change your code. I have, however,
noticed that many projects seem to use the BCM scheme.

You may choose either one.

GPIO pins on the 40 pin header are as follows:
               3V3  (1) (2)  5V
             GPIO2  (3) (4)  5V
             GPIO3  (5) (6)  GND
             GPIO4  (7) (8)  GPIO14
               GND  (9) (10) GPIO15
            GPIO17 (11) (12) GPIO18
            GPIO27 (13) (14) GND
            GPIO22 (15) (16) GPIO23
               3V3 (17) (18) GPIO24
            GPIO10 (19) (20) GND
             GPIO9 (21) (22) GPIO25
            GPIO11 (23) (24) GPIO8
               GND (25) (26) GPIO7
             GPIO0 (27) (28) GPIO1
             GPIO5 (29) (30) GND
             GPIO6 (31) (32) GPIO12
            GPIO13 (33) (34) GND
            GPIO19 (35) (36) GPIO16
            GPIO26 (37) (38) GPIO20
               GND (39) (40) GPIO21

In your instance file you can setup the interface and pins as follows:

# Pytomation running on this raspberry pi with pin layout of type BCM
  rpi = RpiGpio(pin_layout='BCM', address=None, port=None, poll=None)
# pin_layout can be BCM or BOARD

# Address , port and poll time are not used yet, this interface only
# supports Pytomation running locally on the RPi.

# Set the I/O points as INPUTS or OUTPUTS with optional debounce in
# milliseconds, invert for INPUTS and initial state for OUTPUTS
# These examples use type BOARD pins

# Set pin 3, GPIO-2 as INPUT with pullup resister, inverted state and
# 100ms debounce.
  rpi.setPin(3, 'IN', 'PULL_UP', invert=True ,debounce=100)

# Set pin 5, GPIO-3 as INPUT with pulldown resister and 200ms debounce
  rpi.setPin(5, 'IN', 'PULL_DOWN', debounce=200)

# Set pin 7, GPIO-4 as OUTPUT, with initial value set to LOW state
  rpi.setPin(7, 'OUT') or rpi.setPin(7, 'OUT', init='LOW')

# Set pin 7, GPIO-4 as OUTPUT, with initial value set to HIGH state
  rpi.setPin(7, 'OUT', init='HIGH')

Please note that INVERT on an input is particularly useful when an
input is pulled high and the pin must be grounded to operate.  INVERT
does not change the value of the pin, just the ON state within

Using the pins in the instance file:

This is used just like any other Pytomation interface.  Example:

m_room_motion = Motion(address=17, 
                       name="Room motion detectormytest")

# Outputs
l_room_lamp = Light(address=26,
                    name='Room Lamp')

Feb 2nd, 2018 - George

I have updated the Insteon, w800rf32, wtdio and arduion interfaces to run under Python 3.  This is
further to the work that David has done porting Pytomation to Python 3.   Along with these changes
are some bug fixes as well.  All this can be found in the features/python3 branch in git.

Jan 7th, 2018 - David

A slight change has been made to the repository branching structure; I'm adopting 
the GitFlow branching model.

What this means is I moved the users and python3 branches, to feature/users 
and feature/python3 respectively, and added a dev branch to encompass them. As 
the need arises, I may add hotfix/* branches. 

Once I consider the dev branch stable, I'll merge it to master.

This makes it much easier to organize the code changes and lets me go back 
and forth to fix something in a new feature, even if another feature isn't 

If you're considering making a change, please consider what the change is 
for. If it is a new feature entirely, please base your changes off of dev, 
if you wish to contribute to a feature already being developed, please base 
your change off that feature branch, not dev. Of course, hot-fixes should 
be based on master.

Dec 22th, 2017 - David

Added support for Users

Committed the first part of the user security piece, in the "user" branch, which is based of the "python3" branch.
Currently, it only allows you to restrict a user to certain devices; but the infrastructure is built, so it won't be much
to add the command level security now. 

I have an example on how to use in the dopeyrealm instance. It's usage will change as the command security is added, however. 

Nov 12th, 2017 - David

Added Insteon Hub a a new interface.

Jan 21th, 2016 - George

Added docs on restriction command.

Jan 19th, 2016 - George

Added support for simple cron style date/times for Trigger and Ignore

Simple cron style date and times were added to commands that have START and END attributes such as
Trigger, Ignore and Restriction.

The cron style is a follows  (seconds,minutes, hours, day-of-month, month, day-of-week)
Entries must be integers except you may use '*' to denote any time or date.  Ranges are not
supported yet.  An example is below:

                Attribute.COMMAND: Command.ON,
                Attribute.MAPPED:  (Command.LEVEL, 50),
                Attribute.SOURCE: somebutton,
                Attribute.SECS: 300,
                Attribute.START: ('*',25,16,8,12,'*'),
                Attribute.END: ('*','*','*',7,1,'*')

So an ON command from "somebutton" will turn the light on at 50% brightness after 300 seconds starting
December 8th at 4:25pm and lasting until January 7th.

Mixed dates are allowed so you can use a start or end date in cron style and the other in 'HH:MM' or 'HH:MM:SS'
It is best to stick with 24 hour clocks but you can use "am" or "pm" in a time as in '7:24am' or '4:30pm'.  DO NOT add
an "am" or "pm" to 24 hour clocks.  Not only does  it not make sense, it doesn't work.  Remember that times in clock
style are strings and must be enclosed in quotes.

Jan 9th, 2016 - George

Added Group support for Phillips HUE.

You can now use Groups that are defined in your Phillips HUE with PytomationThere is
support in the utility for defining new Groups.

Check the interface docs here for more information.

Jan 4th, 2016 - George

Added driver for Phillips HUE.

You can now use Phillips HUE with PytomationThere is also a utility for
connecting to the Bridge, adding new lights and testing hue, saturation, brightness
and RGB colour levels.

Jan 1st, 2016 - David

New version of Android app.

A new version is
available and working in Marshmallow.

This version requires at least Android 4.0 (Ice Cream Sandwich); it wouldn't allow
for a lesser version. If I make any changes to the app I'll likely give two versions for a while,
 to allow for the older android versions. This release has no other changes though, so if you
have an older Android, you don't need to upgrade.

To get it working again I had to update Apache Cordova, move to Android Studio, and upgrade
the Android SDK.

Nov 27th, 2015 - George

Lots of changes since the last item below.

Updates to the web site - full documentation is now on line and is currently being updated
Insteon fixes.
Zwave support
Venstar ColorTouch Thermostat (5/6800) support

Home Control Android app  - search the mail list for the latest version fro David.

Mobile web app

New devices added LOCK, THEROMSTAT, ROOM

OCT 31, 2013 - Jason
Added support for new devices.  Preparing for 1.1 release.

Mar 05, 2013  -  George

Change Insteon levek back to 1-100%

Normally when setting an Insteon lamp to a level, Pytomation uses levels between
1 and 100%.  When used with a ramp rate I had it using settings of 1-15 for the level.
This has now been changed back to 1-100%, ramp rate is still 1-15

(Command.LEVEL, 10, 12)    come on to 10% brightness at a fairly fast rate (12)
(Command.LEVEL, 100, 12)    come on to full brightness at a fairly fast rate (12)

Feb 25, 2013  -  George

Added to git repository

USB serial port adapters have the annoying feature of changing every time
Linux boots, will query your devices and link them to the correct
port.  No more having your PLM be on ttyUSB0 one moment and ttyUSB1 the next. will probe all the ports in the SERIAL_PORTS list for any of the
devices in the PROBE_DEVICES list.

In your software  you should set the port devices accordingly, here is a sample
for Pytomation:

insteon = InsteonPLM(Serial('/dev/sp_insteon_plm', 19200, xonxoff=False))
wtdio = Wtdio(Serial('/dev/sp_weeder_wtdio', 9600))
w800 = W800rf32(Serial('/dev/sp_w800rf32', 4800, xonxoff=False))

This script should be run at boot time or any time before your software starts

Feb 25, 2013  -  George
Add on_fast, off_fast
and ramp rate to Insteon devices

Pytomation instances now handle ramp rates and on_fast/off_fast commands with Insteon.
You can now tell an Insteon light to come on at a level between 1 and 15 and at a rate between 1 and 15

(Command.LEVEL, 15, 12)    come on to full brightness (15) at a fairly fast rate (12)

If you set a very slow rate, such as 1 it will take maybe 60 seconds to come on full, during this time if
you need to turn it off right away you can issue a (Command.OFF, 'fast') command instead of just plain

So recap you can now do:

(Command.ON, 'fast')
(Command.OFF, 'fast')
(Command.LEVEL, level, rate) where level and rate can be between 1 and 15

Note this is for Insteon only.  UPB has it's own rates and levels.

Feb 24, 2013  -  George
Arduino boards support adressing

Arduino boards now support addressing.  You can change the board ID in the uno_sketch.ino
and easily have more than one board connected to your computer.

The board will also blink the onboard LED on pin 13 upon reset to id the board.  One blink for board A,
two blinks for board B etc.  This is leading up to cascading Ardunio boards together to increase the
amount of I/O you can connect on a single serial/USB port.

Feb 22, 2013
Time now takes cron arguments

Pytomation git can now use cron style time settings anywhere a Time attribute is used.
Here is an example:


Turn the light on at 4:09pm only on Saturday

test = Light(address='12.03.AA', devices=(insteon, x1),
                Attribute.TIME: (0,9,16,'*','*',6),
                Attribute.COMMAND: Command.ON

Other examples:
    (0,9,16,'*','*',[6,7])    Sat and Sun
    (0,0,[16,17,18,19,20],'*','*','*')  4, 5, 6, 7 and 8pm
    (0,0,range(16,21),'*','*','*')  same as above
    (0,range(0,60,5),,'*','*','*','*')  every 5 minues

Feb 18, 2013
Version 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.   
        - 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

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