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

Posted on
Thu Mar 09, 2017 11:58 pm
whmoorejr offline
User avatar
Posts: 276
Joined: Jan 15, 2013
Location: Houston, TX

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

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.

Posted on
Fri Mar 10, 2017 6:32 am
mat offline
Posts: 753
Joined: Nov 25, 2010
Location: Cambridgeshire - UK

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

can you run it as a shell script?

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

Late 2018 mini 10.14

Posted on
Fri Mar 10, 2017 9:34 am
whmoorejr offline
User avatar
Posts: 276
Joined: Jan 15, 2013
Location: Houston, TX

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

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. :-)

Posted on
Fri Mar 10, 2017 10:56 am
Different Computers offline
User avatar
Posts: 1903
Joined: Jan 02, 2016
Location: East Coast

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

Did you set permissions and executable on the shell script?

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Fri Mar 10, 2017 11:01 am
whmoorejr offline
User avatar
Posts: 276
Joined: Jan 15, 2013
Location: Houston, TX

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

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.

Posted on
Fri Mar 10, 2017 11:16 am
whmoorejr offline
User avatar
Posts: 276
Joined: Jan 15, 2013
Location: Houston, TX

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

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")

Posted on
Fri Mar 10, 2017 5:46 pm
jay (support) offline
Site Admin
User avatar
Posts: 15597
Joined: Mar 19, 2008
Location: Austin, Texas

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

Use the full path to the webkit2png command in either case and it should work (i.e. "/Users/you/path/to/webkit2png").

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Mar 12, 2017 2:14 pm
Different Computers offline
User avatar
Posts: 1903
Joined: Jan 02, 2016
Location: East Coast

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

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.

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Sun Mar 12, 2017 2:42 pm
Different Computers offline
User avatar
Posts: 1903
Joined: Jan 02, 2016
Location: East Coast

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

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.

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Sun Mar 12, 2017 3:13 pm
autolog offline
Posts: 2852
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT+1]

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

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 :)

Posted on
Sun Mar 12, 2017 8:51 pm
whmoorejr offline
User avatar
Posts: 276
Joined: Jan 15, 2013
Location: Houston, TX

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

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.

Posted on
Mon Mar 13, 2017 6:57 am
bkmar1192 offline
Posts: 274
Joined: Sep 12, 2015

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

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

Posted on
Mon Mar 13, 2017 7:43 am
Different Computers offline
User avatar
Posts: 1903
Joined: Jan 02, 2016
Location: East Coast

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

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!

SmartThings refugee, so happy to be on Indigo. 10.13.6 on an i5 MBP w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKit Bridge, MatplotLib, Plex, uniFAP, Wunderground, Nanoleaf, LED Simple Effects, Airfoil Pro, Grafana.

Posted on
Mon Mar 13, 2017 8:01 am
mat offline
Posts: 753
Joined: Nov 25, 2010
Location: Cambridgeshire - UK

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

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 :)

Late 2018 mini 10.14

Posted on
Mon Mar 13, 2017 12:39 pm
bkmar1192 offline
Posts: 274
Joined: Sep 12, 2015

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

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

Who is online

Users browsing this forum: No registered users and 0 guests