Scheduler and Polling quits after some minutes, hours, or days

I have five zxt-120 IR sending thermostats in my home and they all fail to get polled. I also have two Aeon Power Monitors with the same issue.

I contacted support months back and they said they knew polling was not working all the time but had no resolution.

One way to solve this is to add a scheduled event to your device. This is actually what the pollster smart app does and then calls your devices poll command. The problem with this is that this too is broken in Smart Things. It is a known issue that timed events sometimes get missed and once they are missed the next event is never scheduled. So unless you open the device and re-configure your schedule it stops working.

So I have used both pollster and scheduled events for my devices. That works but randomly stops working. So I can’t rely on polling.

But here is the part that I don’t understand. Why doesn’t every one scream about this issue ? What good are z-wave sensors that fail to report because polling is not working ?

Some newer devices like my Fibaro Motion Sensor which has temperature and other sensors actually post their data so there is no need for polling and they work well. But my older model Aeon Power Monitor and my zxt-120 devices all need polling and are therefor useless with ST if you care about reliability.

So my bottom line question is doesn’t anyone else care that polling is broken and scheduled events are unreliable ?

2 Likes

@april Might as well merge these as well


and

and

and

I am sure there are more but it has still never been resolved by support.

I started a new thread in the hopes that we could get rid of the noise and just have support realize these two issue exist and should really be addressed.

Also this merge lost the fact that I was addressing Polling AND Scheduling, not just scheduling.

Don’t feel like this belongs in Devices & integration category but don’t see any categories good for asking about issues with ST. Anyway I have to zxt-120 ir sender’s which act like thermostats and report temp. The polling which was working fine up until Tuesday 2.24.15 isn’t working correctly anymore. One device was last polled 26 hours ago and the other was polled 6 hours ago.

Is anyone else having issues with polling ?

Not polling, specifically, but for the last week many different community members have been reporting new problems with actions never occurring, from sunset triggers to simple motion detector switches. (I’ve had problems with both.) The requests get sent to the hub, but never come back from the cloud.

http://status.smartthings.com

Sounds like you might have run into the same thing, just with a different command.

Report it to support and see what they say.

FWIW.

1 Like

Strange, one of my devices has not had activity since Thursday (today is Saturday)
The other has activity all day yesterday so the polling was working fine yesterday. Today nothing again.

I think polling doesn’t work !

I submitted ticket to support. I had a reply that they wanted to run a network repair. I replied that they could but I never heard back. No idea if they tried that and no idea if any progress has been made on their side.

Yes, that’s why Pollster is there to help.

I wonder why ST support doesn’t know that polling doesn’t work. When I submitted support request they are asking to repair my network and asked if my devices are possibly out of range. My devices are 10ft from hub and they work fine for manual refresh and any actions like AC on AC Off etc. So I know the zwave signals are fine.

It never worked reliably. Support just has no clue. See this

… and this

… and this

I have created a custom Device Type and specified the capability “Polling”. Also wrote a poll() method. But the problem is that it is never called. When I manually refresh, it is working and the value is updating. I checked the log also and nothing is there, if I manually refresh the log is coming.

I saw couple of posting regarding this here but no concrete answer is given, could some help me to figure out the issue?

I’ve run into issues with polling, as well. See this tread, for example. Others have reported problems, as well.

As a work around, try to generate an event (sendEvent) inside your poll method, every time the method is called. It’s important to do that even though no state has changed. Does that make sense? Give it a shot and let us know if it helps.

Thanks @florianz for the help!.

I am using two sendEvent to update the Temperature and Humidity, but still not getting called, is this what you mean or I am something here?

Yeah, that’s what I meant. The only caveat is that you really have to send the event, even if the temperature or humidity values did not really change from when you polled the last time.

As an experiment, can you create a dummy timestamp attribute, which you simple update to the current time by sending an event on every invocation of the poll method. That way the attribute value is guaranteed to change every time. If that works, we can go from there.

Also, make sure that you are not running your device handler in the simulator. poll will not be invoked if any instance of your device type handler is running in the simulator. Make sure to terminate all open simulator sessions, by clicking the ‘X’ in the ‘Sessions’ column under ‘My Device Types’ in the IDE.

Also looping in @urman, because he has helped me with this in the past.

Thanks @florianz!, let me try and update it here.

@florianz, I tried but not working, I am posting my code here, basically I am trying to get Temperature and Humidity from my Spark Core. Could you please check and advice?

/**
 *  Spark Core Temperature & Humidity Sensor
 *
 *  Copyright 2014 Krishnaraj Varma
 *	
 *	INSTALLATION
 *	------------
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */
 
preferences {
    input("deviceId", "text", title: "Device ID")
    input("token", "text", title: "Access Token")
}

metadata {
	definition (name: "Spark Core Temperature Sensor", namespace: "krvarma/sparktemperature", author: "Krishnaraj Varma") {
		capability "Polling"
		capability "Temperature Measurement"
        capability "Relative Humidity Measurement"
        capability "Sensor"
	}

	simulator {
		
	}

	tiles {
		valueTile("temperature", "device.temperature", width: 2, height: 2){
            state "temperature", label: '${currentValue}°C', unit:"",
            	backgroundColors: [
                    [value: 25, color: "#202040"],
                    [value: 30, color: "#202080"]
                ]
		}
        
        valueTile("humidity", "device.humidity", width: 2, height: 2){
            state "humidity", label: '${currentValue}%', unit:"",
            	backgroundColors: [
                    [value: 50, color: "#202040"],
                    [value: 80, color: "#202080"]
                ]
		}
        
        standardTile("refresh", "device.temperature", inactiveLabel: false, decoration: "flat") {
            state "pollsensors", action:"polling.poll", icon:"st.secondary.refresh"
        }
        
		standardTile("timestamp", "device.timestamp", inactiveLabel: false, decoration: "flat") {
            state "default", action:"polling.poll", icon:""
        }
        
        main "temperature"
		details(["temperature", "humidity", "refresh"])
	}
}

// handle commands
def poll() {
	log.debug "Executing 'poll'"
    
    getTemperature()
}

// Get the temperature & humidity
private getTemperature() {
    //Spark Core API Call
    def temperatureClosure = { response ->
	  	log.debug "Temeprature Request was successful, $response.data"
      
      	sendEvent(name: "temperature", value: response.data.return_value)
	}
    
    def temperatureParams = [
  		uri: "https://api.spark.io/v1/devices/${deviceId}/getTemp",
        body: [access_token: token],  
        success: temperatureClosure
	]

	httpPost(temperatureParams)
    
    def humidityClosure = { response ->
	  	log.debug "Humidity Request was successful, $response.data"
      
      	sendEvent(name: "humidity", value: response.data.return_value)
        sendEvent(name: "timestamp", value: response.data.published_at)
	}
    
    def humidityParams = [
  		uri: "https://api.spark.io/v1/devices/${deviceId}/getHum",
        body: [access_token: token],  
        success: humidityClosure
	]

	httpPost(humidityParams)
}

Sorry @krvarma, I am totally out of ideas. Your device handler looks great. I don’t see why the polling should not work, other than due to the known brokenness surrounding that feature.

If you are frustrated and willing to implement a total hack to get you unstuck: You can write a very simple ‘Scheduler’ SmartApp, which takes a list of devices with polling capability and simply calls the poll method on those devices from within a cron scheduler callback, say every 10 or 15 minutes.

I am hoping that you won’t have to go there, and that @urman will be able to shed some light on how to work around the existing polling bugs.

1 Like

Thanks @florianz!

Polling is an important feature as far as SmartThings and Custom Device Types are concerned. I think it needs some immediate attention from SmartThings team.

I am waiting for @urman’s reply (pinging @urman).

@florianz, do you think runIn will help?

@krvarma, I wrote my first custom device and was having exactly the same problem as you. I had to write the app that @florianz suggested. It’s a bit of a hack but has been working great for a couple of days now.

runIn didn’t work for because it’s not supported in the Device class.

Be nice to have polling working correctly though.

1 Like

Thank you @sherrell and @florianz!, let me do Scheduler and update the result here.

Poll is a bit funky. It was built only as a device heartbeat to ensure its status on the network. It will stop running if there are a lot of events, it will stop if the poll returns nothing, and lots of other use cases that make it stop.

We have discussed adding cron to device types but though it may end up causing a lot of unnecessary network traffic. What we settled on was a Service Manager SmartApp architecture where a SmartApp calls functions on the device type using cron.

It would be good to a have a Poll SmartApp that device type developers can use to test with.

1 Like

I’m struggling with this myself at this moment. My device type has polling capability which calls a method on Service Manager. This works for a while and then it dies. Now I know why.

It would be great if there was a knowledge base for this type of gotchas.

1 Like