This object is in archive! 

Adding a value from a control to anHTTP Get request

Ian Hammond shared this question 7 years ago
Need Answer

I am trying to figure out how I pass the value from a virtual level control to an http get request.


My Yamaha MusicCast speakers can be passed URLs for control - for instance:


http://192.168.1.119/YamahaExtendedControl/v1/main/setVolume?volume=50


will set the volume to 50%


I have been able to set the rule for the power on/off and that works great, but I cant figure out how I take the variable from the level control and pass it to the Get URL in the HTTP request.


Can anyone point me in the right direction?

Replies (1)

photo
1

To insert parameters to HTTP requests or messages you need a PRO subscription. With that you can click "Insert" dropdown in HTTP request popup to parametrize request.

photo
2

Hi Tomasz

I have a PRO subscription but I am not sure how to insert the parameter.

I have created a virtual level control that goes from 0-100 and I need to add whatever value it is set to to the end of the http request. I can't find any tutorials or examples online.

photo
2

You create a rule with WHEN METER(virtual-control) >= 0


Inside when block you insert HTTP Request, you click "Configure HTTP Request" and in the popup you type URL and BODY. You can click "Insert parameters" and browse from your devices properties. Just find your virtual level and pick it's value in URL or BODY (depending on method of passing parameter to the service/device you want to control.

photo
1

Thanks for the reply but I still cant get it working.


The URL is:


http://192.168.16.119/YamahaExtendedControl/v1/main/setVolume?volume=XX


where XX is the number I need to insert from the virtual control level.


After inserting the parameter it looks like this:


http://192.168.16.119/YamahaExtendedControl/v1/main/setVolume?volume=${attributes.get("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "com.zipato.cluster.LevelControl", "value", "int")}


But it does not work. I also tried creating a variable. Setting the Variable to the value level of the control and then inserting the variable instead of the attribute directly - and that didnt work either.


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Verdana; -webkit-text-stroke: #000000}

span.s1 {font-kerning: none}

photo
Leave a Comment
 
Attach a file