How can I get temperature immediately from ST motion sensor?

smartapp
motionsensor
temperature

(Wanho Im) #1

I use ST motion Sensor for getting the temperature.

but it is not reported in SmartApp when the temperature is changed.

I think the temperature checking interval is fixed also very long and it reports temp when it is changed.

I want to know how can I set this temp checking interval shorter?

Thanks.


(Alan) #2

How about a CoRE such as this. It’s a timer that you can set by minutes to run a check on the temperature.

Update I added the refresh as described below to ‘goose’ the sensor to update itself. In a small test, I did find it worked.

I’ve updated an example and added it to the Variables 101 page:
Case Study - Average Temperature


#3

From SmartThings smartsense motion sensor default DTH.

zigbee.temperatureConfig(30, 300) 

This line in the configure method means a minimum of 30 seconds, maximum 300 seconds. So if the temperature changes a degree it will report it at least every 30 seconds. If it doesn’t change it will report it at 5 minutes.

So the device itself will send responses at those intervals but SmartThings then chooses to update its temperature event when isStateChange=true (that is the event SmartApps use). So this usually only happens when the temperature actually changes a degree.

If you are not getting responses in those timeframes in the live IDE logs, I’d look at readding the motion sensor and/or replacing the battery.


Original & Aqara Xiaomi Zigbee Sensors (contact, temp, motion, button, outlet, leak, etc)
(Wanho Im) #4

I used zigbee.temperatureConfig but I get error message

java.lang.NullPointerException: Cannot invoke method temperatureConfig() on null object @ line 25

Below is my code.

def initialize() {
    log.debug "called initialize"
    zigbee.temperatureConfig(30, 300)
    subscribe(d_temperature, "temperature", "onDeviceEvent")
}

also what is DTH?


(Wanho Im) #5

What is a CoRE? is it an extended program?


(Alan) #7

CoRE is an extension:
http://thingsthataresmart.wiki/index.php?title=CoRE

If that interests you, there are many other threads here you can search for on the subject of core.


(Wanho Im) #8

Core does not help to get the new temp from the motion sensor.

it just gets the temp from Smart app’s data reported lastly.

is it right?


(Alan) #9

I don’ t have that knowledged. Perhaps others with more familiarity with the device can answer this.


(Wayne) #10

Sending a refresh command to the device will give you the latest temperature if it has changed.


#11

A DTH is a device handler. You are writing a SmartApp so zigbee.temperatureConfig(30, 300) will not work. You are subscribing to the correct event in your SmartApp so I’m not exactly sure what you are asking. The event will “fire” when isStateChange=true occurs in the device’s DTH (pretty much only when the temperature changes).

If you want to read the current temperature of the device you would do something like device.temperature. If you want to read it at specific times you would need to use scheduling.