Kodi Community Forum

Full Version: INSTEON Home Automation Addon
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3

This is my first attempt at a Python addon script for XBMC. It has been 10 years since I have used Python, and only ever in the Zope environment. To say this has been a very time consuming (and at times extremely frustrating) foray into xbmc addon development would be an understatement. Somehow I have managed to hack together something that works (at least for me). Now I would like to release it on the unsuspecting world.

I started with a simple idea… I wanted to be able to control INSTEON Scenes from within XBMC – using the new INSTEON Hub as the INSTEON Scene controller (this may also work with the older SmartLinc 2414N controller - however I have not tested this - please let me know if it does).

Luckily there are a number of scripts that have been written for other home automation technologies – MiCasaVerde Vera (here), Philips Hue (here) and some others (here). I started with these scripts (as they all seem to be basically the same) and thought “wow, this will be easy, all I need to do is adapt the HTTP calls to work with the INSTEON Hub”. Wrong!

It would seem that the scripts did not work in their entirety, in particular the pause/resume control as well as urllib2.urlopen (see my post about this here - a big thank you to the people that helped to turn me onto the requests module instead of using urllib2).

Now, as this is my first attempt at an addon, I am sure that there are going to be issues, better ways to write the code and different approaches. I am looking for feedback from the xbmc python community to test and improve this addon - hopefully achieving best practices and compatibility with XBMC.

Any and all input is sincerely appreciated.

As this is as much about improving the addon, it is also about me learning, so if you have suggestions, it would be greatly appreciated if you were able to include the reasoning – so I can learn (and I am sure it will help others).

The setup and use should be self evident from the addon config settings and code. However I will work to compile a complete user guide shortly (Edit: see post number 3 below). Don’t worry if you do not have the INSTEON Hub, I have tried to include a debugging mode (turn on/off in the settings) so you will still be able to test the addon.

Thank you for taking the time to have a look at my first attempt at an XBMC addon – I hope it is useful for someone out there!

Without further adieu, let the critiquing begin… (be gentle please)…

INSTEON Hub XBMC Event Addon Zip
(note I will replace this link as newer versions become available):




- Various bug fixes and improvements

Older versions


User Guide

Please see post 3 below.

PS If anyone is interested in really getting involved in the development of this addon and can spare some time (and brain cells), please pm me, I would love to hear from you.
INSTEON Home Automation Addon - SHORTCUTS

Please see the post below for instructions on configuring the Shortcut settings.

Now that we have set some custom Shortcuts in the Addon, we need a way to trigger them from within XBMC. The easiest way is to assign the INSTEON Shortcut Menu a keypress, you can then open the Shortcut Menu with a standard keyboard or an MCE remote button press.

You will need to add the XML setting below to your userdata > keymaps > keyboard.xml file...

<y mod="ctrl">SetProperty(insteonmenu,true,10000)</y>

This should be placed in the XML file between the <keyboard> place here </keyboard> tags.

As an example:

<y mod="ctrl">SetProperty(insteonmenu,true,10000)</y>


In the example above, Ctrl + y will open the INSTEON Shortcuts menu within XBMC. You can assign any keypress you like by changing the y mod="ctrl" part. Make sure whatever you assign does not conflict with other XBMC keyboard assignments.

So where do you find your userdata > keymaps > keyboard.xml file? It varies depending on the OS you are using, please see this link for more information.

As always, let me know if there are any issues. All feedback is appreciated.
INSTEON Home Automation Addon - The User Guide

Note: This addon is designed to be used with the new INSTEON Hub as the INSTEON Scene controller. However, it may also work with the older SmartLinc 2414N controller - however I have not tested this - I would really appreciate if someone could test and let me know if it does.

Addon Overview

I love XBMC. I also love Home Automation. My technology of choice for HA is INSTEON (please, let’s not turn this into a debate about the best home automation technology). INSTEON works great for me, does exactly what I want – best of all, it is extremely affordable and reliable.

The goal of this addon is to combine two of my passions (XBMC and INSTEON). It just makes sense, doesn’t it?

Imagine, after a hard day's work, you settle down on the couch to watch a movie using your favourite media centre – XBMC. Ok, now imagine that when you start playing your movie, all of the following happens without you having to do anything other than get comfortable…
  • The overhead lights turn off
  • The lamp turns on, dimmed to the perfect viewing level
  • Perhaps you close the curtains
  • And of course, turn on your popcorn machine

Now, when the popcorn is ready, you pause your movie… and…
  • The overhead light turns on to 30% brightness
  • The hallway light turns on to 30% brightness
  • The kitchen lights turn on
  • The popcorn maker turns off

Now that you are ready to resume your movie, INSTEON turns off the kitchen and hallway lights and returns everything to the perfect movie watching environment.

When the movie ends, INSTEON will then...
  • You get the idea!

That’s exactly what this addon is looking to achieve (and hopefully a little more).

So let’s get started…

Adding the INSTEON Home Automation Addon to XBMC

  1. Download the services.insteon.addon.(version).zip
  2. XBMC – Navigate to System > Settings > Add-ons > Install from zip file
  3. Locate and install the downloaded services.insteon.addon.(version).zip
  4. After the Addon is, well, added – scroll up and enter Enabled Add-ons
  5. Scroll down to and enter Services
  6. Find and open the INSTEON Hub XBMC Event addon

Setting the INSTEON Home Automation Addon Settings

  1. XBMC - Scroll up and enter Configure
  2. This will bring you to the addon settings, the first setting we want to enter is the INSTEON Hub Settings…


Entering the INSTEON Hub Settings

The addon needs to know how to communicate with the INSTEON Hub, there are four settings we need to enter:

1. The INSTEON Hub local IP Address

Not sure what your Hub IP address is? Luckily we can find it easily using the INSTEON for Hub app (available free for Android and IOS).

1.1. Open the INSTEON for Hub App and login
1.2. Press on the Settings Gear Icon in the bottom right corner of the App
1.3. Select Edit Settings
1.4. Now select House
1.5. Scroll down to Local IP – this is your INSTEON Hub IP address

2. The INSTEON Hub Port. I doubt this will be different to the default setting of 25105, so you should be able to leave it. (You can of course also see this setting in the INSTEON App)

3. The INSTEON Hub Username and…

4. The INSTEON Hub Password

If you are unsure what your Hub Username and Password are, we can also find (or change) this information in the INSTEON for Hub App (towards the bottom on the same screen where we found the Hub IP address above).

Activating / Deactivating Night Mode

Think of this setting as a timer for your INSTEON Scenes. As an example, you may only want INSTEON Scenes to be activated between certain hours of the day. It may not make a lot of sense to be adjusting lights when it is daytime… So we don't want our INSTEON Scene triggered during the day. If you would like to activate Night Mode…

  1. Set Night Mode Activated to Yes (default is No – not active)
  2. Set the Night Mode – On Time (24 Hour Clock) to the desired active hour of the day.
  3. Set the Night Mode – Off Time (24 Hour Clock) to the desired inactive hour of the day. Please note that the full current hour will still be active – so if it is set to 7 (7am), Night Mode will not switch off until the start of 8am. Confused? Me too!

Debug Mode

By default, this is set to active (Yes). When Debug Mode is active, you will receive XBMC notifications and xbmc log entries. This can be helpful for testing your INSTEON Scenes etc. This will be changed in the final release version, hopefully with some detailed control over debugging.


This is where we assign INSTEON Groups (Scenes) to XBMC Video Events. The assigned INSTEON Scene will automatically happen when we perform an XBMC Video event (such as playing a video). Please be mindful that if we have Night Mode activated (see above), then these events will only fire between certain times of the day (as defined in the Night Mode settings).

So, let’s assign an INSTEON Scene to the Video Started setting…

Video Started

Note: Make sure you have created a Scene using the INSTEON for Hub App – this is the Scene that you want to activate when you start watching a video – name it something that makes sense (like XBMC Start Video). Creating INSTEON Scenes is outside the scope of this user guide. There is LOTS of information on how to do this on the web - the INSTEON for Hub app is really easy to use, it should be self evident on how to add an INSTEON Scene.

  1. Set Video Start – Activate INSTEON Group (Scene) to Yes (this turns it on).
  2. Enter the INSTEON Scene Group (Scene) ID (this is the INSTEON Group (Scene) that will be triggered).
  3. Repeat the steps above for the other VIDEO Settings (if you like).

How do you find the INSTEON Group (Scene) ID? Good question, back to the INSTEON for Hub App…

1. Open the INSTEON for Hub App and login (if it's not already running)
2. Press on the Settings Gear Icon in the bottom right corner of the App
3. Select Edit Settings
4. Now select Scenes
5. Select the desired Scene
6. Look for Group Number – this is the INSTEON Group (Scene) ID.


This is exactly the same as the VIDEO process above, except it applies to Audio Events within XBMC. Should be self explanatory on how to set this up based on the previous Video instructions.


Here you can set up to 5 INSTEON Scene Shortcuts. To set a shortcut...


1. Set Shortcuts Active to Yes
2. Set Shortcut 1 Active to Yes
3. Shortcut 1 Name: Give your Shortcut a name
4. Enter the INSTEON Scene Group (Scene) ID (this is the INSTEON Group (Scene) that will be triggered).
5. Shortcut 1 - Open XBMC Window: Select the XBMC Window you would like activated when this Shortcut is triggered (optional)
6. Repeat the step above for the remaining 4 Shortcuts (optional)


You will need to assign the popup Shortcut menu to a keyboard press (which can of course then be triggered with a keyboard or MCE remote).

For more information, please see the post above.
New version (0.1.3) now available - please see first post.
first off its amazing your doing this i love insteon hub this would make it even cooler.wish i could help write it but dont know how. tested it but kept getting script error love the addon and even the settings menu ill be excited when you relese the beta. this is awesome
Hi aftermath2008 - would you be so kind as to post the error from the xbmc.log file so I can troubleshoot?

As a matter of interest, do you get an error with version services.insteon.addon.0.1.2.zip?

Thanks for your feedback.
how do you post the log file, it gives me the script error right when i open xbmc or right after i disable then re enable. i only have tried the version 0.1.3

i went and read online how to do it i hope this helps. im limited on knowing some stuff but ill help you with what i can.
Hi aftermath2008 - thank you for taking the time to post your log - very helpful. I can see exactly where the problem is in version 0.1.3. FOr the moment I have rolled back to version 0.1.2 which does not include the shortcut functionality - shortcuts is still a work in progress with some fairly major obstacles to overcome, however I feel it is an important feature so I will persist with refining. I will post new updates here as they become available. From what I can tell so far, version 0.1.2 is fairly stable and shouldn't give you any issues (I hope anyway - let me know if you come across some issues). Thanks again.
thanks version 2 works its the best keep testing it its way cool
New version (0.1.5) now available - INSTEON Scene Shortcuts now included - please see first post for download link.

As always, testing and feedback is greatly appreciated.
New version (0.2.1) now available - Various bug fixes and improvements.

Please see first post for download link.

As always, testing and feedback is greatly appreciated.
loving this addon it makes the ios/android/ web shortcuts/ and this a full proof way to control the lights. it has been running smooth i was just going to ask you about the scene short cuts. i use a leap motion or a tablet to control xbmc do you need to use a hotkey combination to access the shortcuts. and by the way the night mode was a stroke of genius it really doesnt make sense to give controls to the computer durring the daytime. the only other thing i thought would be cool not sure if it is possibe but to have a setting for if you are shutting down the computer i was thinking that you could create a scene called shut off that when computer powers down it automates turning off the lights also. seriously thanks for your efforts i was bummed when i found out initially xbmc onlly had the phillips and isy controllers this addon is very impressive and that is coming from someone that is always tinkering away at the old htpc. thx

nevermind the shortcuts thing i noticed you updated the top posts.
As always, thanks for the feedback. I have put a lot of work into this, so it's great to know someone else is getting some value from it. The shutdown scene triggering is a great idea, I will take a look for a future update (this would only apply when XBMC is being shut down). I have it on good authority that it wont be too far away before the INSTEON Hub supports IR control - this will of course open up a bunch of cool stuff that could be done with the addon. i.e. when XBMC starts, your TV, amp and whatever other IR device you like could be controlled through a scene. I will continue developing and try to make improvements, keep the feedback coming.
Hi Bradles73,

Good job! lov it! works great!

Unfortunally u can't put X10 devices into insteon scenes and my house has a lot of X10 devices that i control with a insteon hub from the pi, using crontab and bash (HTTP calls). So my question, any chance of adding X10 control via the hub in your addon?

Keep up the good work!
Pages: 1 2 3