Need help with value tile

Hello,

I am trying to understand how tiles are created and I am trying some of the sample code I see on docs.smartthings and some things are not working like they show in the examples…

For Example:

tiles(scale: 1)

{

valueTile("pi", "device.pi", width: 3, height: 1) {
    state "val", label:'${currentValue} number', defaultState: false
    
}   

}

def installed() {

sendEvent(name: "pi", value: 3.14159)

}

This returns 3.14159 number only in virtual. But when I try to install it into a device I created to see on the mobile app I get an empty tile.

Am I missing something?

Thank you.

Virtual:
image

With device:

image

I resolved the issue by deleting the device and re-adding it. Also added attribute.