Mood Cube Piston


I originally imported the bulk of this piston from the ST community webcore thread. I searched and didn’t find it over here, so I thought I would post it. Unfortunately I can’t find the original post or author at this point either.

I made an addition to the piston to have the details in the piston state reflect the color of the mood cube. Yes of course if you are in the same room as the lights it might be redundant. But I thought it was a cool addition. Bonus points to my 9 year old son helping me with the edits.


Thank you for sharing! I imported your piston but made some changes that I believe you may have overlooked.

I used virtual devices for both the lights and sensor. You used one for the lights but then did not use it at the bottom of the piston to set those same lights to the desired color. I have not tested the piston yet as I am at another location.

I wonder how webcore translates the positional readings to down side up, left side up, etc. Hopefully it doesn’t require a custom DTH.


I made some changes to this piston to correct an issue when turning the lights off. Also I changed some colors for the tile and details.


Do you mind sharing what kind of cube you used? Did you custom make one?


This baseball case is what someone on ST forum suggested before, it works :slight_smile: stuck some colored dots on it.


I made a cube out of wine corks. I painted part of each side with a different color. You can see two black corks on top for off. Then at the bottom you can see the end of a cork painted purple and one painted red. So when that color side is up, that is the color you get in the room.


That’s a cool idea. I like it.

How do you gain access to the sensor?


the corks are all hot glued together except the top. You can see the silver nail heads in the four corners. You just pull the top off the reinsert the nails into the same holes to close.

The top, bottom and side posts are whole corks. The side walls are corks I cut in half, long ways. I have some filler inside to keep the sensor still.


Plus you get to drink the wine to get your corks.
Its a win win situation. :laughing:


Ugh!!! If I must…Although still kicking around @eibyer ‘s idea of using a baseball case.


I found the original post about the baseball holder.


I imported the piston, but I am unable to get it working. I do not see where the ST Multi sensor is reporting orientation as rear side up…ect. See below.

12/28/2017, 1:52:55 PM +40ms
+1ms ╔Received event [A Scene Cube].threeAxis = -990,43,10 with a delay of 179ms
+118ms ║RunTime Analysis CS > 11ms > PS > 81ms > PE > 26ms > CE
+121ms ║Runtime (43376 bytes) successfully initialized in 81ms (v0.2.101.20171227) (119ms)
+122ms ║╔Execution stage started
+129ms ║║Comparison (enum) front side up changes = true (0ms)
+130ms ║║Condition #21 evaluated true (3ms)
+130ms ║║Condition group #1 evaluated true (state did not change) (4ms)
+133ms ║║Evaluating switch with values [[i::0fb7c880d6e8db92f7ea5b8bf7a933a7::orientation, v:[t:enum, v:front side up, d::0fb7c880d6e8db92f7ea5b8bf7a933a7:, a:orientation, i:null, x:false, vt:string]]]
+136ms ║║Comparison (enum) front side up is (string) rear side up = false (1ms)
+139ms ║║Comparison (enum) front side up is (string) down side up = false (1ms)
+142ms ║║Comparison (enum) front side up is (string) left side up = false (1ms)
+144ms ║║Comparison (enum) front side up is (string) front side up = true (1ms)
+146ms ║║Cancelling statement #15’s schedules…
+149ms ║║Error executing virtual command [].setVariable: (1ms) groovy.lang.MissingPropertyException: No such property: result for class: script_app_webCoRE_Pi_19514eaf_6f2f_47d6_88e0_3ee12653e45f_ver_0_5 Possible solutions: request
+158ms ║║Executed virtual command setVariable (3ms)
+160ms ║║Cancelling statement #22’s schedules…
+163ms ║║An error occurred while executing the event: java.lang.NullPointerException: Cannot get property ‘v’ on null object
+166ms ║╚Execution stage complete. (45ms)
+167ms ╚Event processed successfully (167ms)


Someone mentioned having trouble with the ST sensor only to find out the newer ones doesn’t report 3-axis anymore?

Not sure if it’s accurate.


This is what I am seeing from the device in ST IDE.


Anyone tried this lately? I backed up from tr580 (shown above) and logs tell me I’m missing a curly brace or bracket.

2/20/2018, 5:31:06 PM +694ms
+1ms ╔Received event [Mood Cube].threeAxis = -23,1040,-11 with a delay of 388ms
+105ms ║An error occurred while executing the event: groovy.json.JsonException: A JSON payload should start with an openning curly brace ‘{’ or an openning square bracket ‘’. Instead, ‘-23’ was found on line: 1, column: 1
+107ms ╚Event processed successfully (107ms)

X axis of contact sensor not working in piston

I’m getting the same error. I haven’t edited the piston since October. I don’t use my mood cube everyday but this is the first I’m noticing that it’s broken. Maybe the minion on this thread has some insight? @eibyer


I’m not at the location where I have the mood cube so can’t really test it. It looks like from the errors everyone is getting that maybe ST did something to the handler? Not really sure.


Fwiw, my piston (almost identical to those posted above) used to work flawlessly, but I don’t use it a lot. Tried today, same errors as you guys posted. I already have a Support ticket going with ST on a different issue involving a Multi reporting negative axis numbers and not working right , so I just casually mentioned the MOODCUBE issue to see if maybe they know of a Multi sensor issue on their end. I’ll tackle it after the first issue is resolved



Is anyone else having trouble with their mood cube Pistons lately? Mine stopped receiving 3-axis events. The last time my Piston executed was on 3/12. The 3 axis events are present in the IDE log, but they don’t seem to be getting passed through to webcore. Other data from my mood cube device is making it to webcore - temperature for example. No other changes have been made to my setup.

Edit: actually, after double checking… IDE is not actually logging any 3 axis events. I’ll be opening a ticket with smartthings.