Any fast way to populate an array?


#21

Very nice. I’m planning to build a z-wave sprinkler controller soon (always next week haha). Seems like the ones on the market are very expensive. What are you using?


#22

I’ve got four circuits. The two first are the built in sprinkler systems for the property. These have 24V AC solenoids (which I believe are standard for permanent irrigation systems) Once they were connected to one of those green Orbit timer boxes sitting in the garage. Instead I disconnected the timer box and hooked the solenoids up to a couple of powersupplies I had sitting around. These in turn are just plugged in to a couple of z-wave switches. Easy-Peasy-LemonSqueasy.

Note: IF you have 3 wires coming out of the wall, it just means the the two solenoids share a wire for one side of the coil. All you have to do is connect the common wire to ONE of the terminals on BOTH power supplies

The two other are auxiliary circuits for wifey’s potted plants and veggie garden, where I had to run my own tubing. The hardware consists of a cheap 110V solenoid valve, a 110V zigbee switch and everything mounted in a nice box on the wall. The box below has 4 switches inside (two others control pool shower and mister cooling systems (we’re in the Nevada desert, it gets kinda toasty out here :slight_smile: Each circuit has a manual override switch just in case of… well Murphy and Mesh failure


#23

is there a different way to index a string array then? it seems to work with a device array, but as you said does not work with the string array (like below, which does not work)

define
string actionList = held,pushed
device typeList = Plug1 and Light1
device activeDevice
end define
....
set variable activeDevice = {arrayItem(indexOf(actionList,$currentEventValue),typeList)

#24

I haven’t discovered a way to index a string but I have a workaround as long as the list is short (the other option is a loop). Essentially define a new integer variable based on where the event falls in the string list and then use that integer the pull the device.

set variable x = {$currentEventValue == arrayItem(0,actionList) ? 0 : ($currentEventValue == arrayItem(1,actionList) ? 1 : '')}
set variable activeDevice = {arrayItem(x,typeList)

#25

The difference with string arrays is each character is an ‘item’ rather than being able to separate by comma. You would have to search for the commas and create your own index.


#26

that seems like it’s exactly what I need. Thank you, because I would not have known how to write that expression.