You can also use device.currentValue(attribute)
where attribute
is one of the attributes you identified.
This is from Docs > Reference Material > Class Definitions > Device
if (!device) {
log.debug "Device not found"
} else {
log.debug "device attributes ${device.supportedAttributes}"
log.debug "device switch value ${device.currentValue("switch")}"
}
You can also use device.currentState(attribute)
then access one of the properties of the state class. For example:
def state = device.currentState("switch")
log.debug "time: ${state.date} value: ${state.value}"