x10

All posts tagged x10

Well it’s been a couple months since I installed my IPcamera and linked it to my x10 door bell. It’s been pretty great. I plan to show a new refreshed video and a full introduction to the software features I use in some backend scripts and a web as well as a smartphone app that I’ve been working on.

For now I’m interested in showing my IPcamera/doorbell script I wrote for XBMC just this evening. I use XBMC on all TV’s and computer systems in my house.

This slideshow requires JavaScript.


It’s been pretty great so far at automating my media across the network and integrating my home automation notifications. I decided to write a script to send a notification to all XBMC instances when my doorbell rings and to display a live video feed of the IPcam at my porch for 10 seconds.

My particular use case was I realized when in my exercise room I will not be able to hear my doorbell over my treadmill motor and music/video playing, AND I’m probably going to be spending most of my time in that room looking at an XBMC screen. It works great, it’s very simple and it’s very cool since it pops up on any screen I have running in the house

[CODE] 
##Deprecated Example!

#Import the XBMC/XBMCGUI modules.
import xbmc, xbmcgui, time, urllib

#inherit from WindowDialog instead of Window so that it's shown on top of
#what's onscreen instead of replacing it entirely
class CamView(xbmcgui.WindowDialog):

    def __init__(self):
        #Define image location and size
        self.image = xbmcgui.ControlImage(870, 438, 380, 253, "")
        self.addControl(self.image)

viewer = CamView()
viewer.show()
start_time = time.time()
while(time.time() - start_time <= 14):
    #set url to ip cam image, password auth not supported 
    urllib.urlretrieve("http://asdf.com/camera/", '/tmp/bell.jpg')
    viewer.image.setImage("")
    viewer.image.setImage("/tmp/bell.jpg")
    #Define image transparency 
    viewer.image.setAnimations([('conditional', 'effect=fade start=90 end=90 time=0 condition=true',)])
    xbmc.sleep(500)
viewer.close()
del viewer

[/CODE]

What I’ve created is a regular XBMC script like all other addons. You can get my script in ZIP format from github here, https://github.com/ssshake/xbmc-scripts/blob/master/script.doorbell.zip?raw=true

The thread on XBMC forums for this project can be seen here: http://forum.xbmc.org/showthread.php?tid=156665

This script can be run in the Programs menu or ideally for what I’m demonstrating here, it’s called by a command line script when it sees that my doorbell has been pressed. This is just a regular HTTP GET to your XBMC machine telling it to run the script.

Please note I’m using HTTP GET’s on XBMC 11, XBMC 12 requires an equivalent command over a json call. I’m pretty sure it’s not hard, I just don’t have that information right now.

http://XBMCHOSTNAME:PORT/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.RunScript(/PATH/TO/SCRIPTS/DIR/script.doorbell/doorbell.py)

From a linux shell you'd execute this as:

wget "http://XBMCHOSTNAME:PORT/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.RunScript(/PATH/TO/SCRIPTS/DIR/script.doorbell/doorbell.py)";

or you can just paste this into a regular webbrowser to test.
Check out my latest post where I demonstrate this functionality as a popup in XBMC, including script source code http://homeawesomation.wordpress.com/2013/02/18/doorbell-ipcam-xbmc-update/

Check out my latest project!

I have fully installed my door bell and camera, have developed a decent looking website and html email template and configured my cellphone to make door bell dings when the message letting me know someone is at the door arrives. It was all pretty simple. I’ll be posting a video soon but currently it’s -25’C outside.

I just got my hands on a used x10 pan/tilt camera mount. With it I have retrofitted my non-pan/tilt IP camera with it and I have written a simple yet easy on the eyes web interface with live 1 frame per second(by choice) view.

Check out my latest post where I demonstrate this functionality as a popup in XBMC, including script source code http://homeawesomation.wordpress.com/2013/02/18/doorbell-ipcam-xbmc-update/

This slideshow requires JavaScript.

So what you’re seeing here is me using a Harmony remote, and a mediapc running XBMC, plus x10 Home Automation to control my Lights, Thermostat and Fireplace. The Harmony remote and my PC drive the functionality. XBMC’s Notifications via API allow on screen feed back for what commands I’m executing.

Soon I will update this page with links to illustrations, script examples and a parts list.

Parts Used:
-Logitech Harmony Remote
-XBMC PC
-X10 lights + PC Controller (any HA lights would do)
-IR543 (is an x10 IR received for the remote, but an xbmc script could do this)
Parts Used:
-Logitech Harmony Remote
-XBMC PC
-X10 Universal Module for fireplace (basically a relay switch)
-TX15B X10 thermostat (deprecated, I recommend a good WIFI thermostat)

Here are some screen shots, I’ve included a summary of most of the dialogs to give you an idea.

This slideshow requires JavaScript.

People might be interested in this x10 plugin for XBMC. It doesn't support linux services but I'm actually planning to add this to the existing script.  http://forum.xbmc.org/showthread.php?tid=110392

So you’re at the point where you want to add more functionality to your home automation system, or maybe you specifically only want a remote access Thermostat. There are a number of reasons to want this but the question is which one is the best choice? Which technology is the right choice?

 
Before we discuss that, I’ll list a few reasons why you might want a remotely accessible Thermostat:

  • Left for vacation, forgot to turn off heat or AC. In a pinch you can adjust this from your smartphone or a computer
  • Returning from vacation and would like to get your house to the proper temperature before you step in the door. Returning from a tropical paradise to a frigid dwelling isn’t fun.
  • You would like to record the usage of your thermostat to a file/database so that you can do a detailed analysis between usage and utilities bills. (if you’re the meticulous type)
  • You want the actions of your thermostat to be directly affected by the status of motion sensors in your house. Why heat if I’m not home? Why adhere to preprogrammed schedule if I come home early?
  • You’re not near your thermostat (perhaps on a different floor) but want to turn the heat up, or turn it down.
  • You want to extend the functionality of your thermostat by augmenting it with custom functions from a computer/server.

Now lets discuss which to choose. I for one, didn’t really do my homework before buying mine. I previously had an x10 lighting setup in my entire house so to me I thought well I have the x10 transmitter, logically I want an x10 thermostat like the one pictured here. It is an RCS tx15b. They don’t make these anymore, I purchased mine used off ebay. It works well as shown in my other videos, but there is some hackiness required to get functionality like bi-directional communication to work. It wasn’t the worst choice and will do fine for now, but ultimately for the price I paid I could have spent another $50 and got current gen technology with better features.

Aside from x10 thermostats, there are other home automation protocol controlled thermostats. Such as ones controlled by z-wave and insteon, but I recommend you avoid them all. The conclusion you should draw from this article is why hassle with proprietary protocols and the need to purchase a compatible transmitter when good ol’ WIFI will do best.

Not all WIFI thermostats are created equal

Disclaimer: I have never used any WIFI thermostat in my life. I have just read a lot in preparation for my next purchase. However statistically speaking there is a 92% chance that my opinions are facts. In the event of the other 8% please comment corrections, I’d rather be eventually right than incorrectly believe that I’m right.

  • Most WIFI t-stats do not allow you to access them via LAN, aka HTTP to an internal IP. MOST of them actually make you connect to their externally hosted site. So you’re never directly accessing the t-stat, rather the t-stat sends and receives commands to their website, and you as a client also connect to this website. This completely ruins the chance for hacking and customization. You want a t-stat that has a locally accessible web server
  • Most WIFI t-stats DO NOT offer any sort of API access, so that you can easily send commands and receive status via a custom script
  • Often from my research the more expensive thermostats are the ones that are the most locked down.

Having the above in mind my recommendation to you is to purchase a thermostat from RadioThermostat.com. The reason why is they satisfy all the concerns listed above.

Their thermostats offer:

  • A locally accessible web server
  • Open and full featured API access using REST (HTTP GETs)
  • Priced very reasonably.

Some might say they’re a little on the ugly side. But for the price and features I’ll take the ugly. This is the ct-30. It’s about $140 shipped and considering non-wifi thermostats with decent functionality are $100 – $300, this is a steal. The ct-80 is its big brother, it comes with many more features such as a humidistat. It’s quite a bit more expensive but I’d say worth the cash. 3M resells the ct-30, rebranded as the 3M filtrete, and honestly looks very ugly to me. I’d rather get the radio thermostat branded unit.

If you’re wondering why the API matters so much, let’s assume on Windows or preferably Linux, I want to request the thermostat’s temperature, and then send that data into a website, XBMC, a daily email report, or just log to a file or DB for statistical purposes. With a RESTful API, all you have to do is script a HTTP GET to http://IP/API?command. And the thermostat will respond with the data.

If words like API, Rest, HTTP GET and the like sound foreign to you, don’t worry it’s actually a very simple concept. The thermostat has a web server running on it, you make a request to a particular page on it’s server (via script or even browser), the server will respond with data after you make the request. This thermostat also has it’s own web user interface for configuring it. And has an iphone and android app.

 
My last note is you might be wondering, why do most WIFI t-stats use a hosted site instead of a local web server? The answer is ease of setup for the non-technically inclined, at the expense of flexibility. If your t-stat has a local only server, then you need to open up a port in your route/firewall and set up rules so that you can access it over the internet (aka from work, from cell phone).

So to combat this, instead of the t-stat hosting the server, the t-stat initiates an outbound connection from your home internet, to the manufacturers website, where it sends and receives data to/from that site. You then use an account you create with them to log in, view, and control your thermostat at home. This is pretty much identical to the concepts of accessing your web enabled printer over the internet if you happen to own a modern HP or Cannon printer for example.
For my uses, Yes I want to be able to access my t-stat controls from across the internet, but I also need to be able to access it directly/locally for customization.

A home automation App that I am developing in HTML5

Update with additional info

This slideshow requires JavaScript.

The plan for this app is to not only have an access anywhere, dynamic webUI, but to have an application on my phone, tablet(s) that feel native. Of course I’ll be using HTML5 with Jquery, I’ll also be using Webworks for the phone/tablet app.

Demonstrated in these videos:

  • Thermostat, capable of adjusting temperature and mode.
  • Fireplace control, mostly to be able turn off if paranoid.
  • Generic House Timer, which activates x10 door chimes. Good for various uses.
  • And of course lights. Currently I’m using a heavily modified version of iPHC(iPhone Home Controller). I will be writing this lights portion from scratch to suit my needs better.

Tools like this rely heavily on backend scripts I have running on my Linux server at home. However the concepts behind these scripts are very simple using the CLI interface on an x10 CM15a. The software/daemon I chose to use is Mochad.
In conclusion I’d like to drop a little disclaimer here. The UI is obviously a work in progress and I’m focusing on functionality first. Cleaning it up and making is look pro is an easier task.

Another video that’s a little blurry.