Page 1 of 2

Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Thu Mar 09, 2017 11:58 pm
by whmoorejr
My goal is to have a control page within a control page.

I think I'm about 80% of the way to a solution.

I found a command line tool that creates a screen grab of a URL called webkit2png
www.paulhammond.org/webkit2png

After installing it.... from the terminal I can enter:

webkit2png -T http://10.0.6.10:8176/controlpage?name=ISLFloorPlanLS/ -D Desktop -s .5 -0 ISL

This saves one of my control pages as a PNG file on my desktop. I want to somehow get Indigo to execute the terminal command (via trigger) then I can use the file location URL of the saved .png file as a refreshing image in another control page. (control page within a control page)

Maybe someone with a bigger brain than me can turn something like this into a plugin?

Any help would be awesome.

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Fri Mar 10, 2017 6:32 am
by mat
can you run it as a shell script?

trigger -> trigger action -> script and file action -> run shell script

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Fri Mar 10, 2017 9:34 am
by whmoorejr
Ugh... I'm missing something.

Put the text
Code: Select all
webkit2png -T http://10.0.6.10:8176/controlpage?name=ISLFloorPlanLS -D Desktop -s .5 -0 ISL


into a document and saved as "GrabISL.sh"

dropped that into a Run Shell Script Action.... Indigo Log, "Can't find GrabISL.sh"

Ok... need some (#!) stuff at the top...

added to the top of the previous text...
Code: Select all
#!/bin/bash


Then R-Click on my script, always open with terminal

When I double click the script, it does what I want it to do and saves a .PNG of a control page on my desktop.

Now in indigo, the log say's the action ran, but there is no result.

Created a variable to get result to see what's happening and it says (in the variable) Fetching http://10.0..... etc.

I think I'm at about 90% now. :-)

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Fri Mar 10, 2017 10:56 am
by Different Computers
Did you set permissions and executable on the shell script?

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Fri Mar 10, 2017 11:01 am
by whmoorejr
I think so?

Get properties and turn the lock to unlock and enter password.

in terminal, chmod u+x GrabISL.sh

then r-click on GrabISL.sh, always open with terminal.

I think that's it.

Does it matter where the file is located? Right now it is in Users/williammoore/bin

When it comes to scripting, I'm basically a potato.

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Fri Mar 10, 2017 11:16 am
by whmoorejr
Tried a different approach using an embedded python script.... but that didn't work. Here is an example of my awesome python script. :roll:

Code: Select all
import os
os.system("webkit2png -T http://10.0.6.10:8176/controlpage?name=ISLFloorPlanLS -D Desktop -s .5 -o ISL")

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Fri Mar 10, 2017 5:46 pm
by jay (support)
Use the full path to the webkit2png command in either case and it should work (i.e. "/Users/you/path/to/webkit2png").

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Sun Mar 12, 2017 2:14 pm
by Different Computers
I'm considering ways this technique might do fun things for my setup. It has me wondering why you would want a pic of a control page on a control page. Why not just put all the elements you want from the first on the second?

First thing I thought of was to import some dynamic data that can't be easily grabbed as an image--like the main page from http://darksky.net, or maybe some DOT highway webcam feeds.

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Sun Mar 12, 2017 2:42 pm
by Different Computers
OK, I apologize for the thread derailment, but this seems like the place to ask:

When I try
Code: Select all
/usr/local/Cellar/webkit2png https://darksky.net/forecast/location/en

I get
Code: Select all
-bash: /usr/local/Cellar/webkit2png: is a directory


and any google-able answer involves frightening-seeming additions or changes to my PATH, the various options of which I am not competent to evaluate. This will only be a problem when I try to script it, because just trying the command without the path from the command line works.

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Sun Mar 12, 2017 3:13 pm
by autolog
If it is telling you it is a directory, then it probably is. :wink:

Check this post out for the full path: viewtopic.php?p=136381#p136381 :)

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Sun Mar 12, 2017 8:51 pm
by whmoorejr
Different Computers wrote:
why you would want a pic of a control page on a control page. Why not just put all the elements you want from the first on the second?


For something where real-estate is a premium... like iPads. I have a few around the house and I want the most important information to come to me... not for me to go find it. A map of the house is a great way to cover most devices. A couple of the icons will open up other menus (like temperature on the main screen..... clicking on the temp goes to a climate control screen).

An iPad is too small to have all that info plus have a picture from my door cam pop-up if there is motion at my front patio or if the doorbell rings. So, this way the iPad main screen is dedicated to information... not control.

That works alright because most everyday stuff I control via Alexia, not the iPad. I look at it to see if the kids lights are still on, if I left the garage door open, etc. That's why an image of that control page is sufficient.

With the dynamic feature.... front motion detected or door bell rings and the iPad screen goes to a full screen of that camera to show the image that caught the motion. When there is no motion, it goes back to a screen of the other control page. If I want to control stuff with that control page, clicking on the image loads the actual control page so I can interact. I may have to re-evaluate once my two year old learns how to pronounce "Alexia".

I could see this being useful if you wanted to have a display that rotated through control pages. Since you can't programmatically tell an iPad to keep changing pages or set up triggers to send a control page to a device.... this works.

I can also see a use for this for displaying web site data on an indigo page.... like a screen shot of a google calendar, or traffic information, etc... You could have an action button that would call up that image.

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Mon Mar 13, 2017 6:57 am
by bkmar1192
I have not tried this but in theory my camera plugin should work with any URL - including a local URL. However, it does require an http path.

So you should be able to have a "camera" that displays a refreshing image of your control page.


Sent from my iPhone using Tapatalk

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Mon Mar 13, 2017 7:43 am
by Different Computers
I have not tried this but in theory my camera plugin should work with any URL - including a local URL. However, it does require an http path.


bkmar, you read my mind! I was just thinking last night about how I could get some computer-connected webcams to be part of the Security Camera set up. Awesome!

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Mon Mar 13, 2017 8:01 am
by mat
I look at it to see if the kids lights are still on, if I left the garage door open, etc. That's why an image of that control page is sufficient.


You've sold me on the concept. I like the idea of monitoring the house and changing the way the ipad is used. I'll have a look at this when I get back from my trip away!

Thanks :)

Re: Dynamic Control Page... about 80% there.... webkit2png

PostPosted: Mon Mar 13, 2017 12:39 pm
by bkmar1192
Ok - so here is a real crazy idea. By combining the security camera plugin, the dynamic control camera plug, and the correct layering of different images, you could come really close to doing what you want and have the controls functioning. Text labels would be the only difficult part.

Might need to make some updates to Dynamic Control and Security Camera.


Sent from my iPhone using Tapatalk