Writing device type for zxt-120 but it's not updating unless I refresh

I am working on a new driver for the ZXT-120. I am finding that it doesn’t update it’s temperature value unless I select refresh.

I thought I needed to add poll capability and found this thread.

But looking at sample code for “Aeon Multisensor” which works fine in my ST I don’t see any polling code.

I do see this config code

def configure() {
		// send all data (temperature, humidity, illuminance & battery) periodically
		zwave.configurationV1.configurationSet(parameterNumber: 101, size: 4, scaledConfigurationValue: 225).format(),
		// set data reporting period to 5 minutes
		zwave.configurationV1.configurationSet(parameterNumber: 111, size: 4, scaledConfigurationValue: 300).format()

But this looks specific to the Aeon Multi.

Is polling the correct way to do this or are sensors different since they are intended to send data ?

On a side note. I am trying to add a “Last Polled” tile to display the date/time of the last poll.
// Last Poll Tile
standardTile(“lastPoll”, “device.lastPoll”, inactiveLabel: false) {
state “lastPoll”, label:‘${currentValue}’

But I can’t figure out how to populate the device.lastPoll value in my poll method. Forgive me if this is just a simple groovy command. I am new to groovy and still trying to figure out what is Groovy API and what is ST API. I think I need to create an event but not sure how. I tried the following in poll and I know it gets hit when I select refresh.

def now=new Date()
def nowString = now.format("MMM/dd HH:mm")
sendEvent("name":"lastPoll", "value":nowString)

A quick peek at the spec sheet doesn’t reveal any configurable automatic reporting, so it looks to me like polling is the only way to force it report.

Yeah, only some devices can be configured to automatically send updates. If the device doesn’t have a way to do that you can add the Polling capability.

For the “last polled tile” you want a valueTile, not a standardTile:

valueTile("lastPoll", "device.lastPoll", inactiveLabel: false, decoration: "flat") {
    state "lastPoll", label:'${currentValue}'

and you also need to add attribute "lastPoll", "string" to the definition section.

@duncan Thanks, for spotting my mistakes. Works like a charm now. I had some issues with getting the timezone right but figured that out.

@Mike_Maxwell that’s what I thought. Seems like a temperature sensor should but I have the polling working now.

1 Like