2021.4: For our advanced users ❤️

Survived April fools day? I assure you, this April release is no joke!

This release is dedicated to our more advanced user base, as it is packed with some really advanced features and enhancements our more experienced users will love. Ready to debug your automations? Yeah…

Not that advanced of a user? I’m sure there is something in here for you to look forward to as well.

Oh, by the way, have you heard the news of ESPHome joining the Home Assistant family? If not, you should definitely read the blog post announcing it!

Enjoy the release!


Database upgrades, please be patient

This release contains database migrations, meaning that the format of how your history is stored is changing. This migration is automatically performed after upgrading and takes a bit of time. The time it takes depends on how much history you have stored and how fast your system is.

Please be patient when upgrading to this release.

Automation debugging

Wait, why didn’t that light turn on? Why isn’t the thermostat adjusted? Why is this automation not working? What is going on here?! This is a haunted house!?!

Sounds familiar? I’m sure we all had these moments, but are you ready for this? We can now debug automations!

Screenshot showing the automation trace of a previously ran automation.

The above screenshot shows a previous run of an automation. The automation is displayed using an interactive graph, which highlights which path the automation took. Each node in the graph can be clicked to view the details on what happened with the automation during that specific step. It traces the complete run of an automation run.

If an automation didn’t run as it should, this will allow you to debug and understand why it ran the way it did.

This extremely advanced and super useful feature is thanks to the hard work of @emontnemery who build the backend for this. The beautiful graphing was made by @thomasloven, and all the frontend work by @balloob & @bramkragten. Marvelous job guys! Thanks!

Additionally, a special thanks to all the (beta) testers that helped testing this feature and those who provided trace samples that helped to squash bugs!

Got questions about this feature? Want to see it in action? Be sure to tune in to the 2021.4 release party stream later today!

Home Assistant Analytics

Now don’t be scared by the title!

Today we introduce: Home Assistant Analytics. Opt-in, privacy-aware, public and open source. Just as it all should be for our project.

@ludeeus did a fantastic job writing this new integration. You decide if you turn it on or not; however, we guarantee its privacy-aware. Doubt it? Review it! Everything is open source!

Not open enough for you? We are publishing the result for everybody to see:

Screenshot of the Home Assistant Analytics website.

Well, maybe you want to view the public result yourself:


So why do we do this? Well, it helps the project and all contributors to see things like: Most used integrations. This can significantly help with improving project priorities. It also helps to convince manufacturers to work with Home Assistant, add local control and privacy-focused features.

“But the updater did this already, right?” Yes, well, the updater has actually been broken. So while we had some data, it was barely usable (actually not useable at all). Instead of fixing the updater, we now have a better solution that better matches our project goals. The updater still exists; it now just does one single thing: showing if an update is available.

Want to help the project out? Please enable Home Assistant Analytics. We would be very grateful!

You can find the settings in the general configuration options, or click the My Home Assistant button below to go directly to it. (Only visible to owner users)

Screenshot of the Home Assistant Analytics options, you control the amount of data you share.

For more information on how this all works and what data is shared, check out our documentation.

Thanks for sharing already! ❤️

Warnings for undefined variables in Templates

This feature is really cool. While technically a small improvement, it is a change that can impact you (as in “breaking”), but also, will greatly help you!

So imaging this little template: {{ my_variable }}

Previously, if my_variable would not exist in the template or system as a variable, Home Assistant would just ignore it and skip over it.

While this can be convenient, it can become problematic when it was misspelled or referring to a variable that doesn’t exist at all. For example, if you would have mistyped it: {{ my_varaible }}, you would never know something is wrong, unless you spotted it.

As of today, Home Assistant will tell you this, using a warning in the logs!

Screenshot of undefined variable warning log.

This helps to find templates that behave unexpectedly because the variable you thought was there, isn’t. It is quite possible you get a bunch of warnings after upgrading to this release. Fixing those warnings, really helps to improve your setup.

So, what if a variable isn’t always there, but I still want to use it? Well, you can give it a default, for example: {{ my_variable | default }}. Or even an default value (10 in this example): {{ my_variable | default(10) }}.

Please note that these are just warnings for now. We plan to replace the warning with an error as of Home Assistant 2021.10 (in October).

Filtering automations, scripts and scenes

Categorizing automations, is definitely one of the most requested things in our history. This became clear again during last year’s month of what the heck and various issues/discussions/feature requests.

Suggestions for labels, folders, and many more have been created. However, we already have some great categorizing features in Home Assistant itself:

Devices, Areas & Entities.

Screenshot of filtering automations by living room area.

As of today, you can filter your automations, scripts and scenes by area, device or entity. For automations and scripts, it goes one step further; it magically finds those that affect the area, device or entity being filtered.

So, you can now look at the automations affecting your living room area (even if those automations itself are not in the living room area) and also filter the automation list with just the ones that touch your thermostat.

Z-Wave JS update

So before we talk about The nice new things in Z-Wave JS, there are breaking changes in this release for the Z-Wave JS integration that could affect your existing automations. Be sure to read the breaking changes section for more info.

Alright, now the fun stuff! You can now configure each Z-Wave device straight from within Home Assistant. When you view a device in the Home Assistant frontend, you can click on “CONFIGURE DEVICE” button that is shown on each device page. This allows you to manage and adjust device (node) specific configuration parameters for the selected device.

Screenshot of configuring a Z-Wave device from within Home Assistant.

Furthermore two new, advanced, services are introduced:

Trigger-based template sensors

This release adds initial support for a pretty advanced new, helpful feature. Template sensors, that are updated based on triggers and the data that comes with it.

Whenever the trigger fires, the template sensor will re-render and it will have access to the trigger data in the templates. This feature is a great way to create data based on webhook data, or have sensors be updated based on a time schedule.

See, for example, these two template sensors that update based on a single webhook trigger using data pushed into the webhook:

# Example configuration entry
  - trigger:
      - platform: webhook
        webhook_id: my-super-secret-webhook-id
      - name: "Webhook Temperature"
        state: "{{ trigger.json.temperature }}"
      - name: "Webhook Humidity"
        state: "{{ trigger.json.humidity }}"

You can test this trigger entity with the following CURL command:

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"temperature": 5, "humidity": 34}' \

It is not just webhooks! Any trigger that you can use in automations, can be used to update these types of template sensors.

For this release, it only works for sensors; other platforms are not supported yet.

Please note: that these new template sensors are configured under the template: key in the configuration and is using a new configuration format and keys. For more information, see the documentation.

UI selectors for script fields

You can now use UI Selectors for you scripts field parameters. This brings the same UI capabilities that Blueprint have to scripts. This allow for creating advanced scripts that you can later easily reuse in your UI (even in UI automation).

Screenshot of scripts using selects in its fields.

For more details on these new field configuration options, see the scripts documentation

Other noteworthy changes

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

  • The Supervisor is now also in the integrations dashboard, and provides entities for all kinds of things! These entities are disabled by default, so head over to the integration and see if there anything in there you could use. Thanks @raman325!
  • The develo Home Control (@Shutgun), Apple TV (@bdraco), August (@bdraco) and MQTT (@RadekHvizdos) integrations can now suggest areas.
  • You can now configure additional Google Cast devices by IP address via the integrations options. This is helpful in case of mDNS issues. Thanks @emontnemery!
  • @joshmcrty added support for selecting the number formatting you like on your profile! Awesome work!

Screenshot of selecting the number format you prefer.

  • @marvin-w added support for unique IDs to KNX entities. So, as a KNX user you can now tweak your entities in the frontend and group them into areas!
  • HomeKit now supports CO/CO2 device classes, thanks to @iMicknl!
  • @robertdelpeut added monthly and yearly totals to the DMSR sensor, thanks!
  • Hyperion users can now hide certain effects from the UI using integration options. Thanks, @dermotduffy!
  • Got that one message in your logs that you don’t care about? @jshufro added support for filtering log messages using regular expression!
  • The Plex integration now provides library count sensors! These are disabled by default by can be enabled if you like that. Thanks, @jjlawren.
  • The Quickbar had an update from @donkawechico! So press those C & E keys on you keyboard to see those beautiful new labels.
This is a companion discussion topic for the original entry at https://www.home-assistant.io/blog/2021/04/07/release-20214/

That looks AWESOME!


Looking forward to trying out the Panasonic remote, thanks joogs.

Regarding automation debugging, is this only available for automations created via the UI?

Nope, it is available for all automations, regardless of how it was created. The above screenshot is actually this automations YAML file, in a split configuration.



Thanks Frenk.

To all that have an mqtt fan. The link to the mqtt integration is of little use.

Look instead for the https://www.home-assistant.io/integrations/fan.mqtt/ documentation which the one that actually is relevant

@frenck the links to PRs and integration docs are obviously autogenerated and many of the doc links do not point to the actualy integration that was changed. Especially mqtt based integrations have doc links that point to the generic mqtt integration. In this months release besides the fan.mqtt update there is also an update to light.mqtt and probably more. I think the algoritm that creates the links need to be improved. I am trying to guess how it works and my guess is the labels that a bot adds to PRs. And that bot does a poor job I have noticed. Best would be that devs adds the name of the integration in the PRs

I should add that I am excited about the MQTT fan enhancement so I finally can have a clean implementation of speed with my MQTT based home made bedroom ventillator

1 Like

Correct, those docs are pending consolidation. MQTT is one of the few that haven’t followed that structure yet. Apologies, the system isn’t able to understand the difference. And yes, all commit/change messages are generated. Considering it are over 800 lines this release :wink:

The new analytics look awesome. Already enabled all of them. The automation debugger might convince me to give native automations another look :slight_smile:


It does not work in all cases it seems (not sure if its a bug)

with an automation included with :

packages: !include_dir_named includes/packages

Correction : it works as soon as the automation has an id set, must have missed that mandatory change. But error message is for sure confusing.

interesting. number format selector comes before date/time format selector…

But how to achieve 1234,56 ?
number formatting consists of several parts like thousands separator, decimal separator.
Those should be configurable separatelly (until you don’t want to put all possible combinations into droplist.
Such approach is not new - it does exist for 2 decades.

BTW what ‘None’ option name does mean? the droplist obviously contain combinations of both separators. None is referring to what? none spaces between thousands? no formatting - formally it doesn’t exist, it’s aleays formatted one way or another

Hmm… that error message looks incorrect, or a bug. I have automations both in the UI and in a split config, both I’m able to trace and debug.

Please be sure to report it on the issue tracker! :+1:

EDIT As noted below by @ludeeus, the automation must have a unique ID for this functionality to work.


Other than Nanoleaf, Verisure, and KNX, do any other integrations get unique ids added as of this version ?

Is the display of input_datetime helpers fixed in the logbook ?

Make sure all automations have an (unique) id set.


You are absolutely right! And I’m sure everybody would be thankful for adding it. Please do so :+1:


It would be awesome if the VSCode Home Assistant extension could have a template or autocompletion that would automaticaly invoke uuidgen (or similar command on the platform_ to automagically create and insert unique id: parameters.


I’ve lost all attribute entities in Xiaomi Air Purifier (temp, hum, aqi). I can see it as an attribute, but no entities I can use.

You are sounding like it would be something incredibly hard comparing to work already done. In fact the complexity of both approaches is the same. the only difference is that current state requires additional effort to make things right.
I wonder why so many things must be done half-way. even these trivial ones.

I just use the object_id as these can’t be duplicated either. Or did - before I removed them all to prevent deleted automations showing up in the entities list.

Guess I’ll put them back and just try to remember that I have to delete automations in two places.

Thanks for the quick responses guys !

This is once again an awesome release : during beta it already helped me to debug “automation that was not always triggering”, turns out the script triggered multiple times by that automation was in single mode, found the issue so quickly, it’s awesome !

The add-on version of VSCode does…