Device Tiles


i have been reading for several hours now, but couldnt find what i was searching for.
I am trying to add some new tiles to an existing device. I have succeded in showig the tile on the screen, but i cannot populate it with the values that i want.

So in order to see where my issue is, i wanted to try to duplicate a tile i already have.
So i would first
duplicate the value tile (plus different name):

valueTile(“XX”, “device.XX”) {
state “default”, label:’${currentValue}’
valueTile(“XX2”, “device.XX”) {
state “default”, label:’${currentValue}’

then Add it to the details:

then copy the def zwaveevent:
def zwaveEvent(physicalgraph.zwave.commands.meterv1.MeterReport cmd) {
if (cmd.scale == 0) {
createEvent(name: “XX”, value: cmd.scaledMeterValue, unit: “Z”)
else if (cmd.scale == 1) {
createEvent(name: “XX2”, value: cmd.scaledMeterValue, unit: “Z”)

I was hoping to get the exact same value, in both tiles. However, my second tile always stays empty…what am i missing?

1 Like

Based on your code it looks like you want XX to have a value if scale = 0 and XX2 to have a value if scale = 1 so they wouldn’t have the same value.

In order to get the above to work, you would need to define an attribute for XX2 and use device.XX2 instead of device.XX.

Thank you! I finally managed to do it.
And, yes, it is possible to show the same value twice.

Had to learn that the scale = the actual value.
So basically this means pointing both device.XX and device.XX2 to the same scale.

1 Like

Thank you, that’s good to know, but why would you want to do this?

It was to learn how this whole thing works… the smartthings documentation didn’t help me.
In the end, i managed to add a custom tile that shows the costs i have from kWh usage with my Energymeter.
For that i first copied the Value, and then did the simple calculation to this value.

Since this was for learning purposes, I just want to point out that the createEvent line has nothing to do with the tile name.

If you have multiple tiles with different names, but they’re all using “device.XX”, the createEvent(name: “XX”… line will update all of those tiles. If you added additional createEvent lines, they’re not actually doing anything and should be removed.

1 Like