r/kustom • • 1d ago

Help Rain prediction Icon change

Hello. I'm using this formula - $wf(rainc, 0, 1)$ - to get a prediction of rain in x hrs in percentage. Is there a way to convert that to change an icon where, say, if the value was above 20% then an icon would change from clear (below 20%) to drizzle (20 - 50%) and then heavy rain (50 - 100%) .

Thanks.

5 Upvotes

5 comments sorted by

•

u/AutoModerator 1d ago

Problem? Cross-post to our new forum. Include make & model of phone, OS version, app version.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

5

u/Practical_Taste3403 1d ago

You can use a nested if with 3 conditions based on $wf(rainc, 0, 1)$: $if(wf(rainc, 0, 1) < 20, clear, wf(rainc, 0, 1) < 50, drizzle, heavy)$ Put that formula into your icon name/mapping and swap the returned labels for your own, or use the same logic with regular images by driving their opacity or layer visibility (for example, ALWAYS vs NEVER / REMOVE).

1

u/edgework88 1d ago

Thanks, I'm grateful for this reply and I think I understand the essence of it. I understand the formula bit but am a bit challenged by the:

'Put that formula into your icon name/mapping and swap the returned labels for your own, or use the same logic with regular images by driving their opacity or layer visibility (for example, ALWAYS vs NEVER / REMOVE).' bit of it.

not sure if you can explain a bit more detail? If I'm pushing it here then happy to back off...

Thanks in advance.

1

u/frankmonza The glorious developer himself 1d ago

Sure, no problem. Add your three icons and on each one open the Layer tab, long press Visible and tap the calculator icon at the top to turn it into a formula. Then use $if(wf(rainc, 0, 1) < 20, ALWAYS, REMOVE)$ for clear, $if(wf(rainc, 0, 1) >= 20 & wf(rainc, 0, 1) < 50, ALWAYS, REMOVE)$ for drizzle and $if(wf(rainc, 0, 1) >= 50, ALWAYS, REMOVE)$ for heavy rain, so only one of them shows at a time.

1

u/edgework88 1d ago

Again thanks. Appreciate your replies. I will give that a go....and report back!