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

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.

Like this:

Related

Posts navigation

133 comments on “Doorbell + IPcam + XBMC”

This is awesome but I’ve been trying for hours without success, I cant get this to work. Im running this on xbmc 12 on a mac and i get the message that say’s “doorbell TIME” but no image this is what my log file says, i hope you can help me.

I’m going to trust the logs and suggest whatever you’re getting is not a JPEG file. Have you tried hitting the URL manually, what does it present you with? I can help you test this if you want to open up your firewall to that cam temporarily.

@a1a2a – Were you able to get this working? I have RaspXBMC running throughout our house and would love to have a live image display on screen when motion is detected. Blue iris can serve the stream and can run a script or batch file if needed. Anyone else know how to accomplish this?
Awesome job on all this! I have been hoping for someone to figure out this type of integration.
Any help would be greatly appreciated! RaspXBMC runs XBMC version 12.

If you would like to increase the frames per second (makes it look more like a video) then decrease the amount of time the while loop sleeps by decreasing the value in the ‘xbmc.sleep(500)’ line. I decreased to 10, which leads to the popup box actually looking like a streaming video.

Is it possible to open a .strm file instead of a static image? I would love to be able to stream 10 seconds of video instead of just a static image. Would make a great security monitor/screen saver too.

It’s actually not a static image, it’s a stream of images. One frame per second, configurable. XBMC supports strm files but based on other forum posts i’ve read it will interrupt whatever is currently playing.

I have this as an upstart job on my Ubuntu server named ZoneMinderAlarm. In the “Do Your Stuff Here” section, I had it call a python script with the specific camera ID and Name, then pause for a bit instead of continually retriggering during the event:

Also consider uploading the code somewhere, or I could maintain it in my github repository and if you’re interested in helping maintain this and/or the xbmc plugin, I can give you access and that would be helpful to me.

I just created a similar post in the xbmc thread and it looks like the formatting is kept a bit better. You’re more than welcome to host these scripts in your github if you’d like, I don’t have any repository anywhere.

Thanks, got your script and that’s working exactly as described but I am trying to integrate with ZoneMinder and it is Tuff’s script I am interested in to pop up a particular camera when there is an alert.

I had some issues with the json call as well. I think there was a typo or a formatting issue using the command from above. It has smart quotes instead of plain quotes. I’m not sure if there was anything else.

I was able to use the following command (all on one line) from a shell prompt:
wget –user=xbmc –password=’xbmc’ ‘http://zbox-xbmc:8080/jsonrpc?request={“jsonrpc”: “2.0”, “method”:”Addons.ExecuteAddon”,”params”:{“addonid”:”script.doorbell”}}’

I am successfully using my Elk M1 security system to trigger my ISY/Insteon controller to make a http call to all of my XBMC boxes. It is using the following (same) parameters, minus the URL & credentials:
/jsonrpc?request={“jsonrpc”: “2.0”, “method”:”Addons.ExecuteAddon”,”params”:{“addonid”:”script.doorbell”}}

I have my camera mounted upside down so I had to modify the script using image.rotate, but it works very well. Next step will be multiple cameras at once using Manuel’s code from above.

Thanks for posting the logs instead of just begging for help like most people do 🙂

“Parse error” most certainly means that it’s an issue with quoting. Which is the issue with copying and pasting stuff like this from a browser. Go through you command and replace all “, ‘ and `’s manually. I can tell just by looking at your pasted line that it’s using the wrong characters for the quotes so xbmc doesn’t know how to parse that line properly.

You’ll have to write a script to handle this. My script won’t work as it was designed with X10. But you could simply hook your doorbell wires up to the pin, have a script monitor it. And then fire off requests when the button is pushed.

For email notifications, you’ll have to rip images off the camera, and then fire off an email about it. I will put my web/email code up sometime but I don’t have the time right now. There’s a lot of work involved like configuring postfix email from the command line, so if you aren’t familiar with linux you have to learn about that stuff first.

The XBMC trigger is simple, it’s been described in the comments on the post. And in the post itself.

wow, I’ve been searching and messing around with python scripts for days and stumbled upon this place, great work, I finally see the light.

I’m trying to get Manuel’s version of your script running on XBMC (v12) … I’m trying to get 4 IP cameras to show on the screen… I just cant get his script to work (I only copied and pasted it from here so im not sure if that even works)