I have an 22 panal Nanoleaf light array on the wall for a while now which looks fantastic. So a few months ago I thought I’d automate the colour sequence depending on the weather. Took me countless hours of frustrating templating to get going, but its works fab now.
Its prob nothing that amazing for many peeps here, but I’m sharing this because I love it and it took soooo long.
automation:
- alias: Change Nanoleaf on sun or weather change
initial_state: true
trigger:
- platform: state
entity_id: sun.sun
- platform: state
entity_id: weather.met_office_moor_allerton
- platform: state
entity_id: light.nanoleaf_aurora_52_4b_ff_local
to: 'on'
condition:
condition: and
conditions:
- condition: state
entity_id: light.nanoleaf_aurora_52_4b_ff_local
state: 'on'
- condition: template
value_template: '{{ trigger.to_state.state != trigger.from_state.state }}'
action:
- service: homeassistant.turn_on
entity_id: script.changenanoleafcolour
script:
changenanoleafcolour:
sequence:
- service: logbook.log
data_template:
name: "Script Triggered"
message: Change Nanoleaf Colour
- service: homeassistant.turn_on
data_template:
entity_id: light.nanoleaf_aurora_52_4b_ff_local
effect: >
{% if is_state("sun.sun", "above_horizon") %}
{% if is_state("weather.met_office_moor_allerton", "cloudy") %} Sunlight through trees
{% elif is_state("weather.met_office_moor_allerton", "fog") %} East coast breeze
{% elif is_state("weather.met_office_moor_allerton", "hail") %} Snowfall
{% elif is_state("weather.met_office_moor_allerton", "lightning") %} Lightning
{% elif is_state("weather.met_office_moor_allerton", "lightning-rainy") %} Lightning
{% elif is_state("weather.met_office_moor_allerton", "partlycloudy") %} Sunlight through trees
{% elif is_state("weather.met_office_moor_allerton", "pouring") %} Rain
{% elif is_state("weather.met_office_moor_allerton", "rainy") %} Rain
{% elif is_state("weather.met_office_moor_allerton", "snowy") %} Snowfall
{% elif is_state("weather.met_office_moor_allerton", "snowy-rainy") %} Snowfall
{% elif is_state("weather.met_office_moor_allerton", "sunny") %} Sunlight through trees
{% elif is_state("weather.met_office_moor_allerton", "windy") %} Windy
{% endif %}
{% elif is_state("sun.sun", "below_horizon") %}
{% if is_state("weather.met_office_moor_allerton", "cloudy") %} Pumpkin Spice
{% elif is_state("weather.met_office_moor_allerton", "fog") %} East coast breeze
{% elif is_state("weather.met_office_moor_allerton", "hail") %} Snowfall
{% elif is_state("weather.met_office_moor_allerton", "lightning") %} Lightning
{% elif is_state("weather.met_office_moor_allerton", "lightning-rainy") %} Lightning
{% elif is_state("weather.met_office_moor_allerton", "partlycloudy") %} Pumpkin Spice
{% elif is_state("weather.met_office_moor_allerton", "pouring") %} Rain
{% elif is_state("weather.met_office_moor_allerton", "rainy") %} Rain
{% elif is_state("weather.met_office_moor_allerton", "snowy") %} Snowfall
{% elif is_state("weather.met_office_moor_allerton", "snowy-rainy") %} Snowfall
{% elif is_state("weather.met_office_moor_allerton", "sunny") %} Pumpkin Spice
{% elif is_state("weather.met_office_moor_allerton", "windy") %} Windy
{% endif %}
{% endif %}