Light bulb status tile


#1

1) Give a description of the problem
Tile piston strangely turning on random light when others are dimmed to 0%

2) What is the expected behavior?
To be able to dim one light to 0% and not have other lights turned off or on

3) What is happening/not happening?
The tile piston monitors status of hue lights, if one is dimmed to 0% via ST app, one or more of the others get turned off or on. If I pause the tile piston, the behaviour stops and also the logs in ST app states the off / on commands are coming from the Tiles Piston.

In the example below, I dimmed the spare room light to 0% from within the ST app and then a moment after the spare room light turns off, the kitchen worktop light turned off.

4) Post a Green Snapshot of the pistonimage
Below is a snapshot of the piston.

5) Attach any logs (From ST IDE and by turning logging level to Full)
Piston log below:

|+2ms|╔Received event [Spare room light].switch = turningOff with a delay of 153ms|
| --- | --- |
|+157ms|║RunTime Analysis CS > 24ms > PS > 64ms > PE > 68ms > CE|
|+160ms|║Runtime (58213 bytes) successfully initialized in 64ms (v0.3.109.20181207) (158ms)|
|+161ms|║╔Execution stage started|
|+173ms|║║Cancelling statement #91's schedules...|
|+186ms|║║Calculating (string) turningoff == (string) on >> (boolean) false|
|+193ms|║║Executed virtual command setVariable (4ms)|
|+213ms|║║Calculating (integer) 3 + (integer) 1 >> (integer) 4|
|+219ms|║║Executed virtual command setVariable (3ms)|
|+227ms|║║Executed virtual command setVariable (4ms)|
|+238ms|║║Calculating (integer) 4 - (integer) 1 >> (integer) 3|
|+245ms|║║Executed virtual command setVariable (3ms)|
|+259ms|║║Calculating (integer) 4 - (integer) 1 >> (integer) 3|
|+265ms|║║Executed virtual command setVariable (4ms)|
|+273ms|║║Executed virtual command setVariable (5ms)|
|+309ms|║║Calculating (string) 1 + (string) % >> (string) 1%|
|+320ms|║║Calculating (string) 1% + (string) 4425 >> (string) 1% 4425|
|+326ms|║║Calculating (string) 1% 4425 + (string) K >> (string) 1% 4425K|
|+336ms|║║Calculating (string) 1 + (string) % >> (string) 1%|
|+344ms|║║Calculating (integer) 4425 > (integer) 0 >> (boolean) true|
|+368ms|║║Calculating (boolean) true == (boolean) true >> (boolean) true|
|+382ms|║║Calculating (boolean) true == (boolean) true >> (boolean) true|
|+390ms|║║Calculating (boolean) false == (boolean) true >> (boolean) false|
|+400ms|║║Calculating (enum) turningOff == (enum) on >> (boolean) false|
|+413ms|║║Executed virtual command setTile (2ms)|
|+417ms|║║Cancelling statement #226's schedules...|
|+424ms|║║Executed virtual command setVariable (4ms)|
|+441ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+448ms|║║Cancelling statement #229's schedules...|
|+453ms|║║Executed virtual command clearTile (1ms)|
|+469ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+475ms|║║Cancelling statement #229's schedules...|
|+480ms|║║Executed virtual command clearTile (1ms)|
|+496ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+503ms|║║Cancelling statement #229's schedules...|
|+508ms|║║Executed virtual command clearTile (1ms)|
|+525ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+531ms|║║Cancelling statement #229's schedules...|
|+536ms|║║Executed virtual command clearTile (1ms)|
|+553ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+559ms|║║Cancelling statement #229's schedules...|
|+564ms|║║Executed virtual command clearTile (1ms)|
|+580ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+587ms|║║Cancelling statement #229's schedules...|
|+592ms|║║Executed virtual command clearTile (0ms)|
|+608ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+615ms|║║Cancelling statement #229's schedules...|
|+620ms|║║Executed virtual command clearTile (0ms)|
|+637ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+643ms|║║Cancelling statement #229's schedules...|
|+648ms|║║Executed virtual command clearTile (1ms)|
|+665ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+672ms|║║Cancelling statement #229's schedules...|
|+677ms|║║Executed virtual command clearTile (0ms)|
|+694ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+701ms|║║Cancelling statement #229's schedules...|
|+706ms|║║Executed virtual command clearTile (1ms)|
|+724ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+732ms|║║Cancelling statement #229's schedules...|
|+738ms|║║Executed virtual command clearTile (1ms)|
|+756ms|║║Calculating (integer) 4 + (integer) 1 >> (integer) 5|
|+764ms|║║Cancelling statement #229's schedules...|
|+769ms|║║Executed virtual command clearTile (1ms)|
|+775ms|║║Cancelling statement #206's schedules...|
|+789ms|║║Calculating (decimal) 0.0 - (decimal) 1.0 >> (decimal) -1.0|
|+885ms|║║An error occurred while executing the event: java.lang.NullPointerException: Cannot invoke method hasCommand() on null object|
|+887ms|║╚Execution stage complete. (726ms)|
|+891ms|║Setting up scheduled job for Thu, Jan 3 2019 @ 4:19:13 PM GMT (in 104.32s)|
|+902ms|╚Event processed successfully (902ms)|

And then the Kitchen Worktop lights turned off with the following in the IDE logs:
16:21:42: info ╚ Received event [Kitchen worktop].switch = turningOff with a delay of 84ms

I should say this is a piston based on the ones created on the wiki here: https://wiki.webcore.co/Device_Tiles#Light_Bulb_Status_Tiles


#2

You have a LOT of code here but I don’t see it actually doing anything. You have more variables than anything else. But they don’t actually do anything. The piston you referenced was for adding the lights to your dashboard. Is that what you are trying to do? Or are you trying to control the light? Those aren’t the same thing.


#3

I had something similar when I modified a switch monitoring tile piston to add in power values and found that i was getting random switch on’s
It turned out for me it was the logic around the tilePressDeviceId logic which seems to get triggered

@MajorEvent posted this, where he puts an if around it to only trigger if the tile is pressed which seems to have done the trick for me…

Hope it helps

Phil


#4

Hi Ryan, that is the very issue, the piston is only for monitoring the lights via tiles on the dashboard. However, when this piston is running, odd behavior is occurring with Hue lights as described. If the tile piston is paused, the issue is resolved. Hence my confusion over how it is occurring.


#5

Hi Phil, Thanks so much for this, I will take a look and try to implement the fix and test it out. It has had me baffled for a few days now.

Best regards

Matt


#6

Phil’s solution worked perfectly, all behaving as it should now.


#7

I don’t think I can take the credit :wink: - I reused @MajorEvent’s work, but glad it worked!


#8

The thing about tilePressDeviceId is that it responds to events that aren’t tile presses (hence the seemingly random behavior) so by filtering on currentEventAttribute is tile, we limit the responses to tile presses only. This should also clean up the NullPointerException error that’s commonly associated with this issue.


#9

You see, that makes it sound like it’s turning on a light, not a dashboard tile. :slight_smile: Glad you got it working.