Hub Variables in a string %%

Hi folks, I have setup a new Hub Variable that updates at intervals with different spa music that is shared via a local URL on a PI device on my network.

so for example the Variable GVrBathroomAudio is currently set to http://192.168.4.163/Media/SpaStringsWater.mp3
and updates throughout the day.

In Rule Manager 4.0 I was able to

  • Run Custom Action
  • Set actuator
  • Select Nest Device in Bathroom
  • Select custom command - playTrack
  • and then simply use %% around the variable name so in this instance it should be
  • %GVrBathroomAudio%, however that doesn't seem to work.

Is there another option that works with Hub Variables and RM5.0? So that I can put the dynamic variable into the string variable available in Rule Manager?

Thanks in advance, Alan.

You can still put a Hub Variable (or Local Variable) into any input field for a string, including a string parameter to a custom action, or the Play Track command for a music player device. It still uses %variable-name%.

Hi bravenel, it is just seeing it as clear text.

image

Hopefully those images upload ok. Can you see if I am doing something wrong?
I am selecting string and inputting %GVrBathroomAudio%

at which stage it then commits it with single quotes as if it is clear text.

Thanks for your help, Alan.

The substitution of the value occurs when the rule runs, not when you set it up.

Might operate differently than 4 as 4 would update as soon as you commit it.

But after just decommissioning my 4 rules and v5 isn't working.
Switching lights on fine, but audio track is still looking like it is referencing a clear text and not a variable.

Any ideas of what I might be missing here?

Thanks, Alan.

How do you know this?

The screen grab above.
In v4 it would like this below.

Now i know there might be something else going on in the backround, but the presentation layer would let you know what it was referencing. So note if I click in to edit this v4 it will show me the %Variable% name and not what it is presenting in this image.

This shows it quite well.

Do note this is v4 with global variables etc and the names are all different that what I am referencing in v5.

thanks.

OK, I see what you're talking about. I'll look into it.

Thanks.

Glad I didn't miss something. I was worried I was wasting your time and you would come back and tell me to enable something somewhere.

I'll just hard code it to get me going for now, and sure when you get a chance to look at it in the future that would be great as it is a handy function.

Thanks again, take care, Alan.

A little baby got thrown out with the wash. There was a method used in Rule-4.1 that did the variable lookup for that display. Removed in Rule 5.0 as most places it was used went away. I think that can be resurrected.

Like this:

I'll have to go through and find all of the contexts where this is applicable, and fix it.

If it is only visual then please don't go to that hassle just for me.

It didn't appear to work for me, but after hardcoding it and going back in to now change it to %VariableName% it is working a treat and calling the correct URL :smiley:

So please don't waste any more time on it, as it is working, just not sure why it was choking on me and not playing originally, I am sure i was doing something silly somewhere.

Thanks for all your help, Alan.

Haha, not a waste of time, and it's already done...

2 Likes

This issue has been fixed in latest release, 2.2.8.138.

2 Likes

Great job, thank you!

BTW, you don't need a Custom Action to do this. You can use a variable for track name in the Control Music Player action.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.