# Questions about temperature data in ST

**URL:** <https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956>\
**Category:** Devices & Integrations\
**Created:** [December 10, 2014, 5:58pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956 "2014-12-10T17:58:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![AaronZON](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/aaronzon/32/13303_2.png) [@AaronZON](https://community.smartthings.com/u/AaronZON)\
**Post date:** [December 10, 2014, 5:58pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/1 "2014-12-10T17:58:25Z")

</div>

Based on my only marginally informed review of this code from the SmartSense Motion/Temperature Sensor Device Type . . . .

```
def getTemperature(value) {
	def celsius = Integer.parseInt(value, 16).shortValue() / 100
	if(getTemperatureScale() == "C"){
		return celsius
	} else {
		return celsiusToFahrenheit(celsius) as Integer
	}
}

```

. . . . I’ve concluded that the raw form of temperature that ST gets from the sensor is °C x 100. then, the Device Type Handler converts to °C by dividing by 100 and then converts to °F if necessary and rounds/truncates to an integer. Please let me know if I have any of this wrong and if there is a reference somewhere that spells this out.

So, it seems like if I want a SmartApp to use temperature to a tenth degree resolution, I have to also create a new Device Type Handler. Right?

This doesn’t seem difficult but then you have a SmartApp dependent on the use of a particular Device Type Handler. Is there a way, instead, for the SmartApp to ‘go around’ the Device Type Handler and pick up the raw value? Alternately, is there a mechanism available to a SmartApp to verify that a device is using a preferred Device Handler Type?

Don’t take this as argumentative, (and this comment may not be valid depending on the response to the above) but how was it decided that no application is going to care about tenths of a degree? If we now decide that this is wrong, what is the path to correct this? Can the mainstream Device Type Handler be modified with a new attribute, ‘temperatureToTheNearestTenth’’, to be available as well? This way, nothing current breaks but future SmartApps have access to tenths of a degree.

I also saw a post where @pstuart was complaining that the Device Type is truncating to an integer rather than rounding. If this is true, this probably should be fixed, I would think, and would be an easy revision to the code (for someone who knew what they were doing).

---

<div class="post-metadata">

**Author:** ![AaronZON](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/aaronzon/32/13303_2.png) [@AaronZON](https://community.smartthings.com/u/AaronZON)\
**Post date:** [December 16, 2014, 9:52pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/2 "2014-12-16T21:52:46Z")

</div>

Someone tell me if bumping is against the explicit or implicit rules of the forum . . . please. Assuming it’s OK, TTT. Also, @pstuart, I kind of expected you be able to answer some of these questions and have some opinions on this topic. If my good will account with you can stand another withdrawal into the red . . . could you please share your knowledge and wisdom on this?

---

<div class="post-metadata">

**Author:** ![pstuart](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/pstuart/32/82936_2.png) [@pstuart](https://community.smartthings.com/u/pstuart)\
**Post date:** [December 17, 2014, 5:19pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/3 "2014-12-17T17:19:03Z")

</div>

I struggled with this too, can’t remember exactly how I fixed it will have to dig through my github to find the fix for my devices. But all my temp sensors report and display tenths of a degree.

I think the trick was to change the display type to a string / text and keep a state var for the decimal value.

I think I even had a rant a few months back on the rounding (or truncating) the default devicetypes were doing… So I feel your pain… Been there, done that, fixed it myself, shared the code… But really can’t go much further…

> [@Why do all the temp sensors truncate the numbers instead of round?](http://community.smartthings.com/t/why-do-all-the-temp-sensors-truncate-the-numbers-instead-of-round/3493):
>
> I just picked up a AEON multi sensor and looked at the devicetype code, and sure enough, just like the ST multi sensor the device code truncates the readings. So, if it read 77.9 then the ST Things interface will read 77. This is not correct. I’ve modified this code to round up, but I’ve found this same type of bug in almost every temp aware device so far. If anyone wants the code, let me know. I also added the ability to adjust the temp calibration up or down.

> [@Temperature displayed in the Smart Things App](http://community.smartthings.com/t/temperature-displayed-in-the-smart-things-app/506):
>
> Just received my Smart Things and transferred over my z-wave network (21 devices) from my old Vera. Everything is working great. I have noticed that my Aeon Labs DSB05106-ZWUS Z-Wave Multi-sensor is reporting temperatures with one decimal place (ie. 69.8 degrees) but the app is displaying it in whole numbers and always rounding down (69.8 being displayed as 69). Is there a way to get the app to display the decimal point? If not, can the rounding be corrected (i.e. round 69.8 up to 70 degrees).

Just for a few searchable references for this issue.

---

<div class="post-metadata">

**Author:** ![AaronZON](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/aaronzon/32/13303_2.png) [@AaronZON](https://community.smartthings.com/u/AaronZON)\
**Post date:** [December 17, 2014, 5:36pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/4 "2014-12-17T17:36:11Z")

</div>

@pstuart. Found this in your repo:

[https://github.com/pstuart/smartthings/blob/master/smartsense%20multi%20%2B%20graph.groovy](https://github.com/pstuart/smartthings/blob/master/smartsense%20multi%20%2B%20graph.groovy)

Is this the code you are talking about that addressed this? I just did a 30 second scan and I see where you have cast the temperature as Double (if I’m interpreting it correctly). I will dig in a little more when I get a chance. Thanks!

---

<div class="post-metadata">

**Author:** ![pstuart](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/pstuart/32/82936_2.png) [@pstuart](https://community.smartthings.com/u/pstuart)\
**Post date:** [December 17, 2014, 6:02pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/5 "2014-12-17T18:02:36Z")

</div>

yeah, that might be it, I think I also addressed it in my ubi screen scrape code. Honestly, don’t have a ton of time to dig in right now… Maybe in a few weeks. Crazy season here…

---

<div class="post-metadata">

**Author:** ![AaronZON](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/aaronzon/32/13303_2.png) [@AaronZON](https://community.smartthings.com/u/AaronZON)\
**Post date:** [December 17, 2014, 6:46pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/6 "2014-12-17T18:46:20Z")

</div>

> [@pstuart](#):
>
> Honestly, don’t have a ton of time to dig in right now… Maybe in a few weeks. Crazy season here…

No worries, @pstuart . I can take it from here. I am contemplating a specific application where I might want to know temperature in tenths and, perhaps, the idea that ST should, in general, support temperature in tenths rather than as integers. I need to get my head around how sensor reporting and ST events interact before I can organize my thoughts. I have [another thread](http://community.smartthings.com/t/help-with-events-and-subscriptions/7951) on this topic (that I need to bump . . . no traction). Thanks again

---

<div class="post-metadata">

**Author:** ![pstuart](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/pstuart/32/82936_2.png) [@pstuart](https://community.smartthings.com/u/pstuart)\
**Post date:** [December 17, 2014, 7:42pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/7 "2014-12-17T19:42:51Z")

</div>

Keep in mind, if you convert the display value to a string, you might break smartapps that use essentially integer values for temp.

Stupid system… Honestly, temp should always been a decimal and then let the smartapps format it for usage, but when 74.234 doesn’t equal 74 a smartapp wont work… Too simple and too limiting for me.

But truncated 74.9 to 74 is plain stupid.

---

<div class="post-metadata">

**Author:** ![AaronZON](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/aaronzon/32/13303_2.png) [@AaronZON](https://community.smartthings.com/u/AaronZON)\
**Post date:** [December 17, 2014, 7:53pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/8 "2014-12-17T19:53:30Z")

</div>

> [@pstuart](#):
>
> Keep in mind, if you convert the display value to a string, you might break smartapps that use essentially integer values for temp.

Understood. I was thinking in terms of a new attribute of the temperature measurement capability: ‘temperatureDecimal’ or something like that. Leave the current integer value there so existing apps don’t break but include this other, more precise, attribute for new apps that want/need it.

> [@pstuart](#):
>
> But truncated 74.9 to 74 is plain stupid

+1. This is easily fixable without breaking stuff, I would think. Maybe this could be proposed as a separate thing. I may include this in my crusade if/when I launch it.

---

<div class="post-metadata">

**Author:** ![Jim](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/jim/32/15313_2.png) [@Jim](https://community.smartthings.com/u/Jim)\
**Post date:** [December 19, 2014, 4:57pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/9 "2014-12-19T16:57:45Z")

</div>

We are looking into the truncation issue. We should be rounding, not truncating.

---

<div class="post-metadata">

**Author:** ![625alex](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/625alex/32/70989_2.png) [@625alex](https://community.smartthings.com/u/625alex)\
**Post date:** [December 19, 2014, 5:58pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/10 "2014-12-19T17:58:53Z")

</div>

@Jim

Why is when one calls

```
def v = device.currentValue("temperature")

```

on the new SmartSense Temp/Humidity Sensor, it throws a NumberFormatException?

Same problem with humidity for SmartSense Sensor and power for TCP bulb.

---

<div class="post-metadata">

**Author:** ![Jim](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/jim/32/15313_2.png) [@Jim](https://community.smartthings.com/u/Jim)\
**Post date:** [December 23, 2014, 11:06pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/11 "2014-12-23T23:06:16Z")

</div>

@625alex can you provide some more context to your question? Is this happening all the time, only in certain conditions, etc.?

---

<div class="post-metadata">

**Author:** ![625alex](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/625alex/32/70989_2.png) [@625alex](https://community.smartthings.com/u/625alex)\
**Post date:** [December 24, 2014, 5:20am UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/12 "2014-12-24T05:20:59Z")

</div>

It’s happening all the time. You can try it with any basic app.

Also, if you call device.supportedAttributes on SmartWeather Station Tile, you get this exception:

org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object ‘temperature’ with class ‘physicalgraph.device.cache.AttributeDTO’ to class ‘physicalgraph.device.Attribute’

---

<div class="post-metadata">

**Author:** ![625alex](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/625alex/32/70989_2.png) [@625alex](https://community.smartthings.com/u/625alex)\
**Post date:** [December 27, 2014, 8:13am UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/13 "2014-12-27T08:13:34Z")

</div>

@Jim, in case you missed that, I’m just giving you a poke because I really want to get to the bottom of this.

Thanks

---

<div class="post-metadata">

**Author:** ![Jim](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/jim/32/15313_2.png) [@Jim](https://community.smartthings.com/u/Jim)\
**Post date:** [January 14, 2015, 9:23pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/14 "2015-01-14T21:23:15Z")

</div>

Hey @625alex - I’m assuming you are still experiencing these issues in getting a NumberFormatException in all your reported cases?

I’m going to get someone from engineering to look into this. Apologies for the delay.

---

<div class="post-metadata">

**Author:** ![625alex](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/625alex/32/70989_2.png) [@625alex](https://community.smartthings.com/u/625alex)\
**Post date:** [January 14, 2015, 9:37pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/15 "2015-01-14T21:37:26Z")

</div>

Yes, I encouraged users of ActiON Dashboard to keep reporting it to support.

Current problem is humidity capability of SmartSense Temp/Humidity Sensor. It used to work a short while ago and now it’s broken again.

Thanks for looking into this!

---

<div class="post-metadata">

**Author:** ![Jim](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/jim/32/15313_2.png) [@Jim](https://community.smartthings.com/u/Jim)\
**Post date:** [January 14, 2015, 10:03pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/16 "2015-01-14T22:03:38Z")

</div>

Yep, we’re able to reproduce this issue as well now. We’re looking into it.

---

<div class="post-metadata">

**Author:** ![625alex](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/625alex/32/70989_2.png) [@625alex](https://community.smartthings.com/u/625alex)\
**Post date:** [January 14, 2015, 10:07pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/17 "2015-01-14T22:07:19Z")

</div>

Also, please check battery readings for ST temp/humisity sensor.

Also, when you call `smartWeatherTile.supportedAttributes`, same exception is thrown.

---

<div class="post-metadata">

**Author:** ![djamie2015](https://avatars.discourse-cdn.com/v4/letter/d/e5b9ba/32.png) [@djamie2015](https://community.smartthings.com/u/djamie2015)\
**Post date:** [September 30, 2015, 1:05am UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/18 "2015-09-30T01:05:50Z")

</div>

Hello all. New to Smartthings and device handlers. Found some code to post temperature readings to Grovestream. While I was able to get temperature from all of my devices that support this capability, I am finding that the readings I am getting from my Smartsense Multi Sensor are +/- 1 degree which, when plotted against the Aeon Gen 5 multisensor, look horrible… almost unusable. I expect this thread may be heading in this direction. Was there ever a device handler that addressed this short coming? Is there an alternative solution?

![](https://global.discourse-cdn.com/smartthings/original/3X/d/c/dced06725d1235754158a75944cc64740004e45b.JPG)

---

<div class="post-metadata">

**Author:** ![btk](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/btk/32/17453_2.png) [@btk](https://community.smartthings.com/u/btk)\
**Post date:** [October 3, 2015, 1:06am UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/19 "2015-10-03T01:06:10Z")

</div>

I don’t know if Grovestreams can do this, but with my graphing package (Grafana) I apply a moving average function to temperature data to smooth the line out and reduce those spikes.

---

<div class="post-metadata">

**Author:** ![jbellarmada](https://avatars.discourse-cdn.com/v4/letter/j/87869e/32.png) [@jbellarmada](https://community.smartthings.com/u/jbellarmada)\
**Post date:** [December 17, 2019, 6:03pm UTC](https://community.smartthings.com/t/questions-about-temperature-data-in-st/7956/20 "2019-12-17T18:03:26Z")

</div>

Patrick,

Any chance you have been able to get a zigbee device to produce event reports for temperature with a different delta than 1deg? I have many ST Multi Sensors and for most of them I don’t care about temperature and would like to simply suppress the event log entries. Since I cant seem to make them stop looking for a larger delta of say 5deg would quiet them down quite a bit!!!
