Custom DH not working in New App

I have written several custom DH in the past and all work fine in the classic app. The new app, on the other hand, totally messes them up. As an example, below are screenshots of my UPS unit. Currently, the classic app continues to display each attribute correctly. The new app on the other hand :frowning: Is there something I need to do to each of my custom DH to make them work properly in the new app?

This is the DH I use for the above device

/**
 *  UPS Device*
 *  Author: C Dikland *
 *  Date: 2018-05-05
 */
// for the UI
metadata {
	// Automatically generated. Make future change here.
	definition (name: "Cyberpower UPS Tile v1", namespace: "cdikland", author: "CK Dikland") {
		capability "Battery"

		attribute "comm_lost", "string"
		attribute "model_name", "string"
		attribute "power_supplied", "string"
		attribute "voltage_condition", "string"
		attribute "ups_load", "string"
		attribute "battery_situation", "string"
		attribute "battery_capacity", "string"
		attribute "input_voltage", "string"
        attribute "output_voltage", "string"
		attribute "load_level", "string"
		attribute "current_watt", "string"
		attribute "remain_runtime", "string"
		attribute "last_event_date", "string"
		attribute "update_time", "string"

		command "refresh"
	}
/****************************************************************************************
	preferences {
		input "zipCode", "text", title: "Zip Code (optional)", required: false
	}
*********************************************************************************************/
	tiles {
		valueTile("comm_lost", "device.comm_lost") {
			state "default", label:'comm_lost ${currentValue}',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("model_name", "device.model_name") {
			state "default", label:'model_name ${currentValue}',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("power_supplied", "device.power_supplied") {
			state "default", label:'power_supplied ${currentValue}',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("voltage_condition", "device.voltage_condition") {
			state "default", label:'voltage_condition ${currentValue}',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("ups_load", "device.ups_load") {
			state "default", label:'ups_load ${currentValue}',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("battery_capacity", "device.battery_capacity") {
			state "default", label:'${currentValue}%',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}
		
        valueTile("battery_situation", "device.battery_situation") {
			state "default", label:'${currentValue}',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("input_voltage", "device.input_voltage") {
			state "default", label:'Input ${currentValue}V',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("output_voltage", "device.output_voltage") {
			state "default", label:'Output ${currentValue}V',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("load_level", "device.load_level") {
			state "default", label:'Load ${currentValue}%',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("current_watt", "device.current_watt") {
			state "default", label:'Draw ${currentValue}W',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("remain_runtime", "device.remain_runtime") {
			state "default", label:'Remain Time ${currentValue}',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}

		valueTile("last_event_date", "device.last_event_date") {
			state "default", label:'Last Event Date ${currentValue}',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}
		valueTile("update_time", "device.update_time") {
			state "default", label:'Last Update ${currentValue}',
				backgroundColors:[
                	[value: 19, color: "#9F8ACD"],
					[value: 31, color: "#153591"],
					[value: 44, color: "#1e9cbb"],
					[value: 59, color: "#90d2a7"],
					[value: 74, color: "#44b621"],
					[value: 84, color: "#f1d801"],
					[value: 95, color: "#d04e00"],
					[value: 96, color: "#bc2323"]
				]
		}


		main(["battery_capacity", "battery_situation","input_voltage", "output_voltage", "load_level", "current_watt" , "remain_runtime", "update_time","comm_lost","power_supplied","voltage_condition","ups_load"])
		details(["battery_capacity" , "battery_situation","input_voltage", "output_voltage", "load_level", "current_watt", "remain_runtime", "update_time","comm_lost","power_supplied","voltage_condition","ups_load"])}
}

// parse events into attributes
def parse(String description) {
	log.debug "Parsing '${description}'"
}

def generateEvent(Map results) {
  results.each { name, value ->
    sendEvent(name: name, value: value)
  }
  return null
}



def refresh() {
}

def configure() {
}

Yup, you need to update your DTH for the new app to use a custom VID and attributes/capabilities. Here’s some reading material for you:

3 Likes

Ugh… This does not look like a lot of fun. Another reason to hate this new app :frowning:

3 Likes

It’s not, and the CLI is still wonky, which you’ll quickly discover when you realize why changes you make don’t work and realize caching issues exist, and/or you have to spoof DTH’s to force changes.

That CLI developer preview link is one you should really read through because there are good lessons learned in there.

A few things to note
If you’re using standard capabilities it’s much easier to get them to display, you may not even need a custom CLI. You can also use the developer workspace GUI tool to display standard capabilities
For custom it’s a bit of a learning curve but if you’re only displaying text (not controls), it’s a little easier. The one thing to keep in mind that you need to create a separate custom capability for each custom control you want to display. So if you want to display 5 text messages you need to create 5 custom capabilities and a presentation for each one (it’ll be a copy paste job but they need to be separate)

1 Like