Dynamic Refreshing Image URL

Posted on
Sat Jul 29, 2017 11:40 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

Re: Dynamic Refreshing Image URL

Different Computers wrote:
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.


The URL to my cameras seems tricky ! Cheap eBay items limited instructions. I can get to the web interface but can't see how I get a real URL link to the actual image . Thought it would be straightforward....

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

Re: Dynamic Refreshing Image URL

pocster wrote:
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 .....

I'm not following you. The logic should be to have a schedule where you set the variable value to different values. So offset by 10 seconds you would have different schedules (or a script) that sets the variable values to these different URLs (note cameraNum changing):

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

Image

Posted on
Sat Jul 29, 2017 1:23 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Dynamic Refreshing Image URL

pocster wrote:
The URL to my cameras seems tricky !


When you're looking at a cam in a web page (not some iOS app) can you right click on it to get the image address?

This is a challenge, but one I do my best to avoid by never buying a camera that requires a plugin to view, or that only works in the cloud, or that only works with an iOS/Android app. Unfortunately, manufacturers rarely say what their products *can't* do. They'll say "view on Mac OS/Windows" but don't mention it often means using some poorly made browser extension/plugin crap, which makes the direct image stream unreachable.

Did you check the Security Spy camera page for your make and model? Cams with diff models from the same maker often work the same.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Sat Jul 29, 2017 1:25 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Dynamic Refreshing Image URL

Duh. Instead of a schedule to rotate the images, I can create action groups and tap a button on screen to switch to the next image.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Sun Jul 30, 2017 12:04 pm
jphauck offline
Posts: 30
Joined: Oct 26, 2015
Location: Concord, CA

Re: Dynamic Refreshing Image URL

Different Computers wrote:
pocster wrote:
The URL to my cameras seems tricky !


When you're looking at a cam in a web page (not some iOS app) can you right click on it to get the image address?

This is a challenge, but one I do my best to avoid by never buying a camera that requires a plugin to view, or that only works in the cloud, or that only works with an iOS/Android app. Unfortunately, manufacturers rarely say what their products *can't* do. They'll sat "view on Mac OS/Windows" but don't mention it often means using some poorly made browser extension/plugin crap, which makes their direct image stream unreachable.

Did you check the Security Spy camera page for your make and model? Cams with diff models from the same maker often work the same.



Sent from my iPhone using Tapatalk

Jim H.
Concord, CA

Posted on
Mon Jul 31, 2017 3:00 pm
polycron offline
Posts: 100
Joined: Jan 08, 2006

Re: Dynamic Refreshing Image URL

Will there be any negative impact on the system if I have a schedule running every 10 seconds that runs an action group containing my Python script that changes the image?

The script is simply an if/elif/else on the indigo variable which sets it to the next image url. I went the route of a schedule firing off the action group because I have logic in the schedule item with a secondary Boolean variable so I can start/stop the rotation. If the schedule is not firing the event because the variable is false, I can still manually "step" the images one at a time by executing the action group manually.

I'm wondering if this is the most efficient way to do this? Also if having the schedule running every 10 seconds will cause too much overhead.

Jeff

Posted on
Mon Jul 31, 2017 8:23 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dynamic Refreshing Image URL

No, every 10 seconds shouldn't be a concern at all unless it's doing a huge amount of calculations.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 02, 2017 2:35 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

Re: Dynamic Refreshing Image URL

I've had some progress with both the dynamic URL and of course static for the camera images.

As I'm in 'testing' mode at the moment when cameras/router etc. etc. are not on event log gets filled with errors (as the ip camera's aren't powered).
Is there anyway to reduce these?; or better still trap them and perhaps on a control page put a message up saying' camera not ready or connected'.

Would be neater than the event log filling and actually slowing everything down.

Cheers

Posted on
Wed Aug 02, 2017 6:55 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: Dynamic Refreshing Image URL

Different Computers wrote:
Duh. Instead of a schedule to rotate the images, I can create action groups and tap a button on screen to switch to the next image.


Exactly what I was thinking. . I have yet to build my camera control panels as was confused by how others did it, but this sounds like a really nice simple way to do it. One image box and a series of buttons underneath to change the camera which means only one control page for a basic camera setup, rather than one page per camera?

Posted on
Wed Aug 02, 2017 7:23 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Dynamic Refreshing Image URL

Exactly! It's working well for me, though since it refreshes based on the settings of the Refreshing URL, the response in my testing is not as quick as I would like. But then I have to balance it against WAN throughput unless I create two pages, with one for LAN viewing and one for WAN viewing.

Damn CenturyLink's low speeds!

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Wed Aug 02, 2017 8:48 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dynamic Refreshing Image URL

pocster wrote:
Would be neater than the event log filling and actually slowing everything down.


Log entries don't slow anything down. I'll take a look to see where to catch errors though.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 02, 2017 8:53 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

Re: Dynamic Refreshing Image URL

Thanks jay

I'm on about plenty of log entries continually scrolling . On my i7 it cripples the speed whilst editing control pages . Though for now I've set a trigger that if camera unavailable change variable for refreshing URL to point to some other image . So then the http error 404 doesn't zoom into the log constantly. Seems to work a treat :-) . But trapping errors would be neat and a more elegant solution .

Cheers

Posted on
Wed Aug 02, 2017 9:42 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Dynamic Refreshing Image URL

Unfortunately, there isn't really a way to trap those without doing some serious work which I don't have time to do. Your workaround is the best scenario.

The source is there in the plugin if you want to take a shot at it...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Aug 22, 2017 7:51 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Dynamic Refreshing Image URL

@pocster, I'm very interested in how you're detecting if a camera is unavailable. I also notice the severe speed hit that all the failed camera errors cause--not just with editing control pages, but with the whole of Indigo slowing down.

Sure, it's not the log entries, I get that. But the failed fetch and managing the errors is clearly causing Indigo (especially on my Core 2 Duo) some grief.

That said, I REALLY love the functionality this plugin provides.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue Aug 22, 2017 7:55 am
pocster offline
User avatar
Posts: 276
Joined: Nov 15, 2014

Re: Dynamic Refreshing Image URL

Different Computers wrote:
@pocster, I'm very interested in how you're detecting if a camera is unavailable. I also notice the severe speed hit that all the failed camera errors cause--not just with editing control pages, but with the whole of Indigo slowing down.

Sure, it's not the log entries, I get that. But the failed fetch and managing the errors is clearly causing Indigo (especially on my Core 2 Duo) some grief.

That said, I REALLY love the functionality this plugin provides.


Hey!

Was real easy ! :D
I just set a trigger for each camera that if it's state changes and it becomes "disconnected" then it simply fills that global variable with a suitable link to an image.

Cheers

Who is online

Users browsing this forum: No registered users and 9 guests