Different action day/night

I am playing around with weather icons linked to a weather API and the wi icons library.
However, I want to split some of the icons in day and night (for example, Clear Sky).

I build a function with a switch/case. When the status is 'clear sky' use icon wi-clear sky (for example).
However, this means I have the same icon day or night time (the sun).

How can I also implement day and night? I have the nighttime addin which returns isNight in true or false but I can not figure out how I can implement this into my function properly. I read some things about the join node but not quite clear yet.

save the isNight boolean to a context variable, then in your function you can get the context variable and change icon if true or false.

I have several bits of info that I send out to MQTT either every minute or every day:

Notably the sleep and daylight entries. Sleep on/off is at a set time each day. Daylight is true or false depending on the sun position and time of year.

CRON+:
image

image

Then lighting can be controlled in various ways:

Both of those are Ikea Zigbee devices controlled via Zigbee2MQTT.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.