Passing variables through pistons


#22

I just took everything out and reran, here are the screenshots



#23

the value of the passed in argument seems to be null. any idea why that argument was not passed in?


#24

I have no clue:-( My push notifications seem to indicate that the calling piston is passing them correctly



#25

create a trimmed down caller piston and pass the right arguments from there. lets see if it shows up correctly in the called piston.


#26

Here you go, thank you so much for helping me. I dont see anything wrong with this caller piston.



#27

now in the called piston add a log statement for $args … lets see whats going across.


#28

Everything except for the device seems to be getting passed correctly


#29

i wonder if its really getting passed in as an array. change the first log line to string($args.CurrentSwitch) and lets see what we get.


#30

nope nothing changed…



#31

before you try the following … not sure why in the set variable there is square brackets enclosing the set variable statement.

first:
please remove those square brackets only and try. if that still does not work … then try the second one below:

second:
change that set variable line to the following and try please:

set variable Switch = mid(string($args.CurrentSwitch), 1, length(string($args.CurrentSwitch)) - 2)


#32

heres a working example of passing in a device from one piston to another piston at runtime:


#33

You are the man!! The simple example worked, I will now try to add a second device and see if it still works. I did not add the ‘[’ to the variable, this must be a weird webcore thing. Thank you again for your help, I had literally spent days trying to figure it out.


#34

if you insist :slight_smile:

adding in a second device will not work i suspect given the string passed is wonky … it will need to be parsed properly to work


#35

and you are correct again:-) It did not work, more work to do. Is this a webcore bug we have discovered? I am signing off for tonight had enough webcore fun for a day. Thanks again.


Multiple web requests
#36

we discovered more than one bug. :slight_smile:


#37

Why don’t we just goo over to Features and Suggestions and ask for a way to pass device names from piston to piston via arguments or Global variables or some other method.

I would think that’s an easy ask.


#38

Will do, though @bangali found a workaround that solves this issue for now.


#39

@bangali I don’t want to take up your entire evening on this again, but in the thread where I first found you, you mentioned that
" also fyi piston parallelism when turned on creates a 2nd instance of the piston to handle incoming events. while there will be 2 instances of the piston all variables in the define block are shared and each piston does not get its own instance of variables."

Is there a way to instead of using a With ‘switch name’ to turn the device on/off to use a With ‘location’ and then access the attributes of the device directly (via the $args variable) so you could execute commands at the device level?


#41

no worries. you didnt take up my entire evening … it was only a few minutes between what i was working on yesterday evening. :slight_smile:

no. you are executing them at the device level … the with statement specifies the device to execute commands on.


#42

Any insight if this feature was implemented? I find myself trying to pass a device name from piston to piston and struggling