Can't see value of color Simulated RGB Bulb


#1

1) Give a description of the problem
Wanting a different alarm sound from SHM. Thought I could leverage a simulated RGB switch with SHM which then would enable me to use a custom MP3. Testing with TTS for now. Example piston below.

2) What is the expected behavior?
While switch is ON check for color value and act accordingly.

3) What is happening/not happening?
Nothing is happening.

4) Post a Green Snapshot of the pistonimage


#2

If you only care about the light bulb changing to on…why not just test for that.

IF Bulb changes to On…
IF color is ___ do this
Else IF color is ___ to that

I’m not sure the need for the While loop… That seems unnecessary, unless there’s something I’m missing.


#3

If you want a message to be continously repeated you need to do a loop. For some odd reason I cannot see the color in WebCoRE with a Simulated RGB bulb. SHM turns a RGB bulb red if there is an intrusion. So I want to trigger off that virtual bulb changing to red and then back to white.


#4

Anyone else??


#5

What evidence do you have that you cannot see the color? I don’t see any logging of any type in this piston.

Beyond that…in the IDE for my color bulbs the color is always shown in uppercase. As WC (like most programming languages) is case-sensitive “ffffff” is not the same as “FFFFFF”.


#6

@Mike1616

Appreciate the response. First off case sensitivity is coming directly from WebCoRE. You cannot set the color #FFFFFF in the condition statement directly. You need to modify the color and set RGB to 255 which then translates the condition statement to #ffffff and not #FFFFFF. So this is not me but rather WebCoRE. As for logging I can see in the IDE that the bulb changes to #ff0000 and also back to #ffffff. If I change this same piston to an actual RGB bulb and have SHM change that bulb then it fires correctly without issues. BUT I do not want my lights to change color for the intruder. Frankly I want them to do something different or nothing at all. SO this is why I am asking about the RGB simulated bulb and if WebCoRE is having issues with it.


#7

Yeah, I wasn’t talking about the IDE. I was saying, what do you get if you log to the console in WC the value of the color value for the device in question?

Log debug “{[Test bulb : color]}”

That’s the important part.

Also, with an expression you can certainly make it case sensitive.


#8

@Mike1616

Ok so I changed stuff and also added a lot of logs. Nothing seems to trigger correctly.

Logs:
2/19/2018, 12:55:13 PM +960ms
+1ms â•”Received event [TestLight].color = {hex= #FFFFFF, hue=0, saturation=0, level=100} with a delay of 1476ms
+65ms â•‘RunTime Analysis CS > 12ms > PS > 16ms > PE > 37ms > CE
+67ms â•‘Runtime (39481 bytes) successfully initialized in 16ms (v0.2.102.20180116) (65ms)
+68ms â•‘â•”Execution stage started
+75ms â•‘â•‘Evaluating switch with values [[i::5715d07e4bdf46734a957ce451c5df5a::color, v:[t:color, v:{hex= #FFFFFF, hue=0, saturation=0, level=100}, d::5715d07e4bdf46734a957ce451c5df5a:, a:color, i:null, x:false, vt:string]]]
+78ms â•‘â•‘Comparison (color) {hex= #FFFFFF, hue=0, saturation=0, level=100} is (string) #FF0000 = false (2ms)
+80ms â•‘â•‘Comparison (color) {hex= #FFFFFF, hue=0, saturation=0, level=100} is (string) #FFFFFF = false (1ms)
+82ms â•‘â•‘Condition group #20 evaluated true (state did not change) (0ms)
+84ms â•‘â•šExecution stage complete. (16ms)
+85ms â•šEvent processed successfully (85ms)
2/19/2018, 12:54:44 PM +27ms
+1ms â•”Received event [TestLight].color = {hex= #FF0000, hue=0, saturation=100, level=50} with a delay of 111ms
+91ms â•‘RunTime Analysis CS > 24ms > PS > 23ms > PE > 44ms > CE
+94ms â•‘Runtime (39481 bytes) successfully initialized in 23ms (v0.2.102.20180116) (91ms)
+94ms â•‘â•”Execution stage started
+101ms â•‘â•‘Evaluating switch with values [[i::5715d07e4bdf46734a957ce451c5df5a::color, v:[t:color, v:{hex= #FF0000, hue=0, saturation=100, level=50}, d::5715d07e4bdf46734a957ce451c5df5a:, a:color, i:null, x:false, vt:string]]]
+104ms â•‘â•‘Comparison (color) {hex= #FF0000, hue=0, saturation=100, level=50} is (string) #FF0000 = false (1ms)
+107ms â•‘â•‘Comparison (color) {hex= #FF0000, hue=0, saturation=100, level=50} is (string) #FFFFFF = false (1ms)
+109ms â•‘â•‘Condition group #20 evaluated true (state did not change) (0ms)
+111ms â•‘â•šExecution stage complete. (17ms)
+112ms â•šEvent processed successfully (112ms)
2/19/2018, 12:54:33 PM +451ms
+0ms ╔Starting piston… (v0.2.102.20180116)
+202ms ║╔Subscribing to devices…
+232ms ║║Subscribing to TestLight.color…
+332ms ║║Subscribing to [Samsung] M3…
+333ms â•‘â•šFinished subscribing (143ms)
+361ms â•‘Evaluating switch with values [[i::5715d07e4bdf46734a957ce451c5df5a::color, v:[t:color, v:{hex= #FFFFFF, hue=0, saturation=0, level=100}, d::5715d07e4bdf46734a957ce451c5df5a:, a:color, i:null, x:false, vt:string]]]
+368ms â•‘Comparison (color) {hex= #FFFFFF, hue=0, saturation=0, level=100} is (string) #FF0000 = false (2ms)
+379ms â•‘Comparison (color) {hex= #FFFFFF, hue=0, saturation=0, level=100} is (string) #FFFFFF = false (2ms)
+384ms ║Cancelling condition #20’s schedules…
+395ms â•šPiston successfully started (395ms)


#9

There’s the issue right there.

The string value that you are getting back from the Simulated RGB bulb includes a bunch more stuff than just the hex value of the color. From the logs, it looks like the string actually is this:

“{hex= #FFFFFF, hue=0, saturation=0, level=100}”

So you’ve got a couple options going forward… Either convert that long string into a string which just has the hex color value…or (probably easier) just use one of the string functions to test to see if the Hex value you’re after is in the string you get back. Like the contains() function.

That should get you what you need. The reason for the difference between the Simulated bulb and the real bulb is obviously that the real bulb string that comes back only has the actual hex value in it…whereas the DTH for the simulated bulb gives you quite a bit more. Technically that’s another option…change the DTH so it only gives back the Hex value.

Anyway…this is not a WC related issue. It’s working with the string that it gets. So you have to workaround it in order to get this to work.


#10

@Mike1616

Great info! I was able to test the bulb whether it contains the color white/red. I am concerned I may be making this tougher than it needs to be. So this is what I am attempting to do:

  1. Within SHM if there is an intrusion then play custom MP3 (https://www.dropbox.com/s/qdlok45vfnhnrnm/tng_nemesis_intruder_alert.mp3?dl=0)
  2. After intrusion is dismissed stop playing custom MP3

My issues:

  • Can’t use custom MP3 files in SHM (at least I have no idea how to do this)
  • Can’t see into SHM outside of Armed/Disarmed with WebCoRE
  • SHM can do a RGB bulb notification changing the bulb to RED and then back to white
    • I am now able to see the color change
    • I can have my Sansung M3 speak but it won’t play the custom MP3 for some odd reason
    • I don’t know how to really monitor this effectively with triggers as the switch needs to be on but never shuts off because of SHM

Thoughts on my situation?


#11

You’ve ventured in to some territory that is not my forte. I don’t use SHM at this time and I don’t have any TTS speakers either, so I’ve never setup playing an MP3 file from one.

I would think you could use the “Events” from the change of the color of the bulb possibly though. I mean, as long as it’s not flashing because then it would trigger too often I would think.

Perhaps some others know about those things.


#13

So I guess I am NOWHERE near where I need to be on this.

  1. I can determine if the HEX value is in the RGB thanks to @Mike1616
  2. When running another test piston to set color to #FF0000; wait 30 seconds; set color to #FFFFFF will activate and stop the piston below
  3. When SHM changes the TestBulb to #FF0000 the piston executes but it seems the while statement doesn’t do anything. When SHM changes TestBulb to any other color (typically #FFFFFF) the piston won’t work.
  4. I all logs for both IDE and WebCoRE are below too.
  5. Yes I know this is the snapshot of the piston. I don’t want to confused anyone with the ossification of the device names.
  6. Also had to create another variable to capture true/false correctly. The contains() function keeps appending to itself if used as the expression for if/while statements.

2/20/2018, 9:08:49 PM +900ms
+1ms â•”Received event [TestLight].switch = off with a delay of 77ms
+224ms â•‘RunTime Analysis CS > 16ms > PS > 23ms > PE > 185ms > CE
+227ms â•‘Runtime (42410 bytes) successfully initialized in 23ms (v0.2.102.20180116) (225ms)
+228ms â•‘â•”Execution stage started
+234ms â•‘â•‘Comparison (enum) off changes_to (string) on = false (0ms)
+236ms ║║Cancelling condition #22’s schedules…
+236ms â•‘â•‘Condition #22 evaluated false (4ms)
+237ms ║║Cancelling condition #21’s schedules…
+238ms â•‘â•‘Condition group #21 evaluated false (state changed) (7ms)
+240ms ║║Cancelling statement #18’s schedules…
+243ms â•‘â•‘Skipped execution of physical command [null].off([]) because it would make no change to the device. (0ms)
+244ms â•‘â•‘Executed [TestLight].off (2ms)
+246ms ║║Cancelling statement #23’s schedules…
+301ms â•‘â•‘Executed physical command [Dining Room].stop() (50ms)
+301ms â•‘â•‘Executed [Dining Room].stop (52ms)
+327ms â•‘â•‘Executed physical command [Master Bedroom].stop() (23ms)
+328ms â•‘â•‘Executed [Master Bedroom].stop (23ms)
+357ms â•‘â•‘Executed physical command [Room].stop() (27ms)
+358ms â•‘â•‘Executed [Room].stop (28ms)
+360ms â•‘â•šExecution stage complete. (133ms)
+361ms â•šEvent processed successfully (361ms)
2/20/2018, 9:08:39 PM +832ms
+2ms â•”Received event [TestLight].switch = on with a delay of 107ms
+126ms â•‘RunTime Analysis CS > 23ms > PS > 23ms > PE > 80ms > CE
+128ms â•‘Runtime (42112 bytes) successfully initialized in 23ms (v0.2.102.20180116) (126ms)
+129ms â•‘â•”Execution stage started
+136ms â•‘â•‘Comparison (enum) on changes_to (string) on = true (1ms)
+137ms ║║Cancelling condition #22’s schedules…
+137ms â•‘â•‘Condition #22 evaluated true (4ms)
+138ms ║║Cancelling condition #21’s schedules…
+139ms â•‘â•‘Condition group #21 evaluated true (state changed) (6ms)
+141ms ║║Cancelling statement #14’s schedules…
+151ms â•‘â•‘Executed virtual command [TestLight].setVariable (3ms)
+153ms ║║Cancelling statement #30’s schedules…
+160ms â•‘â•‘Executed virtual command setVariable (3ms)
+162ms ║║Cancelling statement #4’s schedules…
+302ms â•‘â•‘Executed physical command [Dining Room].setLevel([20]) (135ms)
+303ms â•‘â•‘Executed [Dining Room].setLevel (136ms)
+338ms â•‘â•‘Executed physical command [Master Bedroom].setLevel([20]) (33ms)
+339ms â•‘â•‘Executed [Master Bedroom].setLevel (34ms)
+418ms â•‘â•‘Executed physical command [Room].setLevel([20]) (76ms)
+418ms â•‘â•‘Executed [Room].setLevel (77ms)
+421ms ║║Cancelling statement #1’s schedules…
+462ms â•‘â•‘Executed physical command [Dining Room].setTrack([http://media/tng.mp3]) (38ms)
+463ms â•‘â•‘Executed [Dining Room].setTrack (39ms)
+480ms â•‘â•‘Executed physical command [Master Bedroom].setTrack([http://media/tng.mp3]) (16ms)
+481ms â•‘â•‘Executed [Master Bedroom].setTrack (18ms)
+498ms â•‘â•‘Executed physical command [Room].setTrack([http://media/tng.mp3]) (16ms)
+498ms â•‘â•‘Executed [Room].setTrack (17ms)
+536ms â•‘â•‘Executed physical command [Dining Room].play() (36ms)
+537ms â•‘â•‘Executed [Dining Room].play (38ms)
+554ms â•‘â•‘Executed physical command [Master Bedroom].play() (16ms)
+554ms â•‘â•‘Executed [Master Bedroom].play (16ms)
+570ms â•‘â•‘Executed physical command [Room].play() (15ms)
+571ms â•‘â•‘Executed [Room].play (16ms)
+576ms â•‘â•‘Comparison (boolean) false is (boolean) true = false (1ms)
+578ms â•‘â•‘Condition #27 evaluated false (4ms)
+578ms â•‘â•‘Condition group #26 evaluated false (state did not change) (5ms)
+581ms â•‘â•šExecution stage complete. (451ms)
+582ms â•šEvent processed successfully (581ms)
2/20/2018, 9:08:33 PM +869ms
+1ms â•”Received event [TestLight].switch = off with a delay of 61ms
+108ms â•‘RunTime Analysis CS > 12ms > PS > 15ms > PE > 80ms > CE
+110ms â•‘Runtime (42109 bytes) successfully initialized in 15ms (v0.2.102.20180116) (108ms)
+111ms â•‘â•”Execution stage started
+117ms â•‘â•‘Comparison (enum) off changes_to (string) on = false (0ms)
+118ms ║║Cancelling condition #22’s schedules…
+119ms â•‘â•‘Condition #22 evaluated false (4ms)
+120ms ║║Cancelling condition #21’s schedules…
+120ms â•‘â•‘Condition group #21 evaluated false (state changed) (5ms)
+122ms ║║Cancelling statement #18’s schedules…
+125ms â•‘â•‘Skipped execution of physical command [null].off([]) because it would make no change to the device. (0ms)
+126ms â•‘â•‘Executed [TestLight].off (2ms)
+128ms ║║Cancelling statement #23’s schedules…
+166ms â•‘â•‘Executed physical command [Dining Room].stop() (35ms)
+167ms â•‘â•‘Executed [Dining Room].stop (37ms)
+184ms â•‘â•‘Executed physical command [Master Bedroom].stop() (15ms)
+184ms â•‘â•‘Executed [Master Bedroom].stop (16ms)
+200ms â•‘â•‘Executed physical command [Room].stop() (12ms)
+200ms â•‘â•‘Executed [Room].stop (14ms)
+202ms â•‘â•šExecution stage complete. (91ms)
+203ms â•šEvent processed successfully (203ms)
2/20/2018, 9:08:18 PM +507ms
+1ms â•”Received event [TestLight].switch = on with a delay of 69ms
+117ms â•‘RunTime Analysis CS > 20ms > PS > 15ms > PE > 81ms > CE
+119ms â•‘Runtime (42111 bytes) successfully initialized in 15ms (v0.2.102.20180116) (118ms)
+120ms â•‘â•”Execution stage started
+127ms â•‘â•‘Comparison (enum) on changes_to (string) on = true (0ms)
+128ms ║║Cancelling condition #22’s schedules…
+128ms â•‘â•‘Condition #22 evaluated true (4ms)
+129ms ║║Cancelling condition #21’s schedules…
+130ms â•‘â•‘Condition group #21 evaluated true (state changed) (6ms)
+132ms ║║Cancelling statement #14’s schedules…
+139ms â•‘â•‘Executed virtual command [TestLight].setVariable (2ms)
+141ms ║║Cancelling statement #30’s schedules…
+146ms â•‘â•‘Executed virtual command setVariable (1ms)
+148ms ║║Cancelling statement #4’s schedules…
+230ms â•‘â•‘Executed physical command [Dining Room].setLevel([20]) (78ms)
+231ms â•‘â•‘Executed [Dining Room].setLevel (79ms)
+257ms â•‘â•‘Executed physical command [Master Bedroom].setLevel([20]) (24ms)
+257ms â•‘â•‘Executed [Master Bedroom].setLevel (24ms)
+316ms â•‘â•‘Executed physical command [Room].setLevel([20]) (57ms)
+317ms â•‘â•‘Executed [Room].setLevel (58ms)
+319ms ║║Cancelling statement #1’s schedules…
+352ms â•‘â•‘Executed physical command [Dining Room].setTrack([http://media/tng.mp3]) (30ms)
+353ms â•‘â•‘Executed [Dining Room].setTrack (31ms)
+365ms â•‘â•‘Executed physical command [Master Bedroom].setTrack([http://media/tng.mp3]) (11ms)
+366ms â•‘â•‘Executed [Master Bedroom].setTrack (13ms)
+378ms â•‘â•‘Executed physical command [Room].setTrack([http://media/tng.mp3]) (11ms)
+379ms â•‘â•‘Executed [Room].setTrack (12ms)
+409ms â•‘â•‘Executed physical command [Dining Room].play() (28ms)
+409ms â•‘â•‘Executed [Dining Room].play (29ms)
+421ms â•‘â•‘Executed physical command [Master Bedroom].play() (11ms)
+422ms â•‘â•‘Executed [Master Bedroom].play (12ms)
+433ms â•‘â•‘Executed physical command [Room].play() (10ms)
+434ms â•‘â•‘Executed [Room].play (12ms)
+439ms â•‘â•‘Comparison (boolean) false is (boolean) true = false (1ms)
+440ms â•‘â•‘Condition #27 evaluated false (4ms)
+441ms â•‘â•‘Condition group #26 evaluated false (state did not change) (4ms)
+443ms â•‘â•šExecution stage complete. (322ms)
+443ms â•šEvent processed successfully (443ms)
2/20/2018, 9:07:19 PM +424ms
+1ms â•”Received event [TestLight].switch = off with a delay of 92ms
+152ms â•‘RunTime Analysis CS > 26ms > PS > 29ms > PE > 97ms > CE
+155ms â•‘Runtime (42109 bytes) successfully initialized in 29ms (v0.2.102.20180116) (153ms)
+156ms â•‘â•”Execution stage started
+163ms â•‘â•‘Comparison (enum) off changes_to (string) on = false (0ms)
+164ms ║║Cancelling condition #22’s schedules…
+164ms â•‘â•‘Condition #22 evaluated false (4ms)
+165ms ║║Cancelling condition #21’s schedules…
+166ms â•‘â•‘Condition group #21 evaluated false (state changed) (6ms)
+168ms ║║Cancelling statement #18’s schedules…
+171ms â•‘â•‘Skipped execution of physical command [null].off([]) because it would make no change to the device. (0ms)
+172ms â•‘â•‘Executed [TestLight].off (1ms)
+174ms ║║Cancelling statement #23’s schedules…
+258ms â•‘â•‘Executed physical command [Dining Room].stop() (80ms)
+259ms â•‘â•‘Executed [Dining Room].stop (81ms)
+289ms â•‘â•‘Executed physical command [Master Bedroom].stop() (27ms)
+290ms â•‘â•‘Executed [Master Bedroom].stop (29ms)
+316ms â•‘â•‘Executed physical command [Room].stop() (23ms)
+317ms â•‘â•‘Executed [Room].stop (24ms)
+319ms â•‘â•šExecution stage complete. (164ms)
+320ms â•šEvent processed successfully (320ms)
2/20/2018, 9:06:55 PM +816ms
+2ms â•”Received event [TestLight].switch = on with a delay of 91ms
+135ms â•‘RunTime Analysis CS > 24ms > PS > 24ms > PE > 86ms > CE
+137ms â•‘Runtime (42203 bytes) successfully initialized in 24ms (v0.2.102.20180116) (135ms)
+138ms â•‘â•”Execution stage started
+154ms â•‘â•‘Comparison (enum) on changes_to (string) on = true (0ms)
+155ms ║║Cancelling condition #22’s schedules…
+156ms â•‘â•‘Condition #22 evaluated true (4ms)
+156ms ║║Cancelling condition #21’s schedules…
+157ms â•‘â•‘Condition group #21 evaluated true (state changed) (6ms)
+159ms ║║Cancelling statement #14’s schedules…
+168ms â•‘â•‘Executed virtual command [TestLight].setVariable (2ms)
+170ms ║║Cancelling statement #30’s schedules…
+176ms â•‘â•‘Executed virtual command setVariable (2ms)
+179ms ║║Cancelling statement #4’s schedules…
+305ms â•‘â•‘Executed physical command [Dining Room].setLevel([20]) (122ms)
+306ms â•‘â•‘Executed [Dining Room].setLevel (122ms)
+337ms â•‘â•‘Executed physical command [Master Bedroom].setLevel([20]) (28ms)
+337ms â•‘â•‘Executed [Master Bedroom].setLevel (29ms)
+414ms â•‘â•‘Executed physical command [Room].setLevel([20]) (74ms)
+415ms â•‘â•‘Executed [Room].setLevel (75ms)
+417ms ║║Cancelling statement #1’s schedules…
+456ms â•‘â•‘Executed physical command [Dining Room].setTrack([http://media/tng.mp3]) (36ms)
+457ms â•‘â•‘Executed [Dining Room].setTrack (38ms)
+473ms â•‘â•‘Executed physical command [Master Bedroom].setTrack([http://media/tng.mp3]) (14ms)
+473ms â•‘â•‘Executed [Master Bedroom].setTrack (15ms)
+489ms â•‘â•‘Executed physical command [Room].setTrack([http://media/tng.mp3]) (15ms)
+490ms â•‘â•‘Executed [Room].setTrack (16ms)
+526ms â•‘â•‘Executed physical command [Dining Room].play() (35ms)
+527ms â•‘â•‘Executed [Dining Room].play (36ms)
+542ms â•‘â•‘Executed physical command [Master Bedroom].play() (14ms)
+542ms â•‘â•‘Executed [Master Bedroom].play (15ms)
+557ms â•‘â•‘Executed physical command [Room].play() (14ms)
+558ms â•‘â•‘Executed [Room].play (15ms)
+563ms â•‘â•‘Comparison (boolean) false is (boolean) true = false (1ms)
+564ms â•‘â•‘Condition #27 evaluated false (4ms)
+565ms â•‘â•‘Condition group #26 evaluated false (state did not change) (5ms)
+567ms â•‘â•šExecution stage complete. (429ms)
+568ms â•šEvent processed successfully (568ms)