SmartThings Multipurpose Sensor rounds up or down to nearest degree?

Hey Smartthings Community,

I’ve just bought the Smartthings hub with a couple of Smartthings Multipurpose sensors:

I have a question around the level of accuracy shown in the newer smartthings app they seem to record. The temperature shows only to the nearest degree e.g mine shows a current reading of 21.0 or 22.0 C but never anything in the middle. The history graph shows some variation e.g if I change to hours, days I see 22.1 C, 22.3 which I assume is the average for the hour/day hence it includes a decimal reading if it’s changed.

So the question is are these Samsung sensors only capable of showing to the closest degree not showing decimals? Do you guys see the same? Perhaps I need to re-calibrate it?

I also have a slightly more expensive Multisensor from Aeotec (Multisensor 6) which shows current readings as 21.5, 22.6 etc… so at least displays the decimal. I’d really prefer to display this level of accuracy.

I’m hoping these Samsung sensors are more accurate or can show the temperature accuracy including decimal points.

Any help appreciated! Thanks very much

They can show decimal degree, but the official DH has removed the precision ages ago for some unknown reason.

The DH does Explicit Cast to integer. So it chops off the decimals.

else if (maps[0].name == "temperature") {
		def map = maps[0]
		if (tempOffset) {
			map.value = (int) map.value + (int) tempOffset
		map.descriptionText = temperatureScale == 'C' ? '{{ device.displayName }} was {{ value }}°C' : '{{ device.displayName }} was {{ value }}°F'
		map.translatable = true

1 Like

thanks @GSzabados for the reply, Yes that does seem an odd decision to remove the precision from the code if the device is capable of this…

  • How would I see the DH code being used as you pasted above?
  • Is it possible to edit the current DH code (I guess not)? or at least duplicate it as a different name and try editing it to give the desired result?

I assume once I have the correct code it’s then a case of creating the DH, pasting the code
and then changing the “device type” to this newly created DH.

Thanks for your help

This is the current version of the DH in the public github repo.

You can make a copy and change for yourself to report with decimals. But then it will not run locally. That has to be changed too, to make it work.

thanks again @GSzabados for the followup I can see where to change in the code so this is great, thank you. You mention “it will not run locally and needs to be changed”, sorry I’m very new to all this so learning as I go along from the community, could you explain “how do you mean it won’t run locally” and where I would change this? Is this where I publish this code change as a new DH and have it approved by smarthings or is this something else? Many Thanks

Line 20 has it,

metadata {
	definition(name: "SmartSense Multi Sensor", namespace: "smartthings", author: "SmartThings", runLocally: true, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false, mnmn: "SmartThings", vid: "generic-contact-2") {

Need to set it to false.

So you go to the IDE, top menu Device Handlers, Add new device handler, from code, you paste the code here, change name, namespace, author to know that is yours, change the above mentioned to false and then save.
It open a a new window then, where you can save an publish it.
Change the code as you want, save it and publish, for yourself.

Then go to your device, edit it and change the device handler to yours, self published as I can remember. Save and check the result in the app.

Otherwise the old documentation is quite good. It explains well SmartApps, DH and all the stuff. But it is a bit outdated and obsolete.

@GSzabados Thank you very much for all your help answering this, much appreciated! I’ll follow the instructions read through the documentation and hopefully all will be well! Thanks again.

It looks like it’s going to take quite some code changes to make this work rather than my simple changes to the data type. I copied the device handler code changed all the metadata bits mentioned including and the type from INT to float (just to see if that could work) published it and assigned to my device, but despite this still no changes seen in the app. So unless there are further parts in the code to change or it needs some much more significant chunks added. Reading some other threads for different devices it doesn’t look so simple to achieve with basic changes, and certainly beyond my basic coding.

So if anyone can work out how to change the Samsung MultiSensor DH code to produce decimals to the app, I’m sure it’ll be very popular, there are many users looking for the same!

@Jon_ST, try this:

 def map = maps[0]
        def decimalValue = Double.parseDouble(description.split(": ")[1])
        map.value = (float) Math.round( (decimalValue as Float) * 10.0 ) / 10
		if (tempOffset) {
			map.value = (float) map.value + (float) tempOffset
1 Like

@GSzabados Yep that’s perfect! Decimal showing now and in the App. You’re a genius! thank you so much :slight_smile:

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.