Where Does convertTemperatureIfNeeded() Live?


(John C) #1

One can “guess” at the API, but where is this function documented? Where does it live, code-wise?

Plenty of code references that use it, but I can’t find it in any API reference! @Jim @slagle ???

Thanks, guys…


[RELEASE] GoControl Door/Window Sensor, Motion Sensor, and Siren DTH
(John C) #2

Bueller? @Jim? Anyone? :grin:


(John C) #3

Sigh…

Crickets: Chirp! Chirp!


(Tom Manley) #4

It’s defined in a base class of the Device Type Handler. The definition is String convertTemperatureIfNeeded(BigDecimal degrees, String currentScale, int precision = 2). It will convert from Celsius to Fahrenheit or vice versa if the currentScale is different than the location temperature scale. The precision argument defines the number of significant digits in the result. Looking at the code I see there is a bug in that it doesn’t look at the precision if it doesn’t need to do a temperature conversion. I’ll create a ticket for that issue.


(John C) #5

Thanks so much @tpmanley! Appreciate the response! :+1::sunglasses: