26
Software Control of Home Automation Systems BRUCE &MATTHEW MOMJIAN, ENTERPRISEDB July, 2010 Abstract Software can greatly enhance existing hardware home automation systems, giving them smarts. This talk covers many software programs for home automation. Creative Commons Attribution License http://momjian.us/presentations

Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Software Control ofHome Automation Systems

BRUCE & MATTHEW MOMJIAN,ENTERPRISEDB

July, 2010

AbstractSoftware can greatly enhance existing hardware home automationsystems, giving them smarts. This talk covers many softwareprograms for home automation.

Creative Commons Attribution License http://momjian.us/presentations

Page 2: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Dumb Home Automation Devices� Timers

� Clapper

� Dawn/Dusk Sensors

� Motion Sensors

My other presentation, Practical Computerized Home Automation, coversthe hardware aspects of home automation.

Practical Computerized Home Automation 2

Page 3: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

What Does Software Control Enable?� Device behavior can be combined

� No distance limitations

� Activity detection

� Fully programmable / scriptable

� Access to external data

Practical Computerized Home Automation 3

Page 4: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

How Is This Possible?Home Networks

� Wired telephone

� Cordless telephone (900MHz, 2.4GHz, 5.8 GHz, 1.9GHz)

� Wireless remotes

� Wired local area network (Ethernet)

� Wireless local area network (802.11)

� Electrical (X10)

Practical Computerized Home Automation 4

Page 5: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Software Control

ProgramInput Output

Practical Computerized Home Automation 5

Page 6: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Inputs� User commands

� Clock/Timer

� Dawn/Dusk sensors

� Wireless remotes

� Caller Id

� Telephone Dialing

� Web sites, e.g. outside temperature

Practical Computerized Home Automation 6

Page 7: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Outputs� Lights

� Motors

� Appliances, e.g. coffee maker

� Sounds

� Network broadcast messages

� Slideshow

Practical Computerized Home Automation 7

Page 8: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Home Application: First Floor

Interface

Office

Computer

Dining Room

KitchenBedroom

Garage

Living

Hallway

Entry

Family Room

Light

Chime

Dawn/Dusk Sensor

Computer/Power Line

Screen

Wireless Remote

Coffee Maker

Practical Computerized Home Automation 8

Page 9: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Home Application: Second Floor

PlayBedroom Bedroom

Bedroom

Hallway

Bed

Room

Wireless Remote Chime

Light

Pool Pump (outside)

Practical Computerized Home Automation 9

Page 10: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Heyu

X10 devices are controlled and monitored using the X10 CM11acomputer interface device and the open source heyu control software.For heyu information, see http://www.heyu.org/. Heyu can be customizedby defining devices in ~/.x10config:

remotebed I 1 # downstairs remote alloff

entrytable I 2

bookcase I 3

couch I 4

tiffany I 5

schoolroom I 6

fireplace I 7

laundry I 8

wireless I 9 # wireless outlet, makes click noise

masterbed I 10

...

Practical Computerized Home Automation 10

Page 11: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Heyu Wrapper Script

Instead of:

$ heyu turn couch on

a script can be created:

$ x10on couch

The script can handle multiple devices:

$ x10on tiffany bookcase

and groups of devices can be defined:

$ x10off videoPractical Computerized Home Automation 11

Page 12: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Simple Time-Based Activity

cronTime Output

Practical Computerized Home Automation 12

Page 13: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Crontab Scheduler

0 7 * * * root x10on slideshow

0 11 * * * root x10on decor

0 12 * * * root touch /u/x10/wait_for_dusk

0 14 * * * root x10on bathroom

30 20 * * * root x10on boyscolor catherine

# fade

30 21 * * * root x10dim entrytable decor bathroom

# off

0 21 * * * root x10off bookcase

0 23 * * * root frontlights off; x10off decor tiffany

0 0 * * * root x10off ‘x10group 1 | egrep -v ’^entrytable$’‘

0 0 * * * root touch /u/x10/wait_for_dawn

59 0 * * * root x10dimoff_slow laundry

59 1 * * * root ! is_tz_fallback && x10alloff

Practical Computerized Home Automation 13

Page 14: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Dawn/Dusk Activity

Dawn/Dusk Sensor

(via X10)

x10monitor

daemon

Inside Lights On

Outside Lights On

+30 minutes

Practical Computerized Home Automation 14

Page 15: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Monitoring X10 Activity

7/6 at 05:40:49 address unit 8 : housecode d (entrymotion_dusk)

7/6 at 05:40:49 function Off : housecode d unit 8 (entrymotion_dusk)

7/6 at 20:35:57 address unit 8 : housecode d (entrymotion_dusk)

7/6 at 20:35:57 function On : housecode d unit 8 (entrymotion_dusk)

7/6 at 22:05:46 address unit 3 : housecode f (catherine)

7/6 at 22:05:46 function Off : housecode f unit 3 (catherine)

7/5 at 23:18:20 address unit 13 : housecode i (remotebed2)

7/5 at 23:18:21 function Off : housecode i unit 13 (remotebed2)

Practical Computerized Home Automation 15

Page 16: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Acting on X10 Events (Dusk)

x10 monitor | while read LINE

do

echo "$LINE" >>/var/log/x10

case "$LINE" in

# is it dusk?

*" On : "*"(entrymotion_dusk)"*)

if [ -f /u/x10/wait_for_dusk ]

then rm /u/x10/wait_for_dusk

x10on 1

echo "heyu turn masterbath on;

heyu turn laundry on" |

at now +45 minutes

fi

;;

Practical Computerized Home Automation 16

Page 17: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

X10 Already Supports Wireless Remotes

Practical Computerized Home Automation 17

Page 18: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Coffee Maker Timer

(via X10)

Wireless Remote

+30 minutes

Coffee Maker Offx10monitor

*" On : "*"(coffeepot"*")"*)

echo "heyu turn coffeepot off" | at now +30 minutes

;;

Practical Computerized Home Automation 18

Page 19: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Telephone Notification

Caller ID

(via modem)daemon

Broadcast Message

Logfile

Numbers/Names from

Call Chime (optional)

Contact Directory

caller_id

Practical Computerized Home Automation 19

Page 20: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Caller ID

AT#CID=1

Wed Jul 8 21:34:00 EDT 2009 DATE = 0708

Wed Jul 8 21:34:00 EDT 2009 TIME = 2134

Wed Jul 8 21:34:00 EDT 2009 NMBR = 6107429657

Wed Jul 8 21:34:00 EDT 2009 NAME = PENNSYLVANIA

Lookup phone number in contact directory.

Wed Jul 8 21:34:04 EDT 2009 Bruce and

Christine Momjian from Bruce’s cell phone (610) 742-9657

Log call, and optionally sound X10 chime if phone call is from animportant phone number.

Practical Computerized Home Automation 20

Page 21: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Outgoing Calls

Numbers/Names from

Telephone Directory

User Command dial

scriptOutgoing Call

Practical Computerized Home Automation 21

Page 22: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Telephone Dialing

Dial phone number from contact directory:

ATDT16107429657

Tue Apr 7 14:57:26 EDT 2009 16107429657 Bruce and

Christine Momjian to Bruce’s cell phone

This can also be used to automatically dial recently received calls usingthe log.

Practical Computerized Home Automation 22

Page 23: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Pool Pump

job scheduler(time varies with temperature)

Poolpump On

(via weather web site)

Outside Temperature

A script allows scheduled pump control with manual override.

Practical Computerized Home Automation 23

Page 24: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Family Activity Screen

Picture Directory

Weather Website

PHP, Javascript,

scripts

Event Calendar Family Activity Screen

Screen is shown on a dummy display and also on laptops throughout thehouse. Source available at http://code.google.com/p/infodisp.

Practical Computerized Home Automation 24

Page 25: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Time to Eat

(via X10)

x10monitor

daemon

Wireless Remote Broadcast Message

Activity Screen Off

"Eat" Chime

(for 50 minutes)

Practical Computerized Home Automation 25

Page 26: Software Control of Home Automation Systemsassets.en.oreilly.com/1/event/45/Software Control... · Software Control of Home Automation Systems BRUCE & MATTHEW MOMJIAN, E ... Dining

Conclusion

http://momjian.us/presentationsPractical Computerized Home Automation 26