Set Colour setting Hue bulb level to 100% when movement detected


#21

If it is still flickering multiple times with Color being the first command, then you are right.

The only reason it looked like it was remembering the old level is because you said:

Just to make sure we are using the same terminology, the command:
IF motion changes to active
will only trigger if the device goes from inactive to active.
(not when going from active to active)

In other words, if you “dance” in front of the motion sensor for 5 minutes straight, it will only trigger once at the beginning. (not each time you move)

Leaving the room for a couple then returning should bring the device to inactive if you need to test again…


#23

Yes. What I meant is. Now that the script is working, the light does turn on and initially sets to 100% and then immediately sets to 20%, which is fine, I can live with the level changing once.

Yes, I understand that if the sensor kept detecting movement, then nothing would happen.

To test it I was sitting very still and then throwing my arms around until the light came on! :slight_smile:


#24

That is hard to say for sure if you were sitting there.
I have seen sensors reset to inactive as quickly as 6 seconds, and some devices take up to 3 minutes before resetting.

The only rock solid test is to have everyone leave the room for 3 + minutes and then reenter. If it does not flash to 100%, then you are golden!


#25

I just did some testing with my Philips Hue bulbs, and:

  • Set Color to White will always jump to 100% level
  • Set Color to Cool White will always jump to 96% level
  • Set Color to Daylight White will always jump to 90% level
  • etc…

This leads me to believe that each color has a specific level associated with it.

I just remembered that with Philips Hue, I have always been disappointed with Set Color to a preset. When I want to change a color, I use only Set Hue & Set Saturation. (this method never touches the level)


Either of these two blocks should work for you:

temp

The second block looks like this in the popup:

temp


#26

it does appear that the “set color” includes a ‘set level’ command in it.
@WCmore’s suggestions are right on to just set HSL. Just did some testing, and the following works as expected:

@faze105, if you didn’t know this already, you can capture the current settings prior to changing them as shown in the above piston. Makes it easy to temporarily change then restore original settings.

Here’s an HSL calc: https://www.w3schools.com/colors/colors_hsl.asp


#27

Hi @allrak No I didn’t know about this. I did notice the HSL command but had no idea what it did/does.

I’ll have a look at this now and see if this is a better option.

Thanks for explaining the HSL Command

@WCmore I thought the SmartThings sensors motion stayed active for a couple of seconds and then changed to inactive. At least thats what it says in the SM Classic app. I didn’t realise they could stay active for much longer than that


#28

And with that, the issue is resolved! :slight_smile:

Whatever colour and level the light has been set to previously, when movement is detected, the colour and level is set and then the bulb turns on, which is exactly how it would work in the SM Classic App.

I’m still not totally sure on the commands Capture and Restore Attributes, I’m guessing that it captures what the bulb has been set to?

This is the script that makes it work perfectly

Thanks to @allrak and @WCmore for your help with this.


#29

“Capture” simply stores the HSL (hue, saturation, level) into a temporary variable. That way you can capture the original HSL prior to changing it, then restore it later on (if so desired).
Think of it as taking a snapshot of how the lights currently look BEFORE doing anything to them.


#30

Got it, yes that makes perfect sense.