Change bulb colors to colors in a string variable not working properly


#1

1) Give a description of the problem
I have a small piston that I am just using to test out, I am still pretty new with webcore. I have two bulbs that I want to change using a string variable and for some reason it changes both of them the first color in the string only.

2) What is the expected behaviour?
When motion changes change two hue bulbs two red and blue respectively

3) What is happening/not happening?
They only change the first color in the variable


#2

Hmm, so bulb 18 would be red, then bulb 19 blue?


#3

yes, thats what i would like to happen, but for some reason it is changing them both to red.


#4

If I were to put blue as the first color it would change them both blue.


#5

With the piston you have right now, there’s only one task and it’s to set both bulbs to ‘red’ which is the result of arrayItem($index,Color).

Edit: To do what you want, you’d have to loop through the device list then through the color list.


#6

Is there anyway you can show me an example of how to achieve this?


#7

Something like this…

When triggered, it logs the following.

10/3/2019, 11:18:24 AM +886ms
+130ms ║Setting color of Living Area iris to red
+160ms ║Setting color of Dining Area Iris to blue

One thing to note with this is there will be a very small delay in the color change for each light… more noticeable probably if you have more than 2 that the piston will have to loop through.


#8

How do I put in a command “for each” and then $device? sorry like i said im still new and trying out new things lol```

One thing to note with this is there will be a very small delay in the color change for each light… more
[/quote]


#9

Ah, you probably need to enable Advanced Statements under Options (while in Edit mode).
image


#10

+110ms ║Setting color of Hue color lamp 2 to red
+140ms ║Setting color of Hue color lamp 4 to blue

#11

it still turned them both red,


#12

but logged it like it turned them the correct color


#13

What does the current piston look like now?


#14

I added a picture above


#15

Sorry, it should look like below… in my previous example I just logged info to console as I didn’t want to actually set my hue iris to the red/blue colors as I am not home lol. It might freak out whoever’s in the house.

Try this one…


#16

That did it, thank you so much! you freaking rock!!! thank you so much!!! ITS LIIIIIITTTT