SmartThings Community

Conversion from Celsius to Fahrenheit Error in Device Handler

devices
temperature

(Owen Murphy) #1

I am using several Visonic MCT-340 E temperature sensors, and it appears that it is rounding to the nearest degree in Celsius, then converting the value to Fahrenheit. As a result the resolution isn’t that great in degrees F. It skips whole degrees when reporting in Fahrenheit. In the 60’s, the only available values are 61, 63, 64 66, and 68, which correspond to 16, 17, 18, 19, 20 in C

  1. Is this a limitation of the device itself (ie it only reports the temperature in resolution of 1deg C), or is it a result of the Visonic device handler rounding the temperature value to the nearest degree C AND THEN converting the value into Fahrenheit?

  2. Is it possible to create a custom device handler that reports the temperature with a higher resolution that 1 deg C (assuming that the device actually reports the temperature with a greater resolution)? I understand that many of these inexpensive temperature sensors aren’t actually accurate to greater than 1 degree, but having more resolution would allow me to see the relative trend a little better.

  3. Are the device specific device handlers available to the public? Is it possible to look at the device handler for the Visonic MCT-340 E to see how it actually converts and rounds the reported temperature value?

  4. Is there a way to view and/or log the raw data coming from connected devices?

Thanks


#2

Probably not a limit with the device, but I’d say it’s the DTH. I’ve seen this a ton of times.

Yup. Which DTH are you using now?

Perhaps there’s one already one here in the Community, but let me know which one you’re using now and I can see what’s possible. I don’t have your device to test with, so I’ll rely on you for some debugging.

Yes there is. In the IDE, click on Live Logging. When you see the device show up in the list, click on it to see the specific info coming from the device.


(Owen Murphy) #3

It appears that I’m using the “SmartSense Open/Closed Sensor” device handler. I guess I couldn’t find a profile for the specific device I have, so I chose this one, and it seemed to work.

I found this code in the SmartThings github: https://github.com/SmartThingsCommunity/SmartThingsPublic/tree/master/devicetypes/smartthings/smartsense-open-closed-sensor.src

Is this the device handler that is being used for my sensors?

Thanks for the help!


(Owen Murphy) #4

By the way, here is the latest log entry from one of my sensors. I assume that the raw zigbee data is located in the long hex string in the last line?

8:51:37 AM: debug Parse returned [name:contact, value:open, descriptionText:Dining Room Temperature was opened]
8:51:37 AM: debug Contact Status
8:51:37 AM: debug description: zone report :: type: 19 value: 0021
8:51:07 AM: debug Parse returned [:]
8:51:07 AM: debug description: catchall: 0104 0500 01 01 0140 00 6206 00 00 0000 0A 01 1000F01304010200976D28


#5

Are these just temperature sensors, or are they the open/close sensors too?

Check out this post for a DTH that may be more applicable for you:

Give that a shot and see if it’s better. I won’t be home for a bit to look at what changes need made, but it’s worth a shot.


(Owen Murphy) #6

Yeah, these are open/ close sensors that measure temperature, though I only use them for the temperature reading. I’ll test out that DHT and see how it works. Thanks for finding it!


(Owen Murphy) #7

I was able to frankenstein together that base code with the some code I found on Github that displays the temperature as a float value.

Specifically I changed the getTemperatureResult(value) method and the parseCustomMessage(String description).

It seems to work. It returns the temperatures with a resolution of 0.1 deg C. I’ll have to dig into the code later on to try to understand exactly what’s going on.


#8

Well done!


(Owen Murphy) #9

I’ve noticed that the temperatures have been sitting at the same values for the past hour or so. How often do the sensors update their values? Is there a way to change the update rate?


#10

You can, and I think it’s in line 316 in the code you’ve posted above:

“zcl global send-me-a-report 0x402 0 0x29 300 3600 {6400}”, “delay 200”,

Looks like the max reporting interval is 60 minutes (3600 seconds), and minimum of 5 minutes. I can’t remember what the 6400 value does off the top of my head.


(Owen Murphy) #11

Thanks.

It looks like that, even though I’m able to display the value out to 0.1 degree Fahrenheit, it’s still only reading values with 1 deg C precision. ie it only displays the values 64.4 F (18.0 C), 66.2 F (19.0 C), 68.0 F (20.0 C) 69.8 F (21.0 C), etc.

Is there a way to read the raw hex value coming from the zigbee communication? The closest thing I see in the code is the method “def parse (String description)”, but that takes a string as the argument, which I assume is already formatted from the actual zigbee communication. Is there a way to get to the lower level communication for debug purposes?

Thanks, and Merry Christmas!


(Owen Murphy) #12

So it appears that the Visonic MCT-340 E does only have 1 deg C resolution at the device level. So no matter what changes I make to the device handler, I won’t be able to get any better resolution. I added a few other temperature sensors made by Samsung, and they are displaying 0.1 deg F resolution using the same device handler.

Long story short: don’t by Visonic MCT-340 E if you want a high resolution temperature measurement.