How to build a raspberry pi picture frame media pc

Happy PI Day!!!

A few years back… ok… like 9 years ago. I built an interesting piece of functional art in my living room. It was my media center pc, mounted in a double picture frame on my wall. This thing served me well for a long time. But now it’s time to upgrade it.

After all this time the ATOM board in there has gotten a little sluggish, the distro isn’t supported, the black lights have gone bad, I think there’s a demon in there. It’s legit struggling.

So how are we going to upgrade it now??!?

Oh good you, you have it under control…

Oh man… I thought you were gone…

You are not a meme…. Let me finish…

Where was I? Oh Yeah. What we are doing to upgrade… So here is the checklist.

  1. Replace old ATOM board with new raspberry pi
  2. Replace black light bulbs with RBG led strip.
  3. Add simple to use RF remote
  4. Flash PI with OSMC for a distro that will keep updated on a regular basis.
  5. Add wemos D1 Mini to control LED in frame lighting
  6. Flash wemos with WLED project for simple easy lighting control
  7. Add wemos to home automation system to turn on/off lights on schedule

Not a ton of work, but there is some work to be done.. So lets get to it!

Woo do work fool!!!

Not helpful…

Materials List

2 Ribba Picture frameshttps://amzn.to/30IWvE4
or
https://amzn.to/2OPuaco
Misc wire / perf boardhttps://amzn.to/3lfiWtS
RBG led striphttps://amzn.to/3rQ7gA8
Hingeshttps://amzn.to/2PXjx7P
1 3 port keystone wall platehttps://amzn.to/3vkwXuW
1 hdmi keystone jack pass throughhttps://amzn.to/2Owwmph
1 rj45 keystone jack pass throughhttps://amzn.to/3eyVgiH
1 keystone jack blankhttps://amzn.to/3tuqf3Z
1 5v 10amp power supply (barrel plug)https://amzn.to/30EYidj
1 barrel plughttps://amzn.to/3qMx6nw
1 usb adapterhttps://amzn.to/2PYoJbD
1 small pc fanhttps://amzn.to/3rOgOvw
1 raspberry pi 3/4pi3 – https://amzn.to/30FX7KH
pi4 – https://amzn.to/2OoklCy
1 usb cablehttps://amzn.to/3cx8ycP
1 wemos d1 minihttps://amzn.to/3qLjkl1
LED ribbon cablehttps://amzn.to/30JQ5EK
motherboard stand offshttps://amzn.to/3lh4phl
LED connectorshttps://amzn.to/3rHbfix
OSMC Remotehttps://osmc.tv/store/product/osmc-remote-control/

So, those picture frames don’t look like what you have….

Yes, I know, remember, I am upgrading from an older build. The goal of the picture frame is to be tall/wide enough to house your board and deep enough (why I suggest 2) that you can mount said board inside it with stand offs. The second important piece with the picture frames is to make sure that you have some matting to hide things behind.

How to create a wall mounted pi media player

Ok. So lets get started.

Lets take the 2 picture frames, and stack them, and add some hinges so we have a nice box to work with.

Take the 3 keystone plate and put the hdmi and network pass through it. Take the blank and drill out a hole to fit the barrel plug.

Arrange them however you best see fit. Now with a rotary tool cut around the keystone jacks so that what’s remaining can fit on the side of the frame. I cut around the existing screw holes so they could be reused to fasten to the frame.

As you can see from the first build you mount the board in the middle and start taking care of the wiring.

You take care of wiring.

*sigh*

Then add some lighting.

Here are few shots of the build back in the day.

So now, we move to the upgrades. We are removing the board and and replacing with a Raspberry Pi.

Upgrades to move to Raspberry Pi

Now since I have some LED strip, a wemos d1 and a raspberry pi to power, I am going to create a power distribution board.

Wire up our new LED strip instead of the old blacklights.

Ok. So now we have this beautiful beast all built out. Lets make it do a trick.

hehe… what kind of trick?

Are you 12? Seriously, what’s wrong with you?

Me? Im not the one talk to… you know what, nevermind. Continue.

Thank you.

So we have WLED installed on the Wemos D1 Mini. If you don’t know what WLED is, it is a beautifully written program for the d1 mini to do LED light control. HUGE shoutout to Aircookie for such a great piece of software! https://github.com/Aircoookie/WLED

Supports most LED light strip, but also give you some really awesome control over the LEDS. I have worked with it on some other projects including my neo-pixel LED christmas tree decoration I did this past christmas.

Aside from the really cool effects, the mobile apps (ios / android) but WLED also has support with tons of Home Automation Systems. I am currently using OpenHab so I will add a scheduled integration so it’s added as a “living room” light, in the group gLivingroomLights. This will automatically add it to the automation to turn on the LED’s with the rest of my living room lights which turn on 15 minutes after sunset each day. If we leave and turn off the lights, when we arrive back home, the lights automatically turn on when we pull in. The picture frame is now part of that. When it’s bedtime and the living room lights all turn off, so does the picture frame lights.

Since this is also a full color/dimmable type of light, it will automatically following follow the rest of the dimming controls for the livingroom lights, including integration into Kodi for the Cinema Vision home automation integration.

For Openhab you can integrate using the build in binding. Or via MQTT, http rest call.

For HomeAssistant you can integrate like this.

The Results

There we go. An upgraded picture frame art PC on the wall. We have added some nicely controlled LED lighting and have integrated in with the home automation system.

So what else does it do?

What do you mean what else does it do? It’s a Kodi Media player integrated in to plex with plexkodiconnect to sync everything up. It can play back all the media on the network, receive casted data and airplay.. what do you mean what else can it do?!

Yeah, what else can it do?

Home automation on screen notices and surveillance camera pop ups on motion?

Ok… that’s pretty good.

TLDR

18650 Battery capacity checker

Some of you know, I really like lithium ion batteries

*shocked*

Shut it!  This is a short post, I don’t need you hamming up the works.

Just wait till I show up in your videos….

You wouldn’t….

Hello….

Oh hell…..

Ok, lets not worry about that now.

I picked up a pretty sweet haul of batteries this week.

 

 

 

 

22lbs.  I counted 107 2cell packs.  214 cells to check out.  This is great, but I have a single opus charger that can do 4 cells at a time.

So 214 cells will take some time to process.  I have done that game.  So I wanted to do more cells.  There are examples online of doing this with arduino’s and what not and since I am big fan of arduino’s anyways I decided to give that a shot.  I built it out initially with an arduino uno.  Using the awesome guidance of Adam Welch.  If you don’t know who Adam is, you gotta check out his work.

Website: http://adamwelch.co.uk/ 
Youtube: https://www.youtube.com/channel/UCm5sG3-BXQZfVy3st2T_XKg

His work I used for this is here.

I modified the code a little as I didn’t have that screen.  I have a 20×4 screen.  I also updated mine to calculate the voltage reference from the internal 1.1v reference.


/*
* Battery Capacity Checker
* Uses Nokia 5110 Display
* Uses 1 Ohm power resister as shunt - Load can be any suitable resister or lamp
*
* YouTube Video: https://www.youtube.com/embed/qtws6VSIoYk
*
* http://AdamWelch.Uk
*
* Required Library - LCD5110_Graph.h - http://www.rinkydinkelectronics.com/library.php?id=47
*/

#include <LiquidCrystal_I2C.h>
#define gatePin 2
#define highPin A0
#define lowPin A1

boolean finished = false;
int interval = 5000; //Interval (ms) between measurements

float mAh = 0.0;
float shuntRes = 1.0; // In Ohms - Shunt resistor resistance

float current = 0.0;
float battVolt = 0.0;
float shuntVolt = 0.0;
float battLow = 2.9;

LiquidCrystal_I2C lcd(0x27,20,4);
unsigned long previousMillis = 0;
unsigned long millisPassed = 0;

void setup() {
analogReference(INTERNAL);
Serial.begin(115200);
lcd.init(); //initialize the lcd
lcd.backlight(); //open the backlight
Serial.println("Battery Capacity Checker v1.1");
Serial.println("battVolt current mAh");

pinMode(gatePin, OUTPUT);
digitalWrite(gatePin, LOW);

lcd.setContrast(68);

lcd.clear();

lcd.print("Battery");
lcd.print("Check");
lcd.print("Please Wait");
lcd.print("AdamWelch.Uk");

delay(2000);
lcd.clear();
}

void loop() {
voltRef = readVcc() / 1024.0;
Serial.print("Volt Ref: ");
Serial.println(voltRef);
battVolt = analogRead(highPin) * voltRef / 1024.0;
Serial.print("Batt Vol: ");
Serial.println(battVolt);

shuntVolt = analogRead(lowPin) * voltRef / 1024.0;
Serial.print("Shunt Val: ");
Serial.println(shuntVolt);
Serial.println();
Serial.println();
/*
Serial.print(battVolt);
Serial.print("\t");
Serial.print(current);
Serial.print("\t");
Serial.println(mAh);
*/
if(battVolt >= battLow && finished == false)
{
digitalWrite(gatePin, HIGH);
millisPassed = millis() - previousMillis;
current = (battVolt - shuntVolt) / shuntRes;
mAh = mAh + (current * 1000.0) * (millisPassed / 3600000.0);
previousMillis = millis();

lcd.setCursor(0,0);
lcd.print("Discharge ");
lcd.setCursor(0,1);
lcd.print("Volt:");
lcd.print(battVolt);
lcd.print("v ");
lcd.setCursor(0,2);
lcd.print("Current:");
lcd.print(current);
lcd.print("a ");
lcd.setCursor(0,3);
lcd.print(mAh);
lcd.print("mAh ");
lcd.print("Running ");



}
if(battVolt < battLow)
{
digitalWrite(gatePin, LOW);

finished = true;



lcd.clear();
lcd.print("Discharge");
lcd.print("Voltage:");
lcd.print(battVolt);
lcd.print("v");

lcd.print(mAh);
lcd.print("mAh");
lcd.setCursor(0,1);
lcd.print("Complete");


}
delay(interval);
}

long readVcc() {
long result;
// Read 1.1V reference against AVcc
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
result = 1126400L / result; // Back-calculate AVcc in mV
return result;
}

Next step is to add a “charging” function with a tp4056 so I can charge then discharge.

 

Amazon – 5 for 6.95

Ebay – 10 for 4.95

Aliexpress – 10 < 2 bucks.

 

Once that is working I should be able to add a couple more modules.  I have been really looking towards doing something with Brett Wattys 8 module charger.  That things is INTENSE!!!

If you want to see all the info check out the secondlifestorage forum.

https://secondlifestorage.com/t-Brett-s-Arduino-8x-Smart-Charger-Discharger

He also has a portal he is setting up to help aggregate some numbers on how many cells the community has recycled.

 

 

Until later!!!

bye!!!!

Let’s learn #fusion360 with the #dailyfusion360 challenge

What:

So as you have probably seen my fusion360 skills are ….. lacking.

No $%^^&*

So here is the plan.  Pick a time frame.   1 week, 2 weeks, 1 month.  ect

8 minutes

Will you stop it.  We are trying to help people here!

So once you pick your time frame.  The goal is to design something in Fusion 360 each day.  Doesn’t have to be anything big, doesn’t have to be for printing.  Just to get practice in 360.  Take a screenshot, upload it whatever.  Just post it on the social platforms.  Hash tag it with #dailyfusion360.  Let the rest of the communities see what you are working on.

First Attempt at Christmas Light Show! (part 1)

A while back a co-worker hit me up over the weekend and said “hey! I found this thing you want it?!?”

Once finding out what “it” was I said sure..

Haha.. you know what “it” was, and you wanted it.

Really?  That’s how we are going to start this?

After getting through hurricane irma and halloween season I was able to start looking into this a little more.

It’s this!  A Light-o-Rama 16 channel light sequencer.

 

 

 

 

 

 

 

 

 

 

 

 

 

So it came with software and everything right?  Worked out of the box?  Sweet

Why?  Seriously…

No, it did not come with software.

 

 

But I was able to do some digging and figured out it will work with an RS485 to RJ45 serial connection and using the DMX protocol.

 

 

DMX protocol?  That ^&*% sounds scary.

For once Im gonna agree with you.  Not sure what his “protocol” is but I agree.

So anyways.  I hook it up and …. nothing.  No signal.  Hmmmm.

Time to hit the forums!  www.doityourselfchristmas.com to the rescue.  I found a post that mentioned that LOR (light-o-rama) decided to swap 2 pins.

That’s some dumb shit stuff there..

I know.  But that got it working.  So I have my laptop able to turn some christmas lights on and off via a testing app.  Cool.  But not cool enough.

Next step fool!

So we need to sequence this thing.

 

 

 

 

 

 

 

 

Different kind of sequence.  Time for Vixen3!!

No! Vixen 3!!!

 

 

Are you for real with this?

Sorry, Christmas.  I forgot.

Thank you.

 

 

 

 

*smh*

 

Anyways.  Vixen 3 is a nice piece of software for doing light sequencing to music.   So I start playing with that and get a few little tests together and run it from my laptop and the LIGHTS ARE WORKING!!!

Enter the raspberry pi!

Ok tons of fun haven’t you had enough pie?

Not that…. it’s a…. shut up.

So with a RASPBERRY PI COMPUTER!!! I load up an image for something called “falcon pi player“.  Configure up my connection to the LOR and click the “test” check box.  ALL THE LIGHTS TURN ON!!!!!  Awesome.  We are SO CLOSE.  So export the sequence from Vixen 3 and upload all the assets (sequence file, media) and create a playlist.  Now lets run it!

Oh man… it’s working.  This is too cool.

I drove past your house, you don’t have any lights up yet.

*deep breath*  Ignore him, he doesn’t exist.

You don’t exist.

You are right.  My lights aren’t up.  But I got everything working and even created a preview!

So next step is the wife has started putting up some lights and we should finish over the weekend!!

Good Vibes!!!

So… I have a “friend” that asked if I could help with something.

 

She had something called an OhMiBod.  It’s a …. um… it’s a vibrator.

HAHAHAHA

Super mature.  Anyway.  She has this thing called an OhMiBod Club Vibe.  It’s supposed to vibrate to your music  Looks like this.

HAHAHAHAHAHA

Pervert

Dude really?  ANYWAY!

So apparently she prefers to crank her music from her phone to said vibe.  But apparently this thing is when you crank the volume, the primary function of this thing (vibrating to the music) all but disappears and it’s just “on.”  So I was asked to fix it.

I bet you fixed it.  Haha

Don’t you have somewhere to be?

So.  I decided to see if I could knock back the levels on the audio.  I remembered a tutorial I saw once on how to make an attenuator for video to create a safety track on one of the channels.

Really?  Safety Dance?

So I built out a quick little voltage divider.  Started with a 150 ohm and a 1k ohm.  It helped but it got better once I went down to a 150 ohm and a 220 ohm.

Hehe

*sigh*

So I tested everything out using the breadboard and alligator clips.

Nipple clips..

DUDE!

So now it’s time to tighten everything up

….

NO!  Before this guy completely implodes here.

I took a dead marker out of the craft bin and cut it apart.  Put a piece on each side of the attenuator and soldered it up and have a male and a female 3.5mm jack on each side.

Shut it…

 

 

 

 

 

 

 

 

 

 

 

Once it was all soldered up, I hot glued the pieces together and wrapped some tape around the one end to give the shrink wrap something to hold on to.

 

 

 

 

 

 

 

 

Now lets throw some shrink tube on it and make it nice and neat.

So I gave it to her and from what I “hear” it’s getting the job done.

And I’m the perv… 

So in all seriousness.  This was actually interesting.  I have never hacked part of someone’s sex life before but this was interesting.  Not my normal stuff, but hey, glad I could help.

You lended a helping hand..

I’m done.

PS.  Is a hackgasm a thing?

Progress on the green sprinkler system project!

I have made some progress on the green sprinkler system project.   I even shot some video recently!!!

 

Here is some testing of the water quality…. WHO PEED IN MY BARREL!!

 

Now for the big update!!! Built a battery from recycled 18650 laptop cells.  Hooked it to my pump.  Drained my rain barrel!!  Then charged the battery back up via solar!!!

Man I am feeling kind of green!

Like this guy?

Oh and I am the one that peed in your barrel

Oh %^&* you’re back too huh.

You do realize I am you, you are me right?

Man I had a long night last night.  Don’t do that deep %^&* on me.

Ok Ok.  Check out his (my video)

Rain Barrel Growth Check!

My last barrel was the white kind and it did not do well at keeping light out so there was a swamp monster in it when I checked it.  Glad I wasn’t using it for anything, that water was gross.

 

I switched over to these blue barrel’s in hopes it would be better.

Got a cool endoscope camera from amazon

Amazon

With this camera I figured…. where can i put this….

STOP THAT!!!!

 

 

 

 

Check out my youtube channel for other project videos!!

Cranky Coder Youtube

 

NO!!! I want to print more!!!! or Offloading octoprint timelapse videos

octo

I use octoprint to manage my printer.  When I can, I batch print.  I will literally print things back to back. But I also love the timelapse and we have all seen it….warning

 

But I have more robot stuff to print!!!!

Settle down there smart guy.

Nobody asked you!

Ok, interruptions aside.  Running octoprint on an original pi is a little slow.

Did you say apple pi?

captain-picard-facepalmI don’t like this guy.

I said ORIGINAL pi.  Yes, old school slow.

So what happens if you try to print again while it’s rending a timelapse… well, you get a lot of stalls on the print, meaning the head sits over the print causing some unnecessary melting.

So how do you fix it if you are so smart?

Well, you would offload it.  I have a linux box that handles all sorts of random tasks.  It could do it.

So here is how I offload it.

  1.  setup an NFS share to a nas/other server
    &nbsp;192.168.X.XX:/mnt/vol/dataset1 /home/pi/fs nfs nouser,atime,auto,rw,dev,exec,suid 0 &nbsp; 0 
  2. Configure octoprint to store the timelapse pics on this NFS share.paths
  3. All that is doing is changing the location of the timelapse, not offloading jerk.
    I KNOW!!!  I’m not done!
    Sorry
    So now we need to setup the exact same share on the other linux box.  If I had thought about it early on I would have changed the path on the pi to be something like /media/share/ instead of /home/pi/fs
    So we put the same path on the other linux box.
    (see 2.)
  4. Now the fun stuff.
    Finally!
    I created a small shell script on the PI.

    #!/bin/bash
    ssh root@192.168.X.X "ffmpeg $@"
    if [ $? -eq 0 ]
    then
    # everything was good
    exit 0
    else
    exit 1
    fi
    
  5. Set up your pi to be able to login with no password (using keys instead) so that the ssh connection will not hold anything up.
  6. Configure octoprint to use this new script as your ffmpeg path.
    2016-11-07-19_03_42-octoprint

So let me walk you though it.

Good idea.

Are you being nice all of the sudden?

No.

Anyway.  So octoprint is now setup to store your timelapse images on the network somewhere.  Linux box is setup to have the exact same path.  When your print is done octoprint executes the timelapse.sh script thinking that is ffmpeg.  So it runs it waiting for it to exit with a success or failure.  So in the script, we ssh to the linux box, tell it to run the ffmpeg with the $@ which means everything octoprint wanted to pass to ffmpeg locally we are passing to the remote ffmpeg.  The other box does all the heavy lifting and returns an exit code, we pass that exit code back to octoprint.  It’s none the wiser.

The cpu is next to nothing because we are just waiting for the ssh command to finish.  So I have started additional prints with minimal issues.

I have noticed that if you keep your filenames short and sweet it helps.

Is this a great solution or what?

No.  Buy a better pie.

Don’t you mean a “pi?”  Haha.  Jerk.

pievpi

Time lapse in new printer enclosure

surprised-rainbow-face

So awhile back I came across an instructables article regarding using some ikea lack tables to make a 3dprinter enclosure…..

I love ikea….

So this was the project.  http://www.instructables.com/id/3d-Printer-Enclosure-from-Upcycled-Furniture/

I went to ikea.  Got 2 lack tables and put them together…. I want my printer higher up.  ELEVATE TO THE LEVEL OF THE GODS!!! no.  just high enough I can watch it cause I like to watch it go back and forth while I make printer noises.

So I ordered a 3rd table.  Put it on top.  Sweet.  Much better.  I moved the printer into the enclosure this weekend (no sides put on it yet) and decided I needed to get the lighting in place.  So I took some neopixel strips I had laying around and hooked them up to an arduino.

13694706_1455593267790887_1215760066_nOk, so that’s now how I am leaving it 🙂  but it did look cool.   Now I can set the colors.  Plain white for printing.  I am trying to figure out how in octoprint to get a hook in to detect when it’s heating up.  That way I can turn the lights orange or red to indicate heating phase.

 

 

So I did a timelapse and a vid.   The vid of the whole rig setup

Here is the timelapse test print

 

I am working more on trying to get some good photo and video in with these projects too.  If you like the videos give a thumbs up and a subscribe.

Who’s That? What’s That? CCTV setup

Hello Hello again.   Recently I was chiming in on a thread on reddit regarding CCTV.  I mentioned how my cameras/cctv is setup.  Then I thought.

light-bulb-moment

Hey, you know would like to know this?

EVERYONE!!!!

 

 

Really.  Conversation totally happened in my head.  Told you Doctors it’s not too crowded up there.

Let’s begin!!

This all really started because of my 3dprinter…..

“How…. Huh…. But you…..”  I hear you saying it.  It makes no sense.  But Ill fix that little red wagon.

Aerial_Vista_Security_Camera_preview_featuredI love searching around on thingiverse.com it’s actually part of my daily sites to check.   So I came across this thing.   It’s a security enclosure for a raspberry pi and pi camera… WHAT?!?!?!

I know.  I thought the same thing.  I need that…..   So I started printing the parts.

2016-03-18 07.09.022016-03-18 07.48.26

Once I had it printed, I threw in my pi camera (NOIR).  The NOIR made it even better for being a security camera.  Ok, so cool.  How about software?

I was looking for some super simple camera software as there are tons of “security” camera projects out there for the pi.  I came across this one “MotionEyeOS.”   58732063Being built off the program Motion I decided to get in and test it out.  Flash the SD card and boot it up, gets an IP.   I just checked my dhcp leases on the router to find the ip, then gave it a static IP.

 

Once you have the IP just throw that ish in the browser!!  Configure your network settings ect.  But in the expert settings there is a switch.  Turn it on.

 

No seriously.  Turn it on.

2016-06-16 15_38_25-iseeall.noip.me - Remote Desktop Connection Manager v2.7

Yes I know.  The fast network camera page on the wiki looks like it kills alot of stuff.

 

The Differences

When you have Fast Network Camera enabled, you’ll notice that:

  • your motionEyeOS-based camera can reach a significantly higher frame rate, at a higher resolution
  • you can tweak many CSI camera-specific parameters directly from the UI
  • your browser will eat up less CPU at the same frame rate/resolution (it uses a pure MJPEG stream, rather than triggering every refresh from JavaScript)

On the other hand, this doesn’t come without some disadvantages:

  • no more motion detection
  • no more motion notifications
  • no more pictures or movies
  • no more overlaid text (date/time, camera name)
  • a significantly higher network bandwidth usage
  • you’ll need to forward port 8081 as well, if you want to access your camera from the Internet

 

No motion detection!?!?!   Are you crazy that’s why I am even reading this stupid page!!!!!!

 

EcstaticTightBuckeyebutterfly-size_restrictedCalm down.   Please calm down.  Can you even use that as a weapon?!?!   

Just let me finish before you use that thing!!!

So you enable fast network camera.  This lets you get some faster higher quality out of the camera.  Now here is the fun part.

I setup a VM of ubuntu and installed MotionEye.  Not MotionEyeOS but MotionEye.

BeQZIS7CEAAemgwOnce you have it running hit your motioneye server (http://<motioneyeserverip:8765)  and you will get another nice web interface.

In here, you will add a new camera, and set it up to point to your raspberry pi camera.

camsettingNow what is really cool here is you can setup a few cameras.  When I first set it up, I had 1 camera and then I found 9 traffic cameras and marina cams and what not from places all over the world and was able to plug them in.  Truly felt like a super villain being able to see everything!

Now that you have your cameras in motioneye we can now use the motion eye server to handle our motion detection.  See, I told you I would get there.

There are some cool setting here that you can do.  For example:

settings1

settings2

 

 

 

 

 

 

  • I have my video streaming setup so I can embed individual streams if I want into a web page, maybe a security camera sitemap page in openhab?
  • I have still images setup and capture when motion is detected.
  • I have Motion Detection configured that more than 5% of the frame has to change.
  • Then the fun part in Motion Notifications

I have a script configured on motion detection.


/usr/bin/notifycam.sh %t


This script is very simple.  It has 2 lines currently.  I honestly could knock it down to one.   Or I could add some additional code to handle different items for each camera.  The %t just passes in the camera ID.
57448311Ill go over that in a minute…. I SAID IN A MINUTE!!!!!!

On my Kodi media system in my office I installed this great add in called

Security Camera Overlay

It’s a very interesting add in.  You configure it for your security camera.  Well, I have mine connected to motioneye.

2016-06-16 20_46_26-ubuntudev1In MotionEye if you click on the Streaming Video there is a link in there called “Snapshot URL”

2016-06-16 20_48_34-KodiGrab that, you will need it to configure your Kodi system.

Put that snapshot URL in the Image URL field when configuring your add on.

 

 

 

 

2016-06-16 20_48_22-KodiOn the Behaviors tab, if your camera supports 16×9 I definitely recommend changing the Window width/height.  I have it refresh every half second and auto close after 4 seconds.

 

 

2016-06-16 20_37_41-KodiSo what does this look like?  LIKE THIS FOOL!!!!

It pops up right over Bob’s Burgers!!! refreshes a few times, let’s me see what’s going on and slides right back off.

 

Back to the script


/usr/bin/curl -g "http://xx.xx.xx.xx:8080/jsonrpc?request={%22jsonrpc%22:%222.0%22,%22method%22:%22Addons.ExecuteAddon%22,%22params%22:{%22addonid%22:%22script.securitycam%22},%22id%22:%221%22})"
/usr/bin/curl --header "Content-Type: text/plain" --request POST --data "ON" http://xx.xx.xx.xx:8080/rest/items/PorchMotionDetected

Explanation:

Line1: sends a json packet to my Kodi install in my office telling activating the great addon Security Camera Overlay.  This makes it slide over whatever you are watching.

Line2: sends a “motion detected” packet to openhab.  In my openhab Items file there is a simple switch I can add all my rules around.

downloadIn writing this I learned something today.  I am going to make a couple modifications in the future.

The notifycam.sh file will be adjusted down to 1 line.

It will just make the call to openhab.

But it will look something like

<pre>/usr/bin/curl --header "Content-Type: text/plain" --request POST --data "ON" http://xx.xx.xx.xx:8080/rest/items/CameraMotion%1

That way I don’t have to recode the script when I add a camera. I just need to add a new item CameraMotion<ID> to openhab.

Then I can add all the camera’s to a gSecurityCam group and build some rules around state change in that group. Then openhab can send out the notifcations to pop up the stuff on my kodi and any other kodi system I wish, as well as send me notices through other openhab notifcations.

I hope this was long enough for you…