app:2802019-12-02 04:11:07.321 pm debugdev: dW OF LI 1 | cmd: setLevel | p1: 0 | p2: 3
looks like runDeviceCmd is being sent a map with all device attributes even though deviceCmdDelay specified a device wrapper in scheduling the call to runDeviceCmd via runInMillis.
I have a related question. and I apologize if I'm using the wrong terms. Remember...I'm totally self taught for anyting code related. So please be patient with me.
Do you mean only if they are selected from an input and are the only "memeber" of that input? So, the input is only a single device?
To put it another way...If i have a multi-device input and I have found the correct one from the set and assigned it to a variable, can that be passed to another method or no? Do i have to pass off the way to find the device to the method that will execute the command on said device?
That will pull the matching device out of myDevices. Can I use runIn to pass "device" to another method as part of the data map? Or will it be lost when I try to do that? So far I can't tell if it's the way I'm setting it up or if it's just not supposed to work. So, thought I'd ask before pulling my hair out any further.
Well, myDevices in this case would have been the input selection of multiple devices. Okay, I'll have to take a closer look and see what I was doing wrong. Maybe it's how I was setting up the mapped data. Thanks Bruce.
I thought you said I could pass a device variable off to another method as long as it was part of an input. Did i miss-understand you? Or was I not stating my question clearly?
Basically, I have gone through the steps necessary to identify which device i need to use. Do i have to do that again in the method called to by runIn? To be clear, device is not an input but it is part of the multi-device input of myDevices. It probably is a lot clearer what I'm asking now that I've given you an example.
I also tried to save the device is a state variable....boy, that doesn't work And talk about a total mess!! Learned that one the hard way.
As you've helped me before, I will try to return the favor. Judging from the error message, the device is stored as a json object when scheduling with runIn. A possible approach would be to pass the device id or network id instead of the whole device object, and in the turnOff function retrieve the device from myDevices using the ID.
Yes, I know that. If you read the conversation that Bruce and I were having above, I asked if that was the only method. He said I can just pass the device. When I tried it, I couldn't get it to work so I was asking him what I was doing wrong, since he said it was possible.
@bravenel, nothing huh? You said I could pass a device variable to another method with runIn but it doesn't appear to be working. Please let me know what I am doing wrong. Thanks.
I know that and that's what I thought was required. That's what I'm doing in the first method. But after what Bruce said, I thought it would work differently. Do you read what he said the same way? I don't really care one way or the other, I just want some acknowledgement that it won't work so I can stop digging. Ya know what I mean? Someone in authority tells you something, I tend to believe them. After all, Bruce has forgotten more about this stuff than I've ever known. I hold no illusions about that. That's what makes it so frustrating. How can those of us trying to learn this stuff supposed to learn if they don't correct themselves? Since I'm seeing that it doesn't work either I will just move the identifying "system" to the called method as well.
Do you mean because the person could remove the device from the app between the first and second methods but the device would be persistent if that's what was passed? (Again, trying to confirm for my own edification, not questioning your reasoning.) From experience I knew this wasn't working but this makes a lot of sense WHY this SHOULDN'T work. After all, you don't know what type of length of time you might use in a runIn...it could be months from now.
I created a workaround that actually works. Pass the settings field name, and when it's a multiple: true, the device's index number which is available in a .each or .find loop.