Author Topic: Passing parameters to events  (Read 1693 times)

0 Members and 2 Guests are viewing this topic.

shanekuz

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
    • View Profile
Passing parameters to events
« on: September 21, 2015, 12:59:48 AM »
Can anyone help me with this please?  I am calling a URL on to Voxcommander like this :

http://192.168.31.180:80/api/VC.TriggerEvent&&FAMILYLIGHTSON&&${intensity.percent}

to turn on my lights.

I can see in the logs that the percent is being passed into the Voxcommado web service but im not sure how to grab the 50 thats being passed in the ${intensity.percent} and use that as a variable in my commands that voxcommando is going to run.

Any tips would be great.

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Passing parameters to events
« Reply #1 on: September 21, 2015, 01:58:52 AM »
with what you shared we cant tell what that variables output looks like (${intensity.percent})
if you can post the exact text that is passed in payload 1 then we could help find the right solution or the right regex pattern to get just the percent number.

or if payload 1 is already just a number and your are trying to use payload 1 in some way then we will need more details on what your goal is, you can use payloads by using {1} = Payload 1, {2} = Payload 2, {3} = Payload 3....

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Passing parameters to events
« Reply #2 on: September 21, 2015, 08:17:42 AM »
As PegLegTv notes, the VC.TriggerEvent action accepts payload values as optional parameters.

i.e., if you look up the action description for VC.TriggerEvent--either directly in VC or on the wiki--it provides information on what values are expected for the parameters:

http://voxcommando.com/mediawiki/index.php?title=Actions#TriggerEvent

Quote
VC.TriggerEvent
Triggers any commands that contain "Event"

Add as many extra parameters as you like, they will be treated as payloads.

Parameters: 1+
Event : Name of event to trigger [string]
Payload1 : optional payload [string]
Payload2 : optional payload [string]
Payload3 : optional payload [string]

http://voxcommando.com/mediawiki/index.php?title=Payloads
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

shanekuz

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
    • View Profile
Re: Passing parameters to events
« Reply #3 on: September 22, 2015, 11:47:11 PM »
Thank you for your help, the request comes though looking like
http://192.168.31.180:80/api/VC.TriggerEvent&&FAMILYLIGHTSON&&50  and I have tried using the {1} but this comes though empty which was why I asked the question as I'm clearly doing it wrong.

Shane

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Passing parameters to events
« Reply #4 on: September 23, 2015, 01:27:44 AM »
if payload 1 is showing as just digits then there is no need for regex,  :)

when you hover over the event in the history window what shows up in the little popup window?

Quote
I have tried using the {1} but this comes though empty

what have you tried, that lets you see that {1} is empty?

shanekuz

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
    • View Profile
Re: Passing parameters to events
« Reply #5 on: September 23, 2015, 06:26:14 AM »
Thanks so much for your help i have realized i was using {P1} not {1} and now its working fine.