Value tile or displaying a value (new app)

I have a Webcore program that increments a time duration for every minute a switch is on. It reports a cumulative daily time and resets at midnight. Right now, it’s writing to a device with a device handler called “Webcore Value Tile”.

The device used to display the cumulative time in the Things menu in the old app (as 00:00:00 or hh:mm:ss). In the new app, it looks like an on/off switch with no value display.

Are there any device handlers that can allow me to create such a device with the new app, such that I can see the cumulative time in the home screen?

Thanks!

Yes there is, @guxdude has already done a very neat one…

2 Likes

Thanks @Alwas , this seems to be working well. It reverted to “Value A” at some point while I was testing it, not sure if it was because I went in to the settings and accidentally reset it. Is there a way to eliminate the input from the device handler and just let Webcore set it instead?

Any time the value is updated in the app, a flag is set in the DTH. If you use a piston like in this post:

Then you can reset the value to the webcore desired value any time it changes., The piston currently is set up to synchronize the app value with webcore global variables but you could always just face the value to stay the same.

Does this functionality/DTH still work nowadays or did SmartThings kill it?
I had the idea of using it and updating the device labels via a webcore piston to display current locations for my various webcore presence sensors.
I installed the DTH, created a new device with it, and have a piston that’s updating the device label (verified via ST IDE logs) but the device does not show the label in the SmartThings App. In the App the device just shows a Status label that shows as Connected.

I am still using it for a couple of different cases, but I can’t recall if I did anything to adjust when the newest app and “standard” device drivers came to be.

I don’t know how well this will cut and paste, but this is a version I’ve been using. I do notice the comments say “with new app support”, so perhaps you are using an older version that wasn’t updated for the new app.

Code follows:

/*
Value tiles with adjustment capability-with new app support
*/

metadata {
definition (name: “Value Tile”, namespace: “guxdude”, author: “guxdude”, “vid”: “d55576bc-0a21-3f23-ba43-d04d9e485d8e”, “mnmn”: “SmartThingsCommunity”
) {
capability “dictionaryfabric11101.adjustTextA”
capability “dictionaryfabric11101.adjustTextB”
capability “dictionaryfabric11101.adjustTextC”
capability “dictionaryfabric11101.adjustTextD”
capability “dictionaryfabric11101.adjustTextE”

	capability "Health Check"
    capability "Refresh"
    
    attribute "GVstatus", "string"

	command ResetGV
 } // End of definition
 
tiles(scale:2) {
    valueTile("Label1", "labelA", width: 6, height: 2, decoration: "flat") {
		state("val", label:'${currentValue}', foregroundColor: "#000000", backgroundColor: "#FFFFFF", defaultState: true )
	}
    valueTile("Label2", "labelB", width: 6, height: 2, decoration: "flat") {
		state("default", label:'${currentValue}', foregroundColor: "#000000", backgroundColor: "#FFFFFF" )
	}
    valueTile("Label3", "labelC", width: 6, height: 2, decoration: "flat") {
		state("default", label:'${currentValue}', foregroundColor: "#000000", backgroundColor: "#FFFFFF" )
	}
    valueTile("Label4", "labelD", width: 6, height: 2, decoration: "flat") {
		state("default", label:'${currentValue}', foregroundColor: "#000000", backgroundColor: "#FFFFFF" )
	}
    valueTile("Label5", "labelE", width: 6, height: 2, decoration: "flat") {
		state("default", label:'${currentValue}', foregroundColor: "#000000", backgroundColor: "#FFFFFF" )
	}

	// "Value1" will appear in the things view
	main(["Label1"])
    // these tiles will appear in the Device Details view
    // (order is left-to-right, top-to-bottom)
	details([
    "Label1",
    "Label2",
    "Label3",
    "Label4",
    "Label5" ])
}  // End of tiles

preferences {
  //  input name: "GVup", type: "boolean", title: "Updated", description: "Settings updated", required: true, defaultValue: false
}   // End of preferences   

} // End of metadata

def installed() {
sendEvent(name: “labelA”, value: “null”, displayed: false)
sendEvent(name: “labelB”, value: “null”, displayed: false)
sendEvent(name: “labelC”, value: “null”, displayed: false)
sendEvent(name: “labelD”, value: “null”, displayed: false)
sendEvent(name: “labelE”, value: “null”, displayed: false)

sendEvent(name: "GVstatus", value: "start", displayed: false, isStateChange: true)

}

def updated() {
sendEvent(name: “GVstatus”, value: “update”, displayed: false, isStateChange: true)
}

def setLabelA(value) {
textChange(“labelA”, value)
}

def setLabelB(value) {
textChange(“labelB”, value)
}

def setLabelC(value) {
textChange(“labelC”, value)
}

def setLabelD(value) {
textChange(“labelD”, value)
}

def setLabelE(value) {
textChange(“labelE”, value)
}

def textChange(String valString, String newval) {
Logger(“valueChange: ${valString} Target ${newval}”)
sendEvent(“name”:valString, “value”:newval, displayed: true)
sendEvent(name: “GVstatus”, value: valString, displayed: false, isStateChange: true)
}

def ResetGV() {
sendEvent(name: “GVstatus”, value: “clear”, displayed: false, isStateChange: true)
}

def Logger(String logString) {
log.info(logString)
}

1 Like

Thanks for the help @mooch91 , I got it working with that DTH!
How is the device getting the label titles? I don’t see First Label, Second Label specifically in the DTH so I’m guessing it’s derived or set by the capabilities somehow? I’d like to change them but I’m blanking out at the moment on how to do that…

The labels are set in the capability presentations. You’d need to work through the CLI to have them show differently.

dashboard:
  states:
    - label: '{{labelA.value}}'
  actions: []
  basicPlus: []
detailView:
  - label: First Label
    displayType: textField
    textField:
      command: setLabelA
      value: labelA.value
    state: null
automation:
  conditions: []
  actions: []
id: dictionaryfabric11101.adjustTextA
version: 1