2021.7: A new entity, trigger IDs and script debugging


Happy July, which means Home Assistant Core 2021.7!

An interesting release, with a bunch of little goodies to make things easier in creating automations, scripts and doing templating. Those are things that in general, make me very happy. Mainly because, well, I use Home Assistant to automate 😁

Also, we are saying “hi!” 👋 to a new type of entity, which is really exciting and I can’t wait to see how that is being put to use in the future.

Lastly, I want to give a shout-out to @klaasnicolaas! He has been an intern with Nabu Casa for the last months. Besides doing the community highlights, he has been working on some awesome stuff that will land in upcoming Home Assistant releases.

His internship is now over, and he passed with a nice grade. Yet, he could not leave without a little present as it seems. He contributed the Forecast.Solar integration, bringing in energy production forecasting for your solar panels. Really cool!

Alright, that’s it! Enjoy the release!


New entity: Select

In this release, we welcome the select entity to the Home Assistant family. The select entity is a close relative of the dropdown helper (also known as input_select).

The difference is that while the input select is configured and managed by you, the select entities are provided by integrations.

This means integrations can now provide entities that give a choice. Either in the Lovelace UI, but also via automations using services, and via the Google Assistant.

Screenshot of a select entity, providing a choice from a list of options Screenshot of a select entity, providing a choice from a list of options.

Some integrations started implementing the first select entities as of this release. MQTT & KNX made it available for use, WLED uses it to provide controls on selecting and activating a user preset, and with Rituals Perfume Genie you can now change the room size for your diffuser.

Trigger conditions and trigger IDs

If you are creating some complex automations in YAML, you might be familiar with this. Consider a big automation, with a whole bunch of triggers. But how would you know which of those triggers actually triggered the automation?

You can now assign an id to your triggers that is passed into automation when triggered, allowing you to make decisions on it.

  - alias: "Trigger IDs!"
      - platform: state
        id: "normal"
        entity_id: binary_sensor.gate
        state: "on"
      - platform: state
        id: "forgotten"
        entity_id: binary_sensor.gate
        state: "on"
          minutes: 10

The above example triggers the same automation twice, when the gate opens and when the gate is left open for 10 minutes (probably forgotten). Each trigger has its own ID.

Now introducing the new trigger condition! So you can add a condition on which trigger fired the automation.

  - alias: "Trigger IDs!"
      - condition: trigger
        id: "forgotten"
      - service: notify.frenck_iphone
          message: "Someone left the gate open..."

You can use the trigger condition in all places where all the other conditions work as well, including things like choose from a group of actions.

Rather use the UI to create and manage your automations? No problem! These new features have been added to the automation editor as well!

Screenshot of using a trigger condition in the automation editor Screenshot of using a trigger condition in the automation editor.

Script debugging

In Home Assistant Core 2021.4, we added the ability to debug automations. In this release, we’ve made these same powerful tools available for scripts!

So, this helps for the next time you are wondering: Why didn’t that script work? Or why did it behave as it did? What the script is going on here?

Screenshot of using the new script debugger on my office announce script Screenshot of using the new script debugger on my office announce script.

The above screenshot shows a previous run of a script, using an interactive graph for each step in this script; with the path it took highlighted. Each node in the graph can be clicked to view the details of what happened on each step in the script sequence.

Referencing other entities in triggers and conditions

A small, but possibly helpful, change to our script and automations. You can now reference other entities for the above/below values of numeric state triggers and conditions. Both sensors and number entities can be used.

For example, you can now trigger an automation if the outside temperature is higher than the temperature inside.

  - alias: "Notify to close the window"
      - platform: numeric_state
        entity_id: sensor.outside_temperature
        above: sensor.inside_temperature
      - service: notify.frenck_iphone
          message: "Close all windows, it is warm outside!"

The numeric state conditions supports the same.

Additionally, the time conditions now support a similar thing using other sensors that provide a time in the before and after options. Time triggers added support for that already in a previous release.

Working with dates in templates

If you ever tried to work with dates in templates, you probably know that that is hard. And honestly, that will never go away, times, dates and timezones are complex little beasts.

However, we realized that the hardest part of using date & times with templates is converting the state of a sensor or text to a datetime. This release adds a small template method to help with that: as_datetime.

It can be used as a filter or as a method. Here is an example of calculating the number of days until my drivers’ license expires:

{{ (states('sensor.drivers_license') | as_datetime - now()).days }} days

Series version tags for Docker containers

If you are using the Home Assistant Container installation method, we recommend using a specific version tag; however, that means you need to update the version tag each time we release a new patch version of Home Assistant.

Thanks to @kmdm, as of this release, we also provide a series version tag that always points to the latest patch version of that release, in addition to all existing tags we already provide.

docker pull ghcr.io/home-assistant/home-assistant:2021.7

The 2021.7, will contain the latest July release, even if that is actually version 2021.7.2.

Other noteworthy changes

There is much more juice in this release; here are some of the other noteworthy changes this release:

  • Z-Wave JS got quite a few updates this release:
    • A new zwave_js.multicast_set_value is available, allowing to issue a set value command via multicast. Thanks, @raman325!
    • Each node now has a status sensor available and can be pinged using the new zwave_js.ping service. Added by @raman325.
    • The Z-Wave JS configuration panel now has a “Heal Network” button, thanks @cgarwood!
    • Z-Wave JS Server connection can now be re-configured from the Z-Wave JS configuration panel, added by @MartinHjelmare.
    • Z-Wave JS logs can now be downloaded, thanks @raman325!
  • The Google Assistant integration now has support for fan speed percentages and preset modes. Thanks, @jbouwh!
  • @jbouwh didn’t stop there and added fan preset mode support to Alexa too!
  • The Philips TV integration now supports Ambilights, added by @elupus.
  • Yamaha MusicCast integration now supports grouping services, thanks @micha91!
  • @raman325 added a whole bunch of sensors to the ClimaCell integration!
  • WLED now supports local push. Updates are now instantly both ways. Also, the master light can be kept and added support for controlling user presets.
  • Setting up Xiaomi devices has gotten way easier! There is no need to do difficult things to get the tokens. Instead, Home Assistant can now extract the tokens from a Xiaomi Cloud account. Thanks, @starkillerOG!
  • More Xiaomi updates, @jbouwh added support for fan percentage-based speeds and preset modes.
  • @RenierM26 added a lot of new services to the Ezviz integration, thanks!
  • Tibber had quite a few improvements and now provides a power factor sensor, added by @Danielhiversen!
  • Google Translate TTS now supports the Bulgarian language, thanks @hristo-atanasov!
  • If you have a SmartTube, you can now reset your reminders, thanks @mdz!
  • KNX had quite a lot of updates and added support for XY-color lights, thanks @farmio.
  • @OttoWinter added support for presets, custom presets and custom fan modes for climate controls in ESPHome. Awesome!
  • Nuki now has a service to enable/disable continuous mode, thanks @anaisbetts!
  • @cgomesu added quantiles to Statistics integration, thanks!
  • The Home Assistant login page now better support password manager, thanks, @rianadon!

New Integrations

We welcome the following new integrations this release:

New Platforms

The following integration got support for a new platform:

Integrations now available to set up from the UI

The following integrations are now available via the Home Assistant UI:

Release 2021.7.1 - July 8

Release 2021.7.2 - July 12

Release 2021.7.3 - July 16

Release 2021.7.4 - July 21

If you need help…

…don’t hesitate to use our very active forums or join us for a little chat.

Experiencing issues introduced by this release? Please report them in our issue tracker. Make sure to fill in all fields of the issue template.

Backward-incompatible changes

Below is a listing of the breaking change for this release, per subject or integration. Click on one of those to read more about the breaking change for that specific item.

All changes