Panos
(Panos)
July 29, 2020, 7:49pm
1
Hello.
I have connected a sensor on ST and I want to display 2 decimals instead of 1 that is now.
for example:
10:38 -> 0,45
10:33 -> 0,41
etc…
Any suggestions?
This is the part of the code
def parse(String message) {
TRACE("parse(${message})")
Map msg = stringToMap(message)
Float temp = msg.temperature.toFloat()
def event = [
name : "temperature",
value : temp.round(2),
unit : tempScale,
]
TRACE("event: (${event})")
sendEvent(event)
}
P.S: on old ST app the temperature displayed correctly with 2 decimals.
GSzabados
(Gabor Szabados)
July 30, 2020, 3:47pm
2
Until recently the old app and the new app was parsing only values without decimals.
The method to get the two decimals is a bit different, as it was parsed as text and not as a value first and split the two decimals from the text.
The new app probably able to display only 1 decimal as the UX plugin was designed for that purpose.
Otherwise why do you need two decimals? Do you have really high precision temperature sensors which has that level of accuracy? Most of the available sensors in the market has usually +/- 0.5 Celsius accuracy, but they capable to provide 2 decimals.
GSzabados
(Gabor Szabados)
July 30, 2020, 4:07pm
4
Look at this topic, search for the phrase description if you do not want the read the whole conversation.
Hi! I just got SmartThings Hub + Multipurpose Sensor for measuring & adjusting my house’s warming thru IFTTT and Tado. I got them up & running easily, but for my surprise and disappointment, it seems that this sensor can measure the temperature only at the precision of one full degree (celcius, in my case), not decimals at all! Or at least, this is what the Samsung app is showing…
So my questions are:
Is it correct that Samsung’s own sensor’s precision is only one full degree?
Are there any better temperature sensor available for this hub, with the precision of ~0.1 degrees?
Panos
(Panos)
July 30, 2020, 4:41pm
5
Hello.
Thanks your your reply.
It’s not actually a temperature sensor.
I have connected a Geiger Counter to ST and since there is no related capability I’m using the temperature capability to pass these values to DH
The counter is reporting float numbers and what’s why I need 2 decimal precision
GSzabados
(Gabor Szabados)
July 30, 2020, 5:26pm
6
Ok, then look here, create your custom capability and define it as state, not slider.
Then you can parse any decimal value and you can call it anything you want, not just temperature, and it will work with the new app.
Overview
At SmartThings we want to provide tooling to allow developers to get their device integrations working in the SmartThings app. These changes will allow an integrator to move from using custom commands and attributes to custom capabilities.
DTH Migration For Custom Capabilities
In order to follow along with the example set forth in this guide, you will want to have the CLI set up, so make sure that you take this step first.
You can download the CLI here from the releases tab and read more about it in the README .
It is also recommended that you familiarize yourself with the concepts:
Custom Capabilities
Capability Presentations
Walkthrough
We are going to walk through a simple example of updating our Device Type Handler (DTH) so that devices installed with the DTH will be …
1 Like