Closed majdzik84 closed 3 years ago
Hi
Take a look at the Conversions section in the README. There you can see how I display icons in different colors based on non-numeric values. If you want text, i believe you can use something like this:
<span style='color:green'>Your text</span>
Or maybe text-color or something else. Please give it a try, and let me know how it turns out.
Otto
I gave this a brief test. No luck and broke the config file.
{ topic: 'waterheater/leak', label: 'Waterheater', sortOrder: 30, maxAgeSeconds: 60 conversions: [ { from: "All dry", to: <span style='color:green'>"All dry"</span> }, { from: "LEAK!!!", to: <span style='color:red'>"LEAK!!!"</span> } ] },
Be careful with your quotes. I believe the <span style='color:green'>"All dry"</span>
should be changed to "<span style='color:green'>All dry</span>"
, and the <span style='color:red'>"LEAK!!!"</span>
should be "<span style='color:red'>LEAK!!!</span>"
.
The config file is a json file, and must be legal json. You may get help from a good editor.
Hmm, the hunt continues. seems anytime I include conversions, even from the example, the config file breaks. Be very quiet I'm hunting Bugs (Bunny)
Hmm, the hunt continues. seems anytime I include conversions, even from the example, the config file breaks. Be very quiet I'm hunting Bugs (Bunny)
Updated information. The conversion text works!!. However, if one adds the sort order or maxAgeSeconds, the config breaks.
Hmm, the hunt continues. seems anytime I include conversions, even from the example, the config file breaks. Be very quiet I'm hunting Bugs (Bunny)
Updated information. The conversion text works!!. However, if one adds the sort order or maxAgeSeconds, the config breaks.
IT WORKS!!! Seems the placement of the sortOrder and MaxAgeSeconds is important. The both of them should be placed before the topic.
{ sortOrder: 30, maxAgeSeconds: 60, topic: 'waterheater/leak', label: 'Waterheater', conversions: [ { from: "All dry", to: "<span style='color:green'>All dry</span>" }, { from: "LEAK!!!", to: "<span style='color:red'>LEAK!!!</span>" } ] },
Looks like you got this right. The order of the config variables has nothing to say, but you may have had another error. Closing this.
Hi. Thank you for your module. Can I easily colorize non-numeric values? I really care about determining the air quality along with the color. (if/endif?)