So I’m working on building a device type to handle a Nest thermostat. The only way I have to communicate with it is through a web service (I’m using a middle man so I don’t have to figure out the Nest API yet).
So far I have the web service functioning and the simulator commands all seem to work.
It looks like tile updating has to be done by returning the results of createEvent from the parse method. I copied the tile setup from the Z-Wave Thermostat sample as I couldn’t find any documentation for tiles.
I’m using the poll method to retrieve the current status of the thermostat. Will that method be called automatically or do I have to schedule it? Can it be scheduled?
For example, if you have a temperature tile for which you received 68.8 from your remote service and you wanted to round that to the next Integer and display with a “F” unit:
@dianoga – You can set up a default tile state using the device’s last known values by doing:
valueTile("temperature", "device.temperature") {
state "default", label:'${currentValue}°', unit:"F", action: "refresh",
}
where ${currentValue} should pull the last known value for device.temperature.
As for scheduling the poll, my understanding is that if the Device-Type Handler implements poll(), it will be called automatically by the system at 5 minute intervals, and that interval is not currently configurable.
@dlieberman It looks like poll isn’t being called as expected. When I ran the device in the simulator and manually hit poll it did set the device state, but it hasn’t updated since yesterday.
1/ You need to have the Polling capability selected in the Device Type Settings
2/ Virtual devices don’t get polled in the simulator
3/ I was just told that there might be an issue introduced in the latest release of the platform that is affecting poll()
I asked Engineering to keep me in the loop on #3 - I’ll post back here when I hear more, and I’ll do some additional testing on my own.
I setup my device type to support polling. I also deleted and readded my device just to make sure the settings get updated. I’m not sure how publishing device types is supposed to work since the publish button doesn’t seem to do anything.
The poll hasn’t run on it’s own yet. I’ll keep an eye on it.
@dianoga – Did you add your device through the My Devices page in the IDE? If it shows up there as a Device Type that you can manually add, then it’s been published into your account (Publish -> For Me). Make sure you do Publish -> For Me after each time you’ve made changes, then delete and re-add the device in the My Devices page for good measure.