Climate-based (or other) visual notifications with Nanoleaf e Home Assistant

8 minutes of reading
PURPOSES OF PROJET:
  • Automate the behavior of panels lumino Yes Nanoleaf based on outside weather (or other specific conditions)
  • Difficulty level: medium low
  • Cost: based on the Nanoleaf panel in use
CONCEPTS FACED:
SOFTWARE COMPONENTS USED:
  • Home Assistant configured and working (ver.> 0.67)
  • Components Home Assistant "Nanoleaf Light Panel"
  • A platform Home Assistant for the integration of weather conditions (in this projet, "Darksky", But any one that provides this information is fine
PHYSICAL DEVICES USED:
PROJET MOST INDICATED FOR:

All environments

Notes and disclaimer
  • qualsiasi modifica all'impianto elettrico dev'essere effettuata da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (this guide is for educational purposes only);
  • any changes implemented in probefore a device will void the warranty.
revision projet: 1.1

Abstract

The panels lumimodular furniture Nanoleaf (the recent ones Canvas, but also the previous model Aurora) are now known to be a very furnishing solution apprezzata both in functional terms (ie for the purpose of theluminare) that in purely aesthetic terms.

Nanoleaf AuroraBetween various features allowed from the panels and from them appmanagement and control statement (available for iOS e Android) there is that "color", Which allows you to use predefined iridescent patterns (or customized, made from scratch). These settings display even very different color animations, not only in terms of color interaction, but also in terms of speed, transition effect and other parameters.

Theapp Nanoleaf presents itself a number of predefined schemes, together which can be expanded either by defining personal schemes or by downloading new schemes from the collaborative database of Nanoleaf users around the world.

After having been able to review Nanoleaf Canvas and have dedicated a guide for integration on Home Assistant, inDomus wondered what could be the accessory features given from the combined use of these panels with the known personale HUB.

The answer (or at least, one of the possible) is the present procast, which will explain how to do so activate specific Nanoleaf color schemes according weather conditions (or forecasts, why not) of the location in which it is installed or based to specific states of the profirst home automation, by way of "control panel”(The detection of a alarm, the status of a sensor and much more). Something a little more elaborate of this other projet based only on simple LEDs.

What is the limit?
As usual, fantasy.

It starts

Logic of projet

First we will equip ourselves of elementary information relating to the climate of the location in which they are installed Home Assistant and the Nanoleaf panel / s. From this information we will then define automation which when the entity is turned on "Light"That rappresets the Nanoleaf panel provveda ad appDiscard the desired visual effect. taking advantage of the service parameters characteristic of this type of entity.

Appby applying the same logic, we will suggest automations which, on the other hand of the occurrence of a given condition (eg crossing a threshold, or other states of certain entities) switch on the panel by setting a specific visual effect.

Assumptions

For the realization of the present projet we assume that:

Current weather conditions

As anticipated, what we need is a source of related information at the current state of weather conditions of our area.

As is known, integration with the “Dark Sky” platform allows us to provide ourselves with the weather conditions - as well as forecasts - starting from a specific latitude / longitude rappshow the geographical position of our home automation environment.

Among the many entities generated by this integration there is one particularly useful for this projet, the one that appanointed reports weather conditions almost in real time. This entity is of the "Weather" type and changes its name based on the configuration of the integration.
Just search in the entity list of Home Assistant to find it easily:

Home Assistant - Dark Sky - Weather Summary

We will assume, for the present procast, that the climate entity at our disposal is called "weather.casamia"
Furthermore, we will use (optionally) the sensor "sensor.casamia_cloud_coverage“, Another entity always generated by the Dask Sky integration which provides the percentage coverage of the sky.

The weather conditions surveyed can be:

  • sunny (sunny)
  • clear-night (peaceful night)
  • rainy (rainy)
  • snowy (snowy)
  • snowy-rainy (sleet)
  • windy (windy)
  • fog (foggy)
  • cloudy (cloudy)
  • hail (hailstorm)
  • lightning (Lightning)
  • partly-cloud (partly cloudy)

What we will do is define a template entity that - starting from the above conditions - defines in itself the name of a pro"color" thread present on theapp Nanoleaf, to then use it when defining the automation that will self-adjust the Nanoleaf panel.

Nb As mentioned in the abstract, the use of the Dark Sky platform it is not mandatory: any other weather platform is sufficient, provided it provides the above information.

Nanoleaf

At this point it is necessary to go at theapp mobile Nanoleaf and identify what the patterns are "colorda applize based on various weather conditions (how and when we will see it later).

Where the color schemes present are not suitable, simply click on "Discover" on the bottom left and search for the collaborative Nanoleaf database and add to our list those that interest us most and please us.

Nanoleaf App  3

inDomus has identified a series of color schemes (which we will report in the example below) ideal for "mappare "external weather conditions. What is important to know is that, once the list of color schemes is defined, it is necessary bring them back into the configuration having care to report their names as they are written on theapp, under penalty of failurenameof the automatism that we will define.

In the image above, for example, a color scheme is called "Falling Whites".
Reporting the name:

  • falling whites - does not work
  • Falling whites - does not work
  • falling Whites - does not work
  • Falling Whites - IT WORKS

Therefore it will be the case to bring back in configuration the names written in a way correct.

Some interesting patterns found by inDomus:

Weather conditionColor scheme name at theapp Nanoleaf
SunnySunny
Peaceful nightStarry Night
RainyRain
Snowy / SleetSnow Day
WindyWindy Ocean
Fog*Solid*
Cloudy / Partly CloudyCloudy
HailRain Shower
fulminationLightning

Sensor definition

As mentioned, we will define a template sensor in order to automatically define, as conditions change, the prowire corrected by appto the panel. This choice is aimed at concentrate the logic of choice of the procolor thread on it, so as to be able to use its output in any automation / script / scene.

We will then add to the configuration of Home Assistant a sensor so defined:

sensor:
  - platform: template
    sensors:
      nanoleaf_weather_based_effect:
        friendly_name: "Effetto luminoso Naoleaf su base clima"
        value_template: >-
          {% if is_state("weather.casamia","sunny") %}
          Sunny
          {% elif is_state("weather.casamia","clear-night") %}
          Starry Night
          {% elif is_state("weather.casamia","rainy") %}
          Rain
          {% elif is_state("weather.casamia","snowy") %}
          Snow Day
          {% elif is_state("weather.casamia","snowy-rainy") %}
          Snow Day
          {% elif is_state("weather.casamia","windy") %}
          Windy Ocean
          {% elif is_state("weather.casamia","fog") %}
          *Solid*
          {% elif is_state("weather.casamia","cloudy") %}
          Clouds
          {% elif is_state("weather.casamia","hail") %}
          Rain Shower
          {% elif is_state("weather.casamia","lightning") %}
          Lightning
          {% elif is_state("weather.casamia","partlycloudy") %}
            {% if is_state("sun.sun","above_horizon") %}
              {% if states("sensor.casamia_cloud_coverage")|int < 40 %}
              Sunny
              {%- else -%}
              Cloudy day
              {% endif %}
            {%- else -%}
            Starry Night
            {% endif %}
          {% else %}
          Falling Whites
          {% endif %}

The sensor we defined (called "sensor.nanoleaf_weather_based_effect") Will contain in profirst a string rappbearing the name of one of the procolor wires previously identified based on changing weather conditions. This value will automatically change as the sensor status changes "weather.casamia"

It goes without saying that obviously the scheme proplace both highly customizable, both in the logic of appindication of the color scheme both in the chosen color schemes.

In the final part an exception was introduced: it was in fact noticed how Dask Sky tends to communicate “partly cloudy” condition even with a low presence of clouds. If the condition communicated is "partly-cloudy" but cloud coverage is less than 40%, the template sensor uses the procolor thread dedicated to sunny days. Moreover, after sunset appalways the same prowire ("Starry Night“).

Using forecasts

No one obliges us to necessarily use the current weather conditions. In fact, the intention could be to display on the panel not so much the current conditions as it is weather forecasts for 12-24 hours. Well: to do this it will be enough - instead of "weather.casamia"- use another entity that provides the forecast rather than the current condition.

Remaining in the wake of the implementation of "Dark Sky", a useful entity could be the sensor that ends with the suffix "_hourly_summary": Starting from the states provided by him (attention, these are provided in the language in which the proprio Home Assistant and not necessarily in English), it would be enough to customize the above sensor in an adequate way, for example:

sensor:
  - platform: template
    sensors:
      nanoleaf_weather_based_effect:
        friendly_name: "Effetto luminoso Naoleaf su base clima"
        value_template: >-
          {% if is_state("sensor.casamia_hourly_summary","Soleggiato") %}
          Sunny
          {% elif is_state("sensor.casamia_hourly_summary","Venticello") %}
          Windy
          {% elif is_state("sensor.casamia_hourly_summary","Piovoso") %}
          Rain
          {% else %}
          Falling Whites
          {% endif %}

Automation

At this point it is necessary to define automation that prowill see to the automatic management in theappeffect identification lumiconnected to the panel.

The thing more simple and intuitive is to define one which, when the panel is turned on, prosee applize the color scheme consistent with the climate, starting from the sensor status value "sensor.nanoleaf_weather_based_effect"Which, as explained, prohe sees himself to value himself.

Automation is therefore so easily realized:

automation:
- alias: "Impostazione Nanoleaf su base clima"
  trigger:
    platform: state
    entity_id: light.nanoleaf
    to: 'on'
  condition: []
  action:
    service: light.turn_on
    entity_id: light.nanoleaf
    data_template:
      effect: '{{ states.sensor.nanoleaf_weather_based_effect.state }}'

Il trigger it is obviously the change of state of the panel to "on" ("on"), None is present condition (but obviously this can be object of personalization) while theaction provides for the use of the service light.turn_on which is not so necessary when the panel is turned on - which is already switched on - but rather onappcation of the color effect derived from the previously defined template sensor (last line).

The interesting thing is that automation is performed whenever the panel is turned on not just from Home Assistant, but also from his app or even manually. The reason is simple: Nanoleaf integration means that Home Assistant know the status and status of the panel, so whatever the method of ignition, automation is always performed.

Use as a means of notification

Beyond automatically setting a color scheme for weather conditions, a Nanoleaf panel can also be used as a tool to notify certain events related to profirst personal home automation.

Since, as explained, it is possible to create personal schemes proprior (solid colors, flashing lights, iridescent colors, etc.), it is easy to think of having the panel turn on and display the aforementioned color scheme when a given situation occurs.

Let us therefore assume, for example, that we have integrated a Home Assistant of flooding sensors (entity "binary_sensor.water_leak_sensor"), A solenoid valve to interrupt the inflow of central water (entity "switch.ACQUA") And want to define an automation that

  • stop the flow of water;
  • turn on the Nanoleaf panel on the color scheme "Allagamento"(We assume it is red, solid color).

Automation could be the following:

automation:
- alias: "Allagamento "
  trigger:
    platform: state
    entity_id: binary_sensor.water_leak_sensor
    from: 'off'
    to: 'on'
  condition: []
  action:
    - service: switch.turn_off
      entity_id: switch.ACQUA
    - service: light.turn_on
      entity_id: light.nanoleaf
      data_template:
        effect: 'Allagamento'

In the presence of the automation which sets the panel, when it is switched on, to the "color" scheme relating to the climate ("automation.impostazione_nanoleaf_su_base_clima"), It will obviously be necessary to temporarily disable it when it is run, otherwise the two automations would conflict with each other.

The resulting automation will then be:

automation:
- alias: "Allagamento "
  trigger:
    platform: state
    entity_id: binary_sensor.water_leak_sensor
    from: 'off'
    to: 'on'
  condition: []
  action:
    - service: homeassistant.turn_off
      entity_id: automation.impostazione_nanoleaf_su_base_clima
    - service: switch.turn_off
      entity_id: switch.ACQUA
    - service: light.turn_on
      entity_id: light.nanoleaf
      data_template:
        effect: 'Allagamento'
    - delay:
        seconds: 3
    - service: homeassistant.turn_on
      entity_id: automation.impostazione_nanoleaf_su_base_clima

In evidence the added lines which prothey see the "climate" automation stop, wait three seconds and then reactivate it.


Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.


Please comment below