WebCore and LIFX Scene call issues w/ Samsung ST Button

light
buttons

#1

1) Give a description of the problem
The wife and I have SmartThings buttons (PUSH, DOUBLE, HOLD) right beside our beds. One for her. One for me.

Currently, I use the Smart Lights “app” in ST to control the button PUSH and DOUBLE capability for the LIFX bulbs. Seems to work pretty well with Toggle function (not just on / off). Example: PUSH once, light turns on @ 3500K / 50%. PUSH button once again, light turns off.

Because ST doesn’t allow me to call a SCENE through a button push for LIFX, I need to program the HOLD in WebCore.

I wish to accomplish…

  • Set all LIFX lights to RED / 100% by Button HOLD.
  • Remove the ST Smart Light app automations (Push / Double)

PUSH:
Controls the bedside lamps with LIFX bulbs. Currently controlled with ST Smart Light “app” automation. 3500K / 50%. Will move this later to WebCore.

DOUBLE:
Controls LIFX bulb and sets it to red / 30%. Currently controlled with ST Smart Light “app” automation. Will move this later to WebCore.

HOLD:
I want all my 42 LIFX bulbs to recall my “Panic” SCENE where it sets ALL LIFX bulbs to RED / 100%. NOT WORKING!

2) What is the expected behavior?
I would like all 42 of my lights to all turn RED / 100% when the ST Button is held for 3+ sec.

3) What is happening/not happening?

Seems pretty straight forward (see code). But when I build it to recall the panic SCENE and test by holding the button 3+ sec, it’s SOO Slow to change any lights. Also, some lights aren’t on, some quite halfway through the transition. It seems to exit the routine in a few sec as success (see logs).

I haven’t been able to have a successful transition too RED / 100% at all with WebCore.

Now, when I am in the LIFX app on my Android and press the “Panic” scene, BOOM within a couple sec it turns on all the lights (if any are off) and sets those and existing lights that are on to RED / 100%. WTF?!?

I know I am using 3 separate services. Button to ST Hub to WebCore to LIFX API call. However, I am thinking it shouldn’t have that much latency at all. If someone could help, I would sincerely appreciate it.

**4) Post a Green Snapshot of the piston!

Logs:
3/11/2019, 4:43:09 PM +997ms
+2ms ╔Received event [Walts Button].button = held with a delay of 349ms
+80ms ║RunTime Analysis CS > 18ms > PS > 50ms > PE > 11ms > CE
+82ms ║Runtime (39264 bytes) successfully initialized in 50ms (v0.3.10a.20190223) (79ms)
+83ms ║╔Execution stage started
+94ms ║║Comparison (enum) held gets (string) held = true (1ms)
+96ms ║║Condition #2 evaluated true (6ms)
+97ms ║║Condition group #1 evaluated true (state did not change) (8ms)
+100ms ║║Cancelling statement #3’s schedules…
+8243ms ║║Executed virtual command lifxScene (8139ms)
+8246ms ║╚Execution stage complete. (8163ms)
+8248ms ╚Event processed successfully (8247ms)

Sometimes it does this:

3/11/2019, 4:42:05 PM +157ms
+2ms ╔Received event [Walts Button].button = held with a delay of 357ms
+179ms ║RunTime Analysis CS > 110ms > PS > 56ms > PE > 13ms > CE
+182ms ║Runtime (39272 bytes) successfully initialized in 56ms (v0.3.10a.20190223) (179ms)
+183ms ║╔Execution stage started
+195ms ║║Comparison (enum) held gets (string) held = true (1ms)
+197ms ║║Cancelling condition #2’s schedules…
+198ms ║║Condition #2 evaluated true (8ms)
+200ms ║║Cancelling condition #1’s schedules…
+201ms ║║Condition group #1 evaluated true (state changed) (12ms)
+204ms ║║Cancelling statement #3’s schedules…
+10330ms ║║Error while activating LIFX scene: java.net.SocketTimeoutException: Read timed out
+10332ms ║║Executed virtual command lifxScene (10123ms)
+10335ms ║╚Execution stage complete. (10152ms)
+10336ms ╚Event processed successfully (10336ms)


#2

42 lights (42 light bulbs I assume) is LOTS of light bulbs to change color in one go.
I shouldn’t be but it is.

I have a piston that turns OFF every ON light bulb in the house (before going to sleep)
And I believe my light bulb count is around 50+ and usually around 20-25 is ON before going to bed.
It takes around 7-8 seconds to turn them all OFF
and by the way, for some reason - don’t know why - turning ON or OFF is an easier task than changing color.

If I were you, I wouldn’t use the App but create this scene “PANIC” in webcore. This way, it may not get faster maybe but for sure it will be more reliable.
Or you can create another piston that checks the bulbs and see if any is not red or not on after panic scene is activated (fail safe)


#3

Thank you @ike2018 for taking the time to reply with your suggestions. I sincerely appreciate the community assistance!

I took a few hours to play around with this and decided to make a few changes. I decided to call on the LIFX Lights then apply the policy. It all seems to work and they change pretty fast now as per the scene.

I also moved it from the button to a contact sensor on the inside of my gun safe. When the drawer is closed then it all goes back to normal (off) - provided I need to open this up after dark.

Hope this helps anyone else trying to do this.


#4

You are so welcome…
I believe if you change line 18 to CHANGES TO open what would work better.
You have two conditions aright now acting as a trigger, it’s always the best having a trigger FIRST and a CONDITION after…

Ps 1 : I am so jealous right now. We have some community members also doing stuff with their gunsafes and I am dying here:) (my wife doesn’t want any guns in the house :cry:)
ps 2 : Gunsafes, door locks, fire alarms etc these are very serious security/safety situations. I must say, I would NOT solely depend on Smart Home technology for that serious level of situations. I don’t mean to tell you what to do with your home just that I have seen so many signal drops, pistons executing but ST hub not realising etc. I am back to treating it as a hobby now. Atleast for now.


#5

Great mention there on the trigger and condition. I’ve been in the tech world for a while but never really got the hang of coding. I’ve always been more a HW person to be honest. I’ll do some more digging and look.at more examples for reference.

Thanks for the note on the PS! I am looking at this from another angle. When I open my safe to get to some self defense, I want the whole house to go red. In the middle of the night, it’s easier on the eyes and preserves any night vision I have. We live around some sketchy areas. I just want to have an edge. Think of the psychological aspect if you just busted into a house the all the lights go red. You probably want to get out. If it doesn’t work as intended, that is where the Trijicon night sights come into play. Always have a backup!

I see tech still as a means to assist but not take over ones personal liability to themselves of their family. Your reminders are spot on.

Good luck with the wife. I took mine to some classes and taught her as well. Safety and responsibility above all else!


#6

Oh yes… this makes perfect sense… For a second I thought maybe you were trying to be alarmed if your kids etc managed to open the safe… But I get it now…
I couldn’t convince my wife using the “self defense angle” because the area we live has zero crime rate and PD has only 3 cars and they are mostly sipping coffee with us by the shops. LOL imagine:)))

Here is a great document - if you haven’t seen it - about triggers and conditions:


#7

Man, that is quite nice. Our town used to be like that 10 years ago. Growth is good but there are also bad elements to it. We’re seeing a lot more house break ins, etc in our “used to be” sleepy neighborhood. Anyway, thanks again @ike2018! I’ll post more questions if I come across them!


#8

please do so… . I’m not a pro but I’ll do my best to help out:)