sendEvent to valueTile

I have the following code in my Device Handler. All I am trying to do is send the value 4.5 to display on the valueTile. However, it does not update with the value defined in the command sendEvent. All the tile shows is " - -". Any help would be appreciated. Thanks!

metadata {
definition (
name: “valueDeviceTile”, namespace: “xyz”, author: “zyx”) {

	capability "Sensor"

tiles(scale: 2) {
	valueTile("tex", "device.tex", width: 2, height: 2) {
		state "default", label: '${currentValue}'


def tex() {
sendEvent(name: “tex”, value: 4.5)

def parse(String description) {


define attribute "tex", "string" in the metadata

I tried that scenario and did again with no luck. still showing no value in the smartthings app. It’s as if the sendEvent is not updating the tile value?

Where are you calling tex() ?

Allan - I think that is what i am missing. I don’t know how tex() should be called to initiate the value update. suggestions? Ideally i would like the program to call tex() when there is a value change.

How does it get updates would be the question. Is this a physical device or a virtual device? If physical it would probably be part of your parse function. If its virtual then there should be a function being called by something else (parent device, smartapp, etc). Something need to call a function that then does the sendEvent.

1 Like

For learning purposes I am trying to accomplish this using a Virtual device. later on I would like to connect to a physical device to update the value of a temperature, for example.

Is there something I can add to the code to enable a virtual device to make the call to sendEvent?

You can add a when updated so when you do a configure on the device and hit done it will run:

def updated() {
sendEvent(name: “tex”, value: 4.5)

works like a charm! Thanks!