Hello everyone, I’m currently working on a project where I want to display different icons based on the temperature. I’ve set up my items file with the following configuration:
plaintext
Number Temperature “Temperatura [%.2f °C]” {weather=“locationId=home, type=temperature, property=current”}
Number TemperatureIcon “Icon Temperature”
For the sitemap, I have:
plaintext
sitemap astro label=“Meteo” {
Frame label=“Meteo Attuale” {
Text item=Temperature icon=“temp-27” visibility=[TemperatureIcon==27]
}
}
And here’s the rule I’ve created:
plaintext
rule “Temperature Icon”
when Item Temperature received update
then
if (Temperature.state >= 27) {
postUpdate(TemperatureIcon, 27)
}
logInfo(“TemperatureIcon”, "TemperatureIcon: " + TemperatureIcon.state)
postUpdate(TemperatureIcon, TemperatureIcon.state)
end
I’ve placed the icons named temp-0.svg, temp-1.svg, temp-2.svg, temp-3.svg, and temp-4.svg into the /icons/classic folder. However, I’m unable to get the icon to display when the temperature exceeds 27°C. My goal is to have the following icon display based on the temperature range:
- When temperature is below 0°C, show
temp-0.svg - When temperature is between 0°C and 15°C, show
temp-1.svg - When temperature is between 16°C and 20°C, show
temp-2.svg - When temperature is between 21°C and 25°C, show
temp-3.svg - When temperature is above 26°C, show
temp-4.svg
I would greatly appreciate any help or guidance on how to resolve this issue. Thank you in advance!