Python version of HouseControl

I am beginning to write a python version of HouseControl. It is more convenient to use python on the Raspberry Pi and it will be interesting to see how easy it is to convert. As communication is by sockets the Java and python versions will talk to each other. So I can run Java on some nodes and python on others.

I will use the same architecture for the python version, with interfaces and plugins. I think I will call it PythonControl.

For the python version, I am concentrating on the things that I want to do on Raspberry Pis. These are mainly controlling my door camera and my robot.

For the door camera, some of the things that I want to do are:

  • Turn the LED on the camera on or off
  • Take a picture or video
  • Text to speech (for scaring people who come to the door)
  • Turning motion capture on and off
  • Turning the microphone and speakers on and off
  • Shutdown or reboot the Raspberry Pi

For the robot, I have previously written a python socket server that moves the robot around, control the arm, and does text to speech. I will convert this into PythonControl plugins, so that I can control the robot via my HouseControl interfaces, such as HouseChat.

I run XBMC on the Raspberry Pi, but I don’t need to run HouseControl (or PythonControl) on this as I control it via the http json rpc interface, and that works fine from the PC.

This entry was posted in Home automation, Raspberry PI and tagged , , , . Bookmark the permalink.

11 Responses to Python version of HouseControl

  1. Noob2this says:

    Hi Lawrie,

    I hope you don\’t mind me resurrecting our previous discussion I wrote on a previous thread of yours.

    Since April I have regularly (or at least tried to) kept up on HA developments and I am now of the similar opinion that HAH does not offer what I want.

    I am fond of the open remote functionality demonstrated in the YouTube videos but I\’m unaware as to how it all works as it doesn\’t seem to explain by what medium it is controlling switches etc.

    I was hoping get your advice/steering as to how I should proceed with my own HA installation/development. I\’m looking to have light, blind, radiator and a few socket controls with status monitoring. Additionally I\’d like zoned music control ideally compatible with spotify/google music. Other than that window and door sensor monitoring with ip camera.

    I would inevitably like to do this with a less programming as possible for as little a cost. However my lack of programming knowledge is not to say I\’m unwilling to learn.

    With my fondness for open remote I\’d like to be able to control everything either with this or similarly I.e. iOS/android.

    So if you are able to help I’d like your view on:
    Which switches/controllers you think I need/most appropriate/best vale. What hardware and or system will I need I.e. Raspberry ip, arduino etc. Which suppliers are best How much programming is involved and would you recommend such a project for a novice. Would open remote be viable, if not which ui would you suggest.

    Your views and or any assistance would be greatly appreciated.

    Many thanks,


    • Geek Grandad says:

      Hi Sam,

      OpenRemote supports most of the common home automation products and protocols. I have recent added some of my stuff to OpenRemote, although it is only in a testing release at the moment. It includes direct communication with Arduino and other serial devices.

      I think the main thing you need to decide is what products and protocols you want to use for things like lights and sockets.

      What country are you in? If you are not in the UK, what I have done won’t be very relevant as a lot of the home automation products are country-specific

      I use mainly LightWaveRF light switches and sockets. These have the advantage that they are good looking, work well, and are straight replacements for existing light switches and sockets, The disadvantage is that they do not do support status monitoring. You cannot reliably tell if they are on or off, particularly if the manual switches are used.

      I also use some EDF IAM plugin sockets. These are quite nice as they support status monitoring and tell you how much electricity the appliance plugged into them uses. As well as helping you cut down electricity usage, you can use this for things like telling you when your washing machine or dryer or dishwasher has finished.

      So do you want to replace your wall sockets or are you happy to have plug-in switchable sockets?

      I use a combination of both. I use the EDF IAMs for my kitchen and utility room sockets, which are out of sight. I use LightwaveRF sockets for my living room and the LightwaveRF light switches in several rooms.

      If you don’t like LightwaveRF or EDF IAMs, there are alternatives like Z-Wave, but Z-Wave devices are more expensive and I do not believe they replace existing light switches and sockets. In fact in the UK, it is only LightwaveRF that I know of that replaces existing switches and sockets. If you know of any others, let me know.

      If you let me know what would work for you for light switches and sockets, I can explain the options for controlling them with OpenRemote.

      We can the get of to the topics of blinds, door cameras, zoned music control etc.

      I have not been doing much home automation lately, as I am back working on robotics, and I spent some time in the summer on my garden sprinkler system, but I expect to get back to home automation soon.


  2. Eric says:

    Hi Lawrie,
    I came across this blog from a previous comment you made in the Open Remote forum.

    I’m interested in what you’re doing here with Open Remote, and I’m wondering if House Control can help me do what I’m looking to do. I have a bunch of Arduino’s acting as sensors that can communicate with a single Arduino. They use the popular nRF24L01 wireless modules.

    I’d like to present all this data on an Android app, be able to actuate relays on Arduinos from the Android App, and set up rules to do some automation based on sensor events. I’ve looked into the Vera units from Mi Casa Verde, but they all depend on a central server which I don’t’ really like, besides which the units are very expensive.

    Does House Control act like a bridge between Open Remote and the Arduino field devices? If you have any ideas of doing what I want to do with Arduinos and RPi’s, please point me in the right direction.


    • Geek Grandad says:

      Yes, I use HouseControl to interface between OpenRemote and various Arduino devices using socket (TCP) connections from OpenRemote.

      I also did a serial protocol contribution to OpenRemote –

      I am not sure what the status is of this. Contributions seem to take a long time to make it into an OpenRemote release and have not been actively pursuing this. There were some issues with the serial protocol reported on the forum, and I have not got round to looking into them. I still plan to.

      The python version of OpenRemote has had very little development on it, and the Java implementation has only been used by me, although there seems to be some interest in it recently.

      I have some nRF24L01 modules but am not currently using them for anything. Do you have any information on your devices?

      So, you could get your devices to work with the OpenRemore Androi app using my serial protocol or the Java or Python version of HouseControl, but it would need some work and none of these are well supported.

      I have had Android apps talking directly to the Java version of HouseControl. Imodified a speech recognition sample app to talk to HouseControl and could control devices with speech. It worked, but not very well.

      I also have an HTTP interface to the Java version of HouseControl and use it with the AutomateIt Android app to inform me when I receive texts etc.

      So there are lots of options, but none of them well supported. Let me know if you want to follow up any of them.

      Of course there are other ways to interface with OpenRemote or directly with Android apps. You could use an Ethernet of Wifi shield or something like the Arduino Yun that has Wifi built in. You can then use the OpenRemote tcp or http protocols. Or you could use Android apps directly if they support http, like AutomateIt does.

  3. Roger says:

    Python House control
    Is there any sample code available?
    Which ardunio sketch do I need to use Lightwave relays and dimmers?
    What do I send to your lwdecode.ino to test things

    Running Ubuntu and have Java 7 installed.
    tried sh script and it only seems to list the configeration and stops.
    any help would be apreciated.
    Many Thanks

    • Geek Grandad says:

      I never got very far with the Python version, but the Java version works for me, lwdecode should print results when you press any button on a LWRF remote. HouseControl needs the lwrelay sketch running. What configuration file are you using? I have not used LWRF relays, although I do have one. They should work, though. I am not actively working on this at the moment, but do hope to get back to it soon.

  4. Roger says:

    Thanks for fast reply
    sorted lwdecode all OK
    My trouble is I have never used Java
    Unzipped code
    changed to the directory where unzipped to.
    in terminal entered sh
    It lists your configuration and stops.
    used ctrl C to get out of it
    What do I do now?
    Many thanks

  5. Geek Grandad says:

    You will need to edit the configuration file conf/house.xml. I suggest you rename the existing house.xml file and use the lightwaverf.xml file by renaming it to house.xml. It just does LWRF and nothing else. You will then have to edit it to match your devices. You will need to change lwrf_port to the port that Arduino is using, and the code attribute to the one that lwdecode reports as the identifier. You could start by trying one device, by changing the channel for the device (currently called mylight) to the one used by on your LWRF remote to switch that device on and off.

    If this all works you should see messages when you press the buttons on your remote,

    To control things you can start the HouseChat application, and you should be able to type in commands like “mylight on”, “mylight off”.

  6. Roger says:

    Thanks for the info, I will try tomorrow
    Is it possible to use lwrelay sketch and enter code directly into the serial monitor for testing purposess, if so what is the syntax to do this?
    If this is possible I may be able to use Python with you library.
    Many thanks

  7. Roger says:

    Thaks for your help but I am not getting any further
    The Java I dont understand, all it does is lists a file and hangs, Given Up

    Tried the lwrelay and tried entering into serial monitor and also tried sendind using Python.
    My own sketch receives from python OK but cant get lwrelay to work.
    Please could you show me an example.
    I tried the following fro Python
    also tried entering via serial monitor 0xf6,0xf6,0xf6,0xee,0x6f,0xed,0x7e,0xed,0xde,0xbb

    many thanks

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s