Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: JSON commands to another App Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 885
Posted: June 02 2013 at 15:06 | IP Logged Quote GadgetGuy

I just recently upgraded my home security and control
system by replacing my prior security camera monitoring
system with software from Blue Iris. It easily
integrates into PH to feed alerts and images.

Blue Iris is running on the same server as PH. It
accepts a JSON HTTP-POST to its web server page "/json"
but I have not been able to figure out how to send such a
message from PH.

Since my home theater TV appears on a 10 foot screen, and
since the theater room is one monitored by my motion
detecting cameras, and since the TV Scene changes that
occur on the screen cause such rapid dramatic light
changes in the room they trigger "motion" alerts (even
though I have the screen itself masked off for motion
sensing) I'm thinking it would make a lot of sense to
disable the camera's motion sensing, while I am watching
TV.

Since PH controls the TV system, it knows when I am using
it, and it would thus be easy to disable/enable camera
motion detection IF I can send a . . .

camera:"Thtr"
motion: false/true

command.

The Blue Iris server is at 192.168.1.90:8080

How do I construct a PH macro to send these JSON commands
to Blue Iris?


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 719
Posted: June 03 2013 at 08:23 | IP Logged Quote smarty

I too use Blue Iris (for my IP cams... still use Geovision for analogue cams).

I have an approach that works well for me...maybe it will for you too.

My setup is a little diffeent in that BI and PH are on different machines.... Here is what I do:

When I arm my Elk system to "Away", I then send a command to BI that changes the camera's "motion tigger profile". Different profiles for home (no recording etc) or away (recording, motion alerts, text messages etc).

Here is the command I send from my PH machine to my BI machine:
ph_ssrequest("{CompNameHere}", 8500, "name", "password", "FORMULA", "ph_run('{BLUE IRIS COMMAND} profile=2 CameraNameHere')" )

Where '{BLUE IRIS COMMAND}' is   
c:\Program Files\Blue Iris 3\BICommand\bicommand.exe

FYI.... "bicommand.exe" is a nice little BI utility that allows 3rd party software to interact with BI. You can get it from the BI forum site.

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 885
Posted: June 03 2013 at 08:27 | IP Logged Quote GadgetGuy

Ahhhh! Smarty-

Thanks, big time. I look forward to getting that to go!

It has been so frustrating to end up with over a hundred
unneeded motion recordings every time I watch TV at night,
when the scene changes cause so much total room lighting
image variation that I get false triggers no matter how I
try to tune them out.

I'll let you know how it goes!

__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 885
Posted: June 03 2013 at 16:51 | IP Logged Quote GadgetGuy

Smarty-

I can't seem to get things to work.

This is my syntax . . .

ph_ssrequest("192.168.1.90", 8080, "keb", "00qazwsx",
"FORMULA", "ph_run(‘C:\Program Files (x86)\Blue Iris
3\bicommand.exe’ disable ThtrCam’)")

where 8080 is the port that Blue Iris is on.

When I attempt to 'verify' the command in the PH Macro
window I never get a return.

When I check the BI settings for the camera, it is still
enabled, when I expect it to be disabled.

Any ideas?

__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4384
Posted: June 03 2013 at 17:51 | IP Logged Quote dhoward

Ken,

One thing Smarty left out is that he would need to be running the PowerHome DCC on the machine that is running Blue Iris. This is what the ph_ssrequest formula is actually talking to. What the DCC then does is execute the ph_run function.

Since you've got Blue Iris and PH on the same machine, you wouldnt need the DCC or the ph_ssrequest. Essentially all you should need to do is the ph_run command like this:

ph_run("C:\Program Files (x86)\Blue Iris 3\bicommand.exe disable ThtrCam")

Smarty, correct me if Im mistaken .

Dave.


Edited by dhoward - June 03 2013 at 17:53
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 719
Posted: June 03 2013 at 18:26 | IP Logged Quote smarty

Dave is absolutely correct.....sorry about that Ken.

Not having to run DCC should make it a little cleaner for you.

Steve

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 885
Posted: June 03 2013 at 19:09 | IP Logged Quote GadgetGuy

Ah. Thanks guys!

I'm about to fire up my Theater 10' screen to watch TV and
if this works I c an save a 100+ unnecessary motion
captures. I'm let you know how it goes.

Muchas gracias.   

__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 885
Posted: June 03 2013 at 19:12 | IP Logged Quote GadgetGuy

Freakin' awesome!

It works.

__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 885
Posted: August 29 2013 at 07:46 | IP Logged Quote GadgetGuy

Thanks brihankwilles for the post -

I have been remiss in updating my original post here, as I have been successfully operating for some time using two utilities I wrote ...

a "jsonBI," along with a "findMyPhone" utility which I have posted in PH's downloads area.

The downloads include a Windows executable, raw VB .Net code and a Help Guide for each program.

Using the findMyPhone program along with PH Timed Events I check for my iPhone's presence on my LAN every 10 minutes. This is no easy feat as the iPhone is quite unique and resists detection unless you are a certified Apple developer and have access to Apple's servers which indirectly open a connection to a phone. After a month of effort, using a multitude of combined approaches that query the router arp cache, goose the phone with pings (no response but it brings it out of deep sleep), and socket communications (again no response, but if the phone is there and not deeply asleep it will accept the socket connection rather than ignore it) I have been able to reliably detect presence or absence of the phone.

Normal Smart phones can be simply pinged to detect their LAN presence, but the iPhone will not respond to pings unless it happens to be in an "unlock" state which only lasts for a few minutes from the last time used.

With Timed Events, I fire off a macro called findMyPhone-Snd which uses the PH_run() function to call my findMyPhone.exe.

I've added Dave's nifty Plugin called "PH_FileMon.ocx" which then Triggers when the findMyPhone utility writes its result file once the phone is found, or not.

That Trigger causes PH Macro "findMyPhone-Rcv" to run and call the "jsonBI.exe" utility I created to send commands to control that camera states, as desired.

For instance, if the phone is detected, I am home so the jsonBI call looks like to disable the Theater and Living Room cameras from recording. . .

Code:
ph_run("C:\powerhome\jsonBI.exe   login http://192.168.1.90:8080/json keb 00qazwsx; camconfig pause LivCam -1; camconfig pause ThtrCam -1")


The json Utility I've created can be located here . . .
jsonBI-v2.0.0.zip

The findMyPhone App is here . . .
www.power-home.com/forum/forum_posts.asp?TID=3282&PN=1&TPN=1

The jsonBI program is a work-in-progress as there are many json commands to be implemented and I am chewing my way thru the list, trying to get the most useful implemented, then going onto others. The download will always reflect the version release number and the Help Guide keeps track of the version releases and changes.

Dave's File Monitor plugin is also available here . . .
ph_FileMonitor.zip

I've updated the Help file from the original as config data has changed since then due to PH update releases.

Hope this helps.



Edited by GadgetGuy - September 01 2013 at 11:42


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
lizaoreo
Groupie
Groupie


Joined: February 11 2013
Location: United States
Online Status: Offline
Posts: 75
Posted: September 01 2013 at 09:43 | IP Logged Quote lizaoreo

It might be good to have a second copy or link that redirects to the latest that's always the same. That way you could point people to something like http://whatever/jsonBI and it'll always be the latest version. Then you don't have to worry about grabbing one from a link in a thread and it being an old version :)

Or, you could just put the links in your sig ;)
Back to Top View lizaoreo's Profile Search for other posts by lizaoreo
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 885
Posted: September 01 2013 at 11:45 | IP Logged Quote GadgetGuy

lizaoreo wrote:
It might be good to have a second copy
or link that redirects to the latest that's always the
same. That way you could point people to something like
http://whatever/jsonBI and it'll always be the latest
version. Then you don't have to worry about grabbing one
from a link in a thread and it being an old version :)

Or, you could just put the links in your sig ;)


Very good idea. I created a new post with the
findMyPhone and will also do so for the jsonBI
application.

I edited the entry several above to reflect this change.

Thanks for the idea.   


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum