Dynamic Refreshing Image URL

Posted on
Fri Jul 28, 2017 10:39 am
jay (support) offline
Site Admin
User avatar
Posts: 14894
Joined: Mar 19, 2008
Location: Austin, Texas

Dynamic Refreshing Image URL

I've written a small IWS plugin that will allow users to have a Refreshing Image URL redirect to the URL specified in an Indigo variable (see the Library Contribution for installation details).

To use this in a Refreshing Image URL on a control page, you specify the url:

Code: Select all
http://USERNAME:PASSWORD@localhost:8176/variable_url_redirect/redirect?name=VARIABLENAME


You substitute the appropriate information for the words in ALLCAPS. The username and password are the username and password for your Indigo Server as you specified it in the Start Local Server... dialog. You pass in the variable name (not the id).

Note: this plugin will only work with http/https URLs (not file URLs for instance) and doesn't support authentication in the URL that's stored in the variable value.

If you changed the port for the Indigo Web Server you'll need to use your custom port number. The above should work for most people though.

Note that you can also do this from a browser just by hitting the URL above.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jul 28, 2017 11:25 am
Different Computers offline
User avatar
Posts: 1850
Joined: Jan 02, 2016
Location: East Coast

Re: Dynamic Refreshing Image URL

Holy moly!!

This is a big deal. Brand new? Jay you're the best. Glad I don't have a lot on my plate for this weekend so I can play with it.

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 Jul 28, 2017 12:33 pm
jay (support) offline
Site Admin
User avatar
Posts: 14894
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dynamic Refreshing Image URL

I should note that the downside is that your Indigo Server password is stored in the clear (in your Indigo DB) since you have to specify it on the URL, so it's a bit of a security risk. I believe we have a more secure way of doing it coming in v7.1.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jul 28, 2017 12:53 pm
RogueProeliator offline
User avatar
Posts: 2101
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Dynamic Refreshing Image URL

I believe we have a more secure way of doing it coming in v7.1.

Holy cow -- that was ALMOST an ETA post!

Posted on
Fri Jul 28, 2017 1:39 pm
pocster offline
User avatar
Posts: 217
Joined: Nov 15, 2014

Re: Dynamic Refreshing Image URL

I will try this . Assuming it works ; amazing ! . Thank you so much !!!!

Posted on
Fri Jul 28, 2017 2:34 pm
pocster offline
User avatar
Posts: 217
Joined: Nov 15, 2014

Re: Dynamic Refreshing Image URL

Struggling here.

Get error log :

http://localhost:8176/variable_url_redi ... MERA_IMAGE returned type text/html; charset=utf-8 (image required)

Variable CAMERA_IMAGE contains :
//Users/xxxxx/Desktop/video/Network camera/2017-07-28/28-07-2017 10-43-50 Network camera.jpg

So path to image is good........

Posted on
Fri Jul 28, 2017 2:57 pm
jay (support) offline
Site Admin
User avatar
Posts: 14894
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dynamic Refreshing Image URL

That's not a valid URL, but even if it was a valid file URL this plugin won't work with file URLS, only network URLs.

With files, though, it's quite easy to just switch out the file (or change a symlink).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jul 28, 2017 3:01 pm
pocster offline
User avatar
Posts: 217
Joined: Nov 15, 2014

Re: Dynamic Refreshing Image URL

Ok ! I'm confused and mis using this .
So how do I specify a local file in the variable ? Or am I just doing this wrong !? :-/

Posted on
Fri Jul 28, 2017 3:04 pm
jay (support) offline
Site Admin
User avatar
Posts: 14894
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dynamic Refreshing Image URL

As I said above, the plugin doesn't handle file URLs (URL's that point to local files on your disk). It only handles http/https URLs.

If you camera images are coming from a network source, then just insert that URL into the variable.

Otherwise, you'll need to write a script to swap out the image pointed to by the Refreshing Image URL (not using the plugin at all).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jul 28, 2017 6:54 pm
mat offline
Posts: 710
Joined: Nov 25, 2010
Location: Cambridgeshire - UK

Re: Dynamic Refreshing Image URL

Thanks jay, been playing with this earlier. Perfect timing

Late 2018 mini 10.14

Posted on
Sat Jul 29, 2017 6:57 am
pocster offline
User avatar
Posts: 217
Joined: Nov 15, 2014

Re: Dynamic Refreshing Image URL

OK!

I've got a bit further; but still somewhat confused.
I've set SecuritySpy to upload an image (Indigo and SS on same mac).

To access the refreshing URL in control pages I've tried (and many variations)

http://192.168.0.4:8000/image.jpg

But I get 404 - which is no file found.

SS has a server setup which seems recognised

So I guess I can't work out the correct URL for the image ...

Posted on
Sat Jul 29, 2017 9:52 am
jay (support) offline
Site Admin
User avatar
Posts: 14894
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dynamic Refreshing Image URL

I don't know anything about SecuritySpy, but I'd think they would have a separate URL for each camera. Maybe someone who uses it can chime in...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Jul 29, 2017 10:05 am
matt (support) offline
Site Admin
User avatar
Posts: 18747
Joined: Jan 27, 2003
Location: Texas

Re: Dynamic Refreshing Image URL

Instead of having SS upload an image, I'd suggest just directly accessing SS's built-in Web server. An example URL that you would stuff into the variable value would look like:

Code: Select all
http://ss_username:ss_password@192.168.0.4:8000/++image?cameraNum=1&width=320&height=240

(assuming you have authentication enabled on SS you can pass in the username/password as shown above)

Image

Posted on
Sat Jul 29, 2017 10:10 am
Different Computers offline
User avatar
Posts: 1850
Joined: Jan 02, 2016
Location: East Coast

Re: Dynamic Refreshing Image URL

Rather than try this and discover I misunderstand something, I thought I'd explain what I'm going to attempt and see if I have the right idea.

Install the plugin.
Create a variable called CurrentCam.
Get the URLs of my cameras on my LAN (though they could be from anywhere, I suppose.)
Create schedules that sets CurrentCam to the URL of each camera I want appearing on the Control Page I'll build. (Is there a better way to do this? Python scripting? I can't think of how to make one schedule rotate through changing variable values that aren't incrementing or decrementing.)
Create a Control Page that has a refreshing image URL of
Code: Select all
http://USERNAME:PASSWORD@localhost:8176/variable_url_redirect/redirect?name=CurrentCam

Enjoy my new rotating image.

And for other potential uses, questions: Could this be used for arbitrary valid URLs? If I inserted
Code: Select all
 http://forums.indigodomo.com/static/www/images/wordmark.png
as the variable value, would the refreshing image URL display it?

EDIT: I've got this working as above, but haven't tried to implement a schedule yet, as right now all I could figure would be to create a schedule for every cam that inserts its URL into the variable. Even so, this plugin is SUPER COOL.

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
Sat Jul 29, 2017 11:37 am
pocster offline
User avatar
Posts: 217
Joined: Nov 15, 2014

Re: Dynamic Refreshing Image URL

matt (support) wrote:
Instead of having SS upload an image, I'd suggest just directly accessing SS's built-in Web server. An example URL that you would stuff into the variable value would look like:

Code: Select all
http://ss_username:ss_password@192.168.0.4:8000/++image?cameraNum=1&width=320&height=240

(assuming you have authentication enabled on SS you can pass in the username/password as shown above)


Yeah that worked fine . But I wanted a rotating image of each camera view - which is where the issues seem to be . As I can't use a file as a variable for the URL that's why I use SS to upload an image ; my theory was I could get a URL to that . Sounds convoluted method - but was struggling .....

Who is online

Users browsing this forum: No registered users and 1 guest

cron