Test for Device Unavailable


#1

1) Give a description of the problem
I have a light socket that is powered up when it senses that it is getting dark, I have a TP-Link color bulb installed that I can control fine while the socket has power. When the light level outdoors decreases somewhat, due to cloud cover, etc. the power turns on. At that point, the light will become available in Smartthings so I can control it.

2) What is the expected behaviour?
I cannot find a way to test for availability of my TP-Link light bulb (i.e. when the socket is on = available, off = unavailable). I would like to test for availability, and if before a certain time of day, turn off the TP-Link bulb while the socket is still providing power.

3) What is happening/not happening?
While the bulb is unavailable I cannot make it accessible by webCoRE in Smartthings Classic. That is fine, hopefully the next time it comes on, I can add it.
I have checked other devices in webCoRE and cannot seem to find a way to test in an If/Then whether they are available or not. For example a light switch. This is really my question: “how can you test whether a device is available or not?”

4) Post a Green Snapshot of the pistonimage
Not worth posting, as I cannot find anything within the If/Then options to test whether a device is available.

5) Attach logs after turning logging level to Full
See 4)


#2

Does the bulb default to a certain color when powered up or does it retain the same after it is turned off?


#3

For what it’s worth, I usually recommend choosing either:

  • Smart bulb plugged into a dumb outlet… or
  • Dumb bulb plugged into a smart outlet…

If you go with a smart bulb and smart outlet combo, your code gets more complex, and your functionality gets much less.


#4

Retains the color


#5

Agreed, but in our strange town, the city requires a post in the front yard with a light on it (I guess too cheap for real street lights). They pay for the electricity and it turns on and off much like a regular street light. The light sensor is extremely sensitive and sometimes turns it on as early as 4 or 5 pm when it is not nearly dark. I want to be able to shut it off when it is not dark, as soon at it turns on. If my bulb defaulted to OFF, then I would not have to worry about it.


#6

Does it report its status to ST as soon as it gets powered on? If it does, you can build a piston around that and maybe even compare it to $sunset variable.


#7

If you are willing to give up Level 100%, and let 99% become your new maximum for that bulb, the following piston should work well.

This piston is designed for bulbs that jump to 100% brightness upon receiving first power


#8

This problem had me intrigued and that is interesting using levels to determine piston execution. I believe this would only work once during the day and if the daylight sensor cycled again would remain on. Setting the level again to 99 before turn off should reset your trap as shown.


Tested this with a Cree white bulb with firmware 0x20 and worked okay, but little slow.

Also found this simple version worked too if you ensure the bulb is off before turning on the piston. Probably would want to put some logic to check on periodic status if you went to production with it.

BTW, Both Health Check and Status Check did not fire events with the Cree bulb. The power level change to 100 from 99; and switch status from Off to On did.


#9

The slowness is likely because when power is first restored, it takes a minute for the bulb to connect to the hub. (it goes full brightness at the moment power returns, but remains ‘dumb’ for a bit)

This is also why I did not set to 99% in the first block.


Feel free to experiment, but I think using:
IF switch changes
will not work upon power restore. By the time the bulb connects to the hub, there will be no changes in the switch. I think piston “ftm6” should do the trick


EDIT :
I just noticed that I use this trigger to determine when power is restored:

temp

but this condition must be seen as a trigger for this to work. (lightning bolt in the margin)