SmartApp control of TCP lights is unreliable

(Glen) #1

I have modified an existing SmartApp to dim and brighten Connected by TCP lights, using multiple Z-wave motion sensors.

I found that control of the TCP lights is not only slow, it is unreliable.
In order to make it more reliable, I am doing 2 things:

  1. I brighten the lights (called “dimmers”, in the code) to two different almost-equal levels, in case one command gets lost, and in case identical consecutive commands are deleted as redundant.

// Called by motionHandler() when motion is detected
def brightenDimmers() {
log.debug "Brightening to $highLevel: ${dimmers} "

  1. When motion is detected, I call brightenDimmers() 3 times, with delays between:

    brightenDimmers() // Brighten the dimmers
    runIn(1, brightenDimmers()) // Brighten again after 1 second delay
    runIn(1, brightenDimmers()) // Brighten again after 1 second delay

So, when motion is detected, each light gets told 6 times to brighten.
The above looks like it should take just over 2 seconds, but it takes 7-10 seconds, and manages to brighten the set of 5 lights most of the time.
Sometimes, one or two lights don’t brighten until another motion sensor is triggered (and the lights get 6 more commands to brighten).

Any suggestions?

Do I need to give up on SmartThings?
Do I need to wait for SmartThings to support running my SmartApp locally?

The only other option I know of at this point is to wait for TCP to come out with their own motion detector, but I don’t know that I will be able to program it to do what I want–not only the dim/brighten, but also having the group of lights dim 2 minutes after the motion sensors report no motion (it’s a bit more complicated than that, but I don’t want the lights to dim whenever ANY ONE sensor reports no motion).

(Brad) #2

glen - I had the same problems as you with my TCP lights. I fixed it by creating fixtures through the TCP App for every light I had. Even if a fixture only had 1 light, I still create one for it. I decided to try that out when I had 2 lights I both wanted dimmed but sometimes only 1 light would dim or just never at all. When I run the discovery it finds the fixtures rather than each light in SmartThings now and I point my apps to those fixtures. Works perfect every time now! I went from totally frustrated to almost completely satisfied.

The only other problem I had with these lights is after a power failure. I need to run the discovery again for them to work in SmartThings when I lose power. I don’t need to setup apps again or anything like that just opening up the TCP configuration to find my bulbs is required.


(Jody) #3

Thanks for this tip. I had problems with the TCP app crashing when I first got my bulbs so I never really messed with it. Having groups of lights operate as fixtures has solved many of my annoyances.

(Glen) #4

Thanks so much for the info. I won’t have time to try it for a bit.
So, do you think that 5 fixtures of one bulb each will work as well as one fixture of 5 bulbs? I haven’t learned about fixtures, yet.

(Brad) #5

Yes I do. I have a few fixtures with multiple bulbs and a few with just one bulb. It seemed a little weird to create fixtures when I just had one bulb, but it still helped those.


(Jody) #6

After a few days of testing I can easily say fixtures are the way to go. The reliability of my TCP lights has gone up tremendously.

(Andrew Urman) #7

someone send @wackware some flowers

#openplatform #powerofthedeveloper

(Glen) #8

I found that creating 5 fixtures of one light each did not solve the problem.
But creating one fixture containing all 5 of my lights did make it reliable.

It now takes about 1 second for the motion detector to trigger, as before (i.e., one second from when I move until the light on the motion detector flashes).
Then it takes about another second for the lights to come on, all at once.

Perhaps there is something else that I’m doing differently, that makes 5 fixtures of one light each unreliable.

Thanks, Brad. You’ve helped make my lighting much quicker and more reliable.

(Brad) #9

Sorry, I may not have been clear, but that is exactly what I meant! I have some fixtures with multiple bulbs and some with just one bulb. I noticed creating a fixture always helped regardless of the amount of bulbs in it even if the fixture has just one. It was just weird creating a fixture for my basement storage area even though there was really no light fixture there. It was just a hanging light. But it helps creating one anyways.

I also have the same delay as you. But if I go to “Things” and just turn them on and off through there it is instantaneous. That delay I believe is from having to trigger events through the cloud…

Glad to help.