Looking for some guidance on the better way to send commands to multiple devices. Both options below work, but which provides the most reliable way to turn on/off a group of switches? Are there any major differences in the two methods?
I would use something like:
to give a little spacing between commands.
Of those two options, the second because the first has a typo. But if you meant
switches?.off(), either should work, and both would likely have similar results.
Personally, my preference is something like the second--that way, I can do something like @thebearmay suggests and add a delay, which is particularly handy if you have lots of Z-Wave and Zigbee devices since these networks often don't do well when flooded with commands. I've added the exact delay as an option in some of my apps. (Yeah, you'll still get a possibly-unnecessary pause after the last device, but I don't think I was able to find the size of a
DeviceWrapperList last I tried, and this really shouldn't matter for most apps...)