I have a question on dynamically coloring numbers in the itemsfile.
Say I measure soil humidity with the following line in my itemsfile:
Number soil_moisture "Soil moisture [%.0f]" <icon> (group) {mqttchannel}
Then I can add colors to the outcome with a line like this in my sitemap file:
Text item=soil_moisture valuecolor=[soil_moisture>120="orange", soil_moisture>300="red"]
However, many items i never define in my sitemap: I simply define hem in my itemsfile in a group.
So, question 1:
Can i define a value dependend colorchange in the items file as well, or is it mandatory to do that in the sitemap.??
If not, too bad but so be it
Question 2:
In the example I define the value to turn red above 300, Suppose I want to be able to dynamically alter that colorflip value to any other value.
To clarify: say i use a different soil or sensor for which 250 or maybe 325 is a better value to flip the color, I want to b able to dynamically alter that say with a slider or a setpoint or simply an mqtt command. Is that anyway possible?
I am working on the same thing. I have a āsettingsā part on my sitemaps, where I can set min and max values for some items (i.e. a temperature sensor).
For these min-/max-settings, I created āvirtualā items which are (on every change) persisted to a mysql DB.
On the other hand, I use color formatting on the items which show the actual values (the actual temperature).
Now, I would like to combine the two, so that the color coding works with the items / entries from the settings part. Without this combination, it could happen that the color coding does not match the settings any more if someone made a change to the settings without adjusting the color coding in the sitemapā¦
Well, like I said above, I donāt think that will work so if you tried it and it doesnāt work then you have your answer. You will have to use some other technique like a special item that combined the two items or using the visibility tag somehow.
To get around this, I am now thinking about a rule which runs on every change of the original item (sensor information). The rule should check the two min / max āsettingsā items and change the value of another (new) item which only carries the color information.
And then I could do the coloring of the sensor item based on the new color item.