Device.value vs getDataValue

I’m looking for clarification on device.value as seen in these docs compared to getDataValue.

// use of device.value
void deviceDescriptionHandler(physicalgraph.device.HubResponse hubResponse) {
    def body = hubResponse.xml
    def devices = getDevices()
    def device = devices.find { it?.key?.contains(body?.device?.UDN?.text()) }
    if (device) {
        device.value << [name: body?.device?.roomName?.text(), model: body?.device?.modelName?.text(), 
serialNumber: body?.device?.serialNum?.text(), verified: true]
    }
}

// use of get data value
def sync(ip, port) {
    def existingIp = getDataValue("ip")
    def existingPort = getDataValue("port")
    if (ip && ip != existingIp) {
        updateDataValue("ip", ip)
    }
    if (port && port != existingPort) {
        updateDataValue("port", port)
    }
}


// building device with standard addChildDevice
def params = ["label":"something","completedSetup":true,[data:["verified":true]]  //tried with and without the verified
device = addChildDevice("tagyoureit", lightGroup, childMac, hubId, params)
device.getDataValue("verified") // is true
device.value << ["verified":true] // throws error 
device.value.verified // of course doesn't work either.

I’m building a smart app with a composite device that has children. I am looking for a way to verify the children and the

 device.value << [verified: true]

looked like it might be a solution. But it doesn’t appear that

getDataValue("verified") == device.value.verified

Can someone articulate how device.value is used in the example referenced? TIA!

1 Like