Dumping object properties and values?

Trying to figure out how to dump object properties to log. I’ve tried dump() without any luck.

Specifically, I’m trying to figure out how to get the device type from a device class.

I went through the same thing. Not sure where dump() ends up but it’s not int he IDE’s log. Here’s some code I have that responds to a request to list configured sensors. The property you want is typeName.

def listSensors() {
    log.trace "in listSensors"
    def sensors = [:]
    def devs = getChildDevices()
    devs.each {
    	def name = it.displayName
        def zone = it.getZone()
        def id = it.deviceNetworkId
        def type = it.typeName
	def sensor = [zone: zone, name: name, type: type, networkID: id]
	sensors[zone] = sensor
    	log.debug "device is *${name}*, zone: *${zone}*, id: *${id}*, type: *${type}"
    log.debug "child devices: $devs"
1 Like

Thanks Linda. Seems so obvious now, I’ll give it a try.