Rolling dice using a Tile

Thought you guys might enjoy this little ditty:


Behind this tile sits a Custom Command, which tells Hubitat to set the value of a Hub Variable (‘testString’) to underscore ('’) when clicked/Tapped.

This, in turn, triggers two things: (a) hubiVue changes the icon and activates ‘Glow’ style; and, (b) Rule Machine triggers this rule:

All the rule does is generate a random integer between 0 and 5, add 1 to the result, then pass the answer to the Hub Variable linked to the Tile.

Where, as a final touch, hubiVue changes the icon yet again, using Style Overrides, according to the Variable’s value. The label at lower-left derives from a Label Override composed of a Prefix (='You rolled a ') and the Variable value (here, ‘3’).

Have fun, guys!

NOTES

  • Of course, I could have done all the ‘icons’ as text emojis simply by setting the appropriate strings in RM, but wanted to demonstrate conditional Tile styles here.
1 Like

Totally missed on opportunity here…

EDIT > STYLES > [+] Add >
IF
[variable] CONTAINS _ (underscore)
THEN
Icon Rotate (Fast)

Completes the “tumbling dice” effect beautifully! :heart:

1 Like

Definitely needs to be the video showcase !!

1 Like