What's wrong with using $currentEventDevice with variables?

variables

#1

1) Give a description of the problem
Cant get $currentEventDevice to work when I have my devices in variables

2) What is the expected behavior?
I want to find out what device triggered so I can set different variables depending

3) What is happening/not happening?
piston is triggering correctly, but $currentEventDevice isn’t working with them

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)

I know its this as it works if I use the devices directly.


#2

I have not tried to trigger off $currentEventDevice before, but looking at it there’s no orange lightning bolt on the gutter, you can try and force subscription but not positive that would work.

Another thought is to save matching device to variable and see if you can subscribe to that local variable, again not positive it will work. I’m on mobile so not really conducive to testing.


#3

I’m not trigger from it but using it as a condition to work out what one triggered (kind of) it was suggested to do it like this on a previous rev of this piston.

It does seem to be subscribing, it’s just not recognising the name. I will post my temp fix for it in a bit, but the idea was to make the piston neater with variables.

EDIT:


#6

Just a guess, but in your original piston, it looks like you’re comparing $currentEventDevice to the string name of your device variable instead of the value of the device variable in lines: 52, 65, 82, 95.

Use {device variable} instead of ‘device variable’ and see if that works. For example, use {Steven1st} instead of ‘Steven1st’ in line 52.


#7

This sounds correct and it stands out like a sore thumb now! I will try it and report back thanks. :grin:

Edit: yes this was it thanks !