There's an example here: Automation to display different photos depending on weather conditions - #10 by tom_l