2023.2 "Substitutions are now accepted"

Posted on
Tue Feb 06, 2024 1:31 pm
Different Computers offline
User avatar
Posts: 2556
Joined: Jan 02, 2016
Location: East Coast

2023.2 "Substitutions are now accepted"

The full text in the release notes for 2023.2 is "Substitutions are now accepted in refreshing image URLs in the Control Page editor."

I **THINK** this is something I've wanted for quite a while, but I'm unsure. Could someone point me to documentation for this new feature?

My hope is that a URL like this
Code: Select all
file:///Library/Application Support/Perceptive Automation/Indigo 2023.1/Web Assets/public/x/AlbumArt.jpg
can now be coded once and for all something like
Code: Select all
Path(indigo.server.getInstallFolderPath()) / "Web Assets" / "public"/"x"/target_image = "AlbumArt.jpg"


I'm 100% certain I've gotten the syntax wrong in the hoped for example, but something like that is what I'm hoping for.

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 Feb 06, 2024 2:35 pm
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: 2023.2 "Substitutions are now accepted"

Say you want to use a reference to a file located on your server machine. The URL to the file would look something like this:

Code: Select all
file:///Users/Dave/Temp/Figure.png
With a substitution -- in this case, the file name is stored within an Indigo variable -- the URL would look something like this:

Code: Select all
file:///Users/Dave/Temp/%%v:1547222515%%.png

So the substitution value %%v:1547222515%% is replaced with the value stored in the referenced variable: "Figure".

The feature is referenced on this wiki page. You can't add Python code to that field (which is what your example represents).

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Tue Feb 06, 2024 9:32 pm
Different Computers offline
User avatar
Posts: 2556
Joined: Jan 02, 2016
Location: East Coast

Re: 2023.2 "Substitutions are now accepted"

Thanks!

If I’ve got this right, I cold put the folder path in an indigo variable and substitute that—which would achieve what I want. Which is to not have to manually edit HTML paths in a bunch of different control pages.

Great!

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 Feb 07, 2024 6:54 am
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: 2023.2 "Substitutions are now accepted"

Good deal.

Just a reminder that any spaces in the path need to be escaped:

Code: Select all
/Library/Application\ Support/Perceptive\ Automation/Indigo\ 2023.2/Web\ Assets/static/my_image.png

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Apr 25, 2024 9:25 am
Different Computers offline
User avatar
Posts: 2556
Joined: Jan 02, 2016
Location: East Coast

Re: 2023.2 "Substitutions are now accepted"

Hmmmm. On first try, this didn't work.

My URL value in the control page is file:///%%v:9562464%%alert.jpg

When the variable value is /Library/Application\ Support/Perceptive\ Automation/Indigo\ 2023.2/Web\ Assets/public/ I get a file not found error.

When the variable value is copied straight from a "get info" and appears as /Library/Application Support/Perceptive Automation/Indigo 2023.2/Web Assets/public/ it works fine.

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
Thu Apr 25, 2024 9:39 am
Different Computers offline
User avatar
Posts: 2556
Joined: Jan 02, 2016
Location: East Coast

Re: 2023.2 "Substitutions are now accepted"

Oh and I'm getting
Code: Select all
Warning (client)                control page image URL contains a substitution: you will have to manually specify the image size for it to display correctly
now.

Manually specify where? in the URL?

Is there example of correct syntax for this?

Also, for situations where the image source may change in a refreshing URL, the actual resolution of the image can change too, since different cameras might have different resolutions. Now, I can massage that with python and PIL to make them all the same, but I'd prefer not to scale up a 1280x700 image from my worst camera to 2560x1920, the resolution of my best camera.

For clarity, my use case is I have an image in my public directory called "alert.jpg".

My camera system snaps a picture of anything unusual, and overwrites alert.jpg with whatever is new, from whatever camera caught it.

I have a control page that constantly displays alert.jpg as a refreshing 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
Thu Apr 25, 2024 1:19 pm
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: 2023.2 "Substitutions are now accepted"

Different Computers wrote:
Manually specify where? in the URL?


https://wiki.indigodomo.com/doku.php?id ... _image_url

Different Computers wrote:
for situations where the image source may change in a refreshing URL, the actual resolution of the image can change too, since different cameras might have different resolutions


You'll need to make sure your images are the same size. It's possible that a smaller image than what you specify would work (somewhat), but for consistency you should make sure the images are the same size. Note that this is nothing new - refreshing images have always been this way. Before, when we could actually get the image at edit time, we could figure out what it's size was and would automatically set those dimensions. But since we can't do it at edit time with substitutions, you have to specify it.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Apr 26, 2024 9:46 am
Different Computers offline
User avatar
Posts: 2556
Joined: Jan 02, 2016
Location: East Coast

Re: 2023.2 "Substitutions are now accepted"

I think I'm missing something here. Every single image placed in every one of my control pages has a specified size. How is it even possible to place a refreshing image without specifying the size? (Not that I want to.)

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
Fri Apr 26, 2024 10:33 am
jay (support) offline
Site Admin
User avatar
Posts: 18224
Joined: Mar 19, 2008
Location: Austin, Texas

Re: 2023.2 "Substitutions are now accepted"

Different Computers wrote:
I think I'm missing something here. Every single image placed in every one of my control pages has a specified size. How is it even possible to place a refreshing image without specifying the size? (Not that I want to.)


jay (support) wrote:
Before, when we could actually get the image at edit time, we could figure out what it's size was and would automatically set those dimensions. But since we can't do it at edit time with substitutions, you have to specify it.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Apr 26, 2024 1:53 pm
Different Computers offline
User avatar
Posts: 2556
Joined: Jan 02, 2016
Location: East Coast

Re: 2023.2 "Substitutions are now accepted"

jay (support) wrote:
Different Computers wrote:
I think I'm missing something here. Every single image placed in every one of my control pages has a specified size. How is it even possible to place a refreshing image without specifying the size? (Not that I want to.)


jay (support) wrote:
Before, when we could actually get the image at edit time, we could figure out what it's size was and would automatically set those dimensions. But since we can't do it at edit time with substitutions, you have to specify it.


Right, I get all this. But when I add an image to a control page, the size for the image is defined automatically in the window that you're showing in the documentation. What I'm asking is where/how do I specify the size otherwise--are are you saying that I need to make all the images the same size source files as the predefined blank refreshing image as set by the control page editor?

Let me try again.

I have a bunch of image files of various but known dimensions.

I have a bunch of control pages, with set display sizes for images.

Do I need to use PIL and such like to make the various image files match the set display sizes in order for them to display correctly? Or is there a way per control page to define the size of the actual image as opposed to the set size of the blank "Refreshing Image URL Image Size [ ] x [ ]"?

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.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests