Home Automation Control GUI interface in XBMC with API - Dimming the Lights and such?

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
nixterrimus Offline
Junior Member
Posts: 13
Joined: Oct 2008
Reputation: 0
Lightbulb  Home Automation Control GUI interface in XBMC with API - Dimming the Lights and such?
Post: #1
I've been reading through the XBMC home automation threads, and see that there have been some really interesting ideas. My desired feature is less ambitious than others. I would like my lights (which could either been insteon or z-wave) to dim when I start playing a movie and to fade back up when I stop. It would be fantastic if one of the guys on the developer team had time for this, but I've also been browsing through Trac and I see that this project has a lot of other (and much more pressing) needs.

I'm a developer. I love Java and ruby. I've done professional web development (although that's not likely helpful here other than the mindset) and I'd like to work on this. I just need a push in the right direction.

I see that XBMC has an HTML api and a broadcast service. Would it be wise for me to utilize those services? This doesn't seem to be a Python script, because I don't want to have to launch a script to turn down the lights. It also doesn't seem to be a plugin. I'm leery of diving head first into the source code of a huge project in a language I can (with work and google) decipher, but not necessarily understand.

I'm looking to develop under Linux (where I'm most comfortable), but I have a machine dedicated to each of the other major operating systems.

Any pushes in the right direction would be greatly appreciated.
find quote
topfs2 Offline
Team-Kodi Developer
Posts: 4,094
Joined: Dec 2007
Reputation: 12
Post: #2
Hi! I have a patch sitting that will enable our builtin EventServer to broadcast stuff (mainly usable for truly plug n play remotes) and it will feature Broadcasting of playback start, stop, pause and anything usefull really.
Currently were in a feature freeze so in atlantis+1 (or svn in a month or so) Ill add it.

From what I know you should be able to use the webserver for this aswell but the EventServer will probably make it easier for you programming wise (EventServer is a UDP server so less overhead/parsing than with http and TCP/IP)

Anyways whichever you choose it should be doable by creating a script/binary that would listen for the broadcasts and trigger the dimming.

Cheers,
Tobias

If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
find quote
Geeba Offline
Posting Freak
Posts: 1,797
Joined: Sep 2006
Reputation: 0
Location: UK
Post: #3
Nixterrimus, I'm a dealer for Lagotek Home Automation and I'm currently doing some research into XBMC support as it seems there is some support for it already from Lagotek... I'll keep you posted on my findings.... If your looking into Home Automation it well worth a look, the kit is fantastic.

http://www.lagotek.com
find quote
Rocketman Offline
Junior Member
Posts: 2
Joined: Jul 2006
Reputation: 0
Post: #4
In the interests of not writing a bunch of code... I use an ISY-99i (universal-devices) that talks to my Insteon devices and also has an IR receiver. I have a Harmony remote that is programmed to turn on the TV, amp (selecting XBMC as an input) and then setting lights to "Movie" mode. When I hit pause, XBMC stops and the lights come up halfway in the main traffic areas. Hit pause again the movie restarts and the lights go down again.

So easy, event the wife can use it.

Robin.
find quote
a_madman Offline
Junior Member
Posts: 3
Joined: Oct 2008
Reputation: 0
Location: Kansas
Post: #5
I have MisterHouse (opensource software installed on Ubuntu machine) running my Insteon hardware around the house.

If you need anyone to test XBMC code on Insteon devices, I'd be happy to help out.
find quote
nixterrimus Offline
Junior Member
Posts: 13
Joined: Oct 2008
Reputation: 0
Post: #6
Thanks for all of the replies. With more thought (and some of the posts), I'd like to share some of my ideas.

It seems to me that the best thing is to have no automation code anywhere in XBMC. I'm not a member of that team, and the sheer amount of code is daunting to me. But, here's what I've been thinking about.

There needs to be an application that has the ability to dim lights. I bet that someone has worked on just such an application or a set of libraries to access low level details of protocols such as insteon and zwave (and maybe even others, I'd be interested in manipulating RGB leds behind the Screen). This application needs to be able to listen for commands from other application. This could eventually grow to support things that other people are looking for.

Something needs to listen for XBMC events. It sounds like post Atlantis the event server is going to get an upgrade. This listener will send back events to the lighting program. The lighting program will then react (and dim the lights).

Finally, I'd like to work on a script where you can edit the configuration options from within XBMC. This would ultimately just be another (probably simplified) front end to the lighting application.

XBMC is a media center (and the best one out there), but it's not an automation solution. I think it's important to respect that difference and utilize the hooks that the team has provided to integrate into an automation system.

Again, though, I'm just looking to dim a light when the movie starts. Smile
find quote
Rand Al Thor Offline
Collect3 Project Manager
Posts: 916
Joined: Jul 2005
Post: #7
I have not actually tried this, but from what I have read this should be possible with something like homeseer + compatible lights or probably mr. house. With homeseer you can set up simple "if/then" actions that can work with ip based, z-wave, x-10 etc modules. So in other words, you could tell homeseer to listen to xbmc and IF the eventserver sends a command that someone hit "play" THEN dim the lights. Homeseer is a bit expensive but I think there are quite a few more resonable (or free) apps that would do the same thing. I don't see a need to create a new app when there are already some that probably could take directions from xbmc's eventserver and already support lights, thermostat, cameras, etc. Just my 2 pence.
find quote
nixterrimus Offline
Junior Member
Posts: 13
Joined: Oct 2008
Reputation: 0
Post: #8
I also like the idea of working with a piece of pre-exisiting software. It almost never makes sense to completely reinvent. I haven't looked at homeseer, but if anyone would like to sponsor a copy for development, I'd see what I'd be able to do. Mister House looks interesting, does anyone have any experience with it? It looks like it already supports other applications, so it's certainly doable to interface with XBMC. Although, it looks like Mr. House hasn't been updated in a while (is this true?) Any other suggestions for a backend?
find quote
Rand Al Thor Offline
Collect3 Project Manager
Posts: 916
Joined: Jul 2005
Post: #9
I am pretty sure that Homeseer, Mister House and perhaps Main Lobby are the most popular. Each have their benefits/drawbacks. Mostly price is an issue with Homeseer and Main Lobby. I think Mister House development has slowed, if not ceased all together.

Another option is something like this http://www.smarthome.com/2412N/SmartLinc...12N/p.aspx it is relatively cheap and does not require a computer to be on all the time. Watch the video provided and you can see how it takes advantage of the iphone for controlling lights, av gear, etc. I could see this working quite well along side Narcan's amazing xbmc Iphone remote. Perhaps even some sort of integration between the two? The only issue I see with this one is that I don't know if it is "smart enough" to interpret the event server's information and then issue a command accordingly or if it only sends commands to insteon/x-10 products. What does everyone else think?


EDIT: Correction, Mister House is still in development.
(This post was last modified: 2008-10-29 21:30 by Rand Al Thor.)
find quote
nixterrimus Offline
Junior Member
Posts: 13
Joined: Oct 2008
Reputation: 0
Post: #10
First Check this out: http://www.youtube.com/watch?v=2R1KH-YyDcU

Alright. I've played with this some more and I think I'm starting to put something together. I checked out Mister house and was really taken by it, but I want to really dig into this, so I opted to write some code myself. Right now I can detect when XBMC is playing something and I can turn a light on and off based on that. The code is written in Ruby and the LED is via an arduino. I think that I'm going to dim the lights via DMX. DMX is an awesome standard used in theatre (during High School I was a light board operator). Things like X10 and Insteon look interesting but it seems there's too many problems with error and interfacing. I welcome thoughts and feedback, and I'd be willing to post my hacked together code if anyone is interested in taking a look.

-Nick
find quote
sicon99 Offline
Member
Posts: 67
Joined: Oct 2008
Reputation: 0
Post: #11
My buddy has x10 modules hooked up to his lights which he can control through is harmony remote! nice easy solution.
find quote
nixterrimus Offline
Junior Member
Posts: 13
Joined: Oct 2008
Reputation: 0
Post: #12
Using X10 and a remote is a cool idea, but I'm firmly entrenched in the idea of getting this to work by having some code "listen" to XBMC. Thanks for the suggestion!
find quote
waldo22 Offline
Donor
Posts: 764
Joined: Sep 2007
Reputation: 2
Location: Chapel Hill, NC, USA
Post: #13
How about using one of these with X-10:

X10 Power Line Interface

Quote:If you know how to send and read RS232-type serial communication with your computer or from any other electronic device, you can develop and market your own software and/or hardware for use with X10-compatible systems without having to develop your own X10 communications hardware or having to go through costly UL approval. This module is optically isolated and UL approved. The timing-critical nature of communication with this device requires low-level hardware programming experience. It may also require dedicated microprocessor time. Thus, it is not recommended for casual programmers. Documentation not included. Request #1136 if instructions are required.

So all you have to do is when the "event" occurs in XBMC that you want, you send simple commands via RS-232 and make it happen.

Not bad for $20.

The caveat is that you'll need Windows or Linux, unless you can still buy RS-232 interfaces for Mac. (I'm sure you can, but it's less mainstream).

EDIT:

The InsteOn device that Rand Al Thor posted (http://www.smarthome.com/2412N/Smart...r-2412N/p.aspx) would be even better, as it appears to have a built-in web server. When the event that you are interested in occurs, your code submits a command to the device over HTTP and it happens. It's $120, though.
(This post was last modified: 2008-11-16 17:03 by waldo22.)
find quote
sicon99 Offline
Member
Posts: 67
Joined: Oct 2008
Reputation: 0
Post: #14
That defiantly has potential, Tongue i knew xbmc could some how be linked Tongue
find quote
nixterrimus Offline
Junior Member
Posts: 13
Joined: Oct 2008
Reputation: 0
Post: #15
Next semester, I'm not returning to my school as a full time student (although I will in the fall). During the spring semester, I'm pursuing web development and design. One of my professors in the Computer Science department said that I might be able to make my XBMC light dimming project an internship, provided I have someone to report to, clear well defined goals, and timelines. I'm willing to pursue lighting-XBMC integration beyond my limited goal (turning lights off when a movie starts), perhaps to the point where I approach a level of home automation. For all of this to work, I need a mentor, someone who has documented experience in XBMC or another prominent open source my project.

Here's how I see my project, there's three major soft components- the software that takes XBMC events and does something with them, the code that resides on the micro-controller, and the plugin that allows XBMC interfacing. The listening software I'm working on in Ruby. I'm working on developing a complete Ruby Gem for listening to and controlling XBMC. The micro-controller code is written in C for the arduino (although I do have some experience with assembly, if it comes to that). The plugin code would have be written in Python, I have no python experience, but I'm a quick learner.

Would anyone be willing to discuss being my mentor? If you are, drop me a line.

Nicholas Rowe
Nixterrimus at Gmail
find quote
Post Reply