Standardize presentation of temperature and humidity

Hi!

I would like to present information standardly, independent of the device/brand.

image

The image is a small example of the temperature display. Some show no decimal place, others with one, two, and even a thermostat that shows four places.

The same happens with the temperature symbol. It does not appear, or only the "c" appears, others the degree and c "⁰c".

Similar situation with humidity, some have no information at all, others show the "%" symbol, others "%rs".

Is there any way to create a standard presentation?

2 Likes

G'day Wilson, it feels like this should be possible, let me see what I find.... Not in the next 9-10 hours :wink: But I'm sure there is something we can come up with, including others here in the Community....

2 Likes

The issue is in how the attribute unit is stored by the driver…

2 Likes

Yes, that is true. It may require a driver, or, ideally some "words" with the developer of drivers who have developed drivers that do not honour the scale used on the hub.

2 Likes

I thought there might be something in the templates, like number formatting. The same way you format colors, icons, maybe something like number formatting. Well you are the experts.

1 Like

We'll see what we can come up with :wink:

1 Like

Could a virtual device be used where the decimal place can be adjusted. I sware I've seen that option on a temp/humidity sensor driver before. I think it may have been the guy that wrote all those Sonoff drivers but got banned or something. It's still in HPM.

You can't do it using CSS alone.

Here is a workaround Generic Zigbee Motion Sensor F Temp 2 Decimal places - #7 by aaiyar?

Guess you could but it's probably quite cumbersome as you'll need to use a rule to pull the temp into the virtual device, no?

1 Like

This is the guy who setup the CSS thread.... so I think we will need to look at a virtual device :wink:

2 Likes

Lol I actually just googled it :wink:

2 Likes

Hopefully Google returned the same trusted source we all rely upon... :slight_smile:

TBH - Makes sense to need another device, the more I think about it... would be nice to find a CSS / Javascript option, but expect it will be a virtual device...

I think the temp averaging device is actually a clever solution!

1 Like

If it give you what you need, sounds like a good option to me.

All credit to @aaiyar ! OP just wanted a standardised presentation, didn't seem fussed as to how many decimal places :grinning:

2 Likes

The documentation is vague...

Screen Shot 2022-08-20 at 10.50.42 AM

"NUMBER" whatever that means. Could be Integer, could be Float, could be Double, default Groovy is BigDecimal. For the Honeywell Thermostat I use, the driver uses the default of BigDecimal and I note that it gets displayed as "74.000" on my Device Info page.

Screen Shot 2022-08-20 at 10.56.38 AM

When that gets displayed on a dashboard, it depends on which tile. An Attribute only tile displays the full value, while a Thermostat tile displays both a single decimal in the center and the full value at the top:

Screen Shot 2022-08-20 at 10.56.51 AM

Modifying the driver to round to two decimal places results in:

Screen Shot 2022-08-20 at 10.57.03 AM

And then displayed as:

Screen Shot 2022-08-20 at 10.57.16 AM

I don't believe 4 decimal places has any worthwhile value in a display, and I've added the round down to my development code.

4 Likes

That reminds me I need to fix the Celsius to Fahrenheit conversion in my thermostat driver....

Thanks to all for the contributions.

I tested and worked on the whole discussion of creating virtual devices/variables to make a bridge conversation, but I think a bad way. In my case, I have 18 sensors; I would have to add devices or variables and then build rules that make no sense to me this pollution.

The last comment about changing the drive seems like a good way to go, but I think that only drives are added to the codes; how to do it with HE native driver? Where would the change be made? Another detail is, would it be possible to determine the symbol, for example, "⁰c" or "⁰f"?

@sburke781 and other CSS magic, I keep thinking that there should be a way to identify the info in the html and then convert the information to the tile.

Thanks.

Taking this opportunity to thank to @csteele the developer of the Honeywell drive, who I think saw this discussion and have now posted a version getting the decimals right info, THANK YOU!

steele: v1.3.23 preset supportedThermostatFanModes & supportedThermostatModes used by Thermostat Controller app.

  • round curTemp to 2 places.
1 Like

unit: "°${location.temperatureScale}"

The above is one piece of a sendEvent:

sendEvent(name: 'temperature', value: curTemp.round(2), state: n, unit:"°${location.temperatureScale}")

Together, it sets the degree symbol and either C or F based on what's selected in Settings: Hub Details:

Screen Shot 2022-08-20 at 4.14.07 PM

2 Likes

Download the Hubitat app