Closed jsbrich closed 2 years ago
Finally figured it out, so will post here in case anyone else is struggling.
I swear I tried this before posting, but this worked for me
position: [0, 0],
width: 1.1,
height: 1.25,
type: TYPES.TEXT_LIST,
id: {}, // using empty object for an unknown id
state: false, // disable state element
list: [
{
title: 'Outside',
icon: 'mdi-thermometer',
unit: '°F',
value: function() {
var num = parseFloat(this.parseFieldValue('&sensor.outside_temperature.state'));
return !isNaN(num) ? num.toFixed(0) : 'b';
},
},
All the examples I saw, left the parseFloat call out and the toFixed was stumbling over parseFieldValue returning a string.
I am trying to round some temperature and humidity values to the nearest integer and I can't get it to work right.
I would expect it to print something like
Outside 35°F
, but instead it is printingOutside 35.2°F
What am I missing?