Passing device variable to a called piston causes device reference to be lost


#1

As suggested by @eibyer, I’ve updated the original post

1) Give a description of the problem
When a device variable is used as an argument to a called piston, the device reference is messed up.

2) What is the expected behaviour?
A device contained in a variable should be usable at both the caller and the called piston.

3) What is happening/not happening?
The called piston cannot access the same device.

4) Post a Green Snapshot of the pistonimage
Caller piston

Called piston

5) Attach logs after turning logging level to Full
Caller piston log

Called piston log


#2

I would suggest creating simple test pistons to demonstrate the issue.


#3

done!
I should have done it from the beginning … thanks!


#4

I think this maybe similar but calling the receiving piston differently (using the piston’s external url)


#5

On further trials, it seems the square brackets maybe the issue?

image


#6

Í think that too.

It’ve noticed that a device reference is always stored in a variable of type device as an array and is surrounded by square brackets like [:dev0:,:dev1:, … ,:devn:]. When it’s an array with a single item, it’s [:dev0:]. However, when passed to a called piston, it’s gets messed up. And I don’t know how to “remove” the brackets, if there’s a way of doing it.


#7

I removed the brackets above using an replace().


#8

Gotcha!

Probably you already know this, since I got the answer analyzing one of your posts:

That’s how I got it working:

CALLER PISTON & TRACE


CALLED PISTON & TRACE


MY DEBUG DATA

MY CONCLUSIONS (if I’m not mistaken … :wink:)

a) to pass a device from one piston to another, I must use a string with the name of the device in it

b) to get a device attribute, use a string variable with the NAME of the device in it using one of the following tested options at tests TEST 2, TEST 4 and TEST 5

c) at the TEST 1 it seems that the string is used instead of the device itself

d) using the device variable surrounded by square brackets notation does not work (TEST 3)

I’m a newbie with WebCoRE and for me it’s a bit confusing how it works, but, it works!

Thanks @eibyer for your help!


#9

I save devices in globals to carry them across pistons.