Passing variables through pistons


#4

No each device gets passed separately, in this example it’s 2 devices and I can tell from the notifications that the variables get passed correctly each time the 2nd piston is called.
The variable that should control the actions are setup as a device in both pistons. When I receive the device variable (CurrentSwitch) in the Slave piston, it comes in as as the address and not the name, that’s why I needed the switch statement.


#5

please clarify this part.

yes but you are using a switch statement there. tried assigning the args.currentswitch to the device variable directly?


#6

Yep, have tried multiple times, just tried it again and all I get is the address


#7

share a green snapshot of what you tried please


#8

Here you go:

And a screenshot of the notifications. It says [XXXX] device not found.


#9

i was looking for the thread where this was asked earlier … see here:

yeah its fine that you see the device hash … just try on/off on that device variable.


#10

thanks, looking for the exact syntax now, if you have it handy somewhere please share!


#11


#12

Thanks, but that’s not going to work, when I define the switch variable it doesn’t recognize it as a valid device. I thought you meant to do a ‘with location’ and then set each attribute in there. See screenshots…



#13

lines 30 - 32 will not work and is the reason for those errors in the log.

if you do this it should work:

with switch
   do turn on
end with

#14

Nope, no joy. I had tried this multiple times in the past few days. My local variable is not getting recognized as a device.



#15

lets try this:

  • line 21 just define the device variable dont set it
  • at the top of the piston
    – log the value of args.currentswitch
    – set device variable to args.currentswitch
  • with device variable turn it on

what happens?


#16

I have already tried this a few times as well, still will not recognize it as a valid device. I will try again


#17

try this:


#18

Thanks, this didnt work either


#19

share the logs please.


#20

there you go



#21

please execute the version i shared. need to see what happens when those first few statements are executed without digging thru all the conditions to understand where its failing.


#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?