Polling time


#1

i “think” i need to adjust the polling time in a device handler. can someone point me in the right direction.

The reason being. when i close a gate its set on a timer to wait about 4 minutes or so before it closes but it looks like ST checks its state before it has given it time to close so the state goes back to open and stays that way even after the gate is closed.

I may be way off on it being the polling time im no coder and only guessing


#2

maybe its not polling… that i am looking for but how can i adjust the time it checks the device for open and close?


(Mike Maxwell) #3

Devices in st issue state changes to apps that have subscribed to them, any other requests for a device state will return the last known state of the device.
So in the case of a contact sensor, there is no need to ask (poll) the device for its current state, as st should already know what it is.
If the device in the mobile app isn’t reflecting the actual state of the contact sensor in question, that’s a different issue that needs to be resolved before attempting to use that device in any apps.


#4

I have no contact sensor on this device. i actually just noticed what it was doing today and if no sensor means the state cant be updated properly that’s ok.

the handler only calls on an http site to open and a different http site to close


(Mike Maxwell) #5

Oh, well the handler is the device…
In any event if the device doesn’t include a method to provide feedback, it’s going to make this a bit tough to use.


(Michael) #6

1st, big thank you to you, @Mike_Maxwell. I’m still a newbie and haven’t posted much, but I perk up every time I see one of your posts since I know I’ll learn something new in it…

Question about this comment though. I see the Polling capability in the SmartThings documentation and have seen issues with some devices in that the state isn’t instantly updated - some due to configuration (something else I learned from one of your posts) and some due to hardware capabilities. Would these be the cases in which that capability would be used?


(Mike Maxwell) #7

ideally you want devices (or external integrations) that report state changes as they happen, when you have such devices there is no need to poll them for their current status.
This is easy to figure out with devices such as motion. contacts, thermostats, dimmers and switches.
You open the mobile app, walk over to the device, make some change to it, see if it updates in the app.
If it does, all good, if not, well at lease now you know.
(The above presumes, that your hub, the device and ST are all function correctly of course)
Some devices that don’t report can be changed via programming, some can’t.
For those that can’t report state changes in a reasonable time, if ever, that’s where polling comes in.
Folks use pollster, RM or roll their own for this.
In order to poll a device, the device needs to support the capability polling and or refresh, generally refresh if implemented in the DTH is exposed in the device details where it can be activated manually.