2021.7: A new entity, trigger IDs and script debugging

Comments

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!

../Frenck

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.

automation:
  - alias: "Trigger IDs!"
    trigger:
      - platform: state
        id: "normal"
        entity_id: binary_sensor.gate
        state: "on"
      - platform: state
        id: "forgotten"
        entity_id: binary_sensor.gate
        state: "on"
        for:
          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.

automation:
  - alias: "Trigger IDs!"
    ...
    action:
      ...
      - condition: trigger
        id: "forgotten"
      - service: notify.frenck_iphone
        data:
          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.

automation:
  - alias: "Notify to close the window"
    trigger:
      - platform: numeric_state
        entity_id: sensor.outside_temperature
        above: sensor.inside_temperature
    action:
      - service: notify.frenck_iphone
        data:
          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.

Using a reverse proxy with Home Assistant

Home Assistant will now block HTTP requests when a misconfigured reverse proxy, or misconfigured Home Assistant instance when using a reverse proxy, has been detected.

If you are using a reverse proxy, please make sure you have configured use_x_forwarded_for and trusted_proxies in your HTTP integration configuration.

For more information, see the HTTP integration documentation.

Additionally, access to Home Assistant from the same IP address as a trusted proxy will be rejected if the request is marked as forwarded.

(@frenck - #51839) (http docs)

Python 3.9 / Alpine 3.13

Our Docker images are now based on Alpine 3.13 and run Python 3.9.

This is mainly interesting if you running custom Docker containers based on our container.

If you are using Home Assistant Container, Home Assistant OS or the Home Assistant Supervised installation method, you will automatically get this update on upgrade and no additional interaction is needed.

Please note, that Alpine 3.13 on ARM devices running a 32-bits operating system (armhf/armv7), requires your Docker version to be at least 19.03.9 (although, we recommend updating to an even higher version). Additionally, you need to have libseccomp 2.42 or newer.

(@pvizeli - #51628)

Airly

The AirQuality platform has been marked as deprecated. The air_quality entity is removed and replaced with sensor entities. You will need to update their automations and dashboards if you have been using the air_quality entity of Airly.

(@bieniu - #52225) (airly docs)

Azure Event Hub

When using this integration with IoTHub, the event_hub_name is now a required field can be filled by the DeviceID when using IoTHub.

(@eavanvalkenburg - #52049) (azure_event_hub docs)

CEC Support

Our Docker container has limited support for CEC drivers to those provided by the Linux kernel. This applies to the Home Assistant Container, Home Assistant OS and Home Assistant Supervised installation types.

This will cover most CEC drivers out there.

(@pvizeli - #51637)

Coinbase

The Coinbase integration migrated to configuration via the UI. Configuring Coinbase via YAML configuration has been deprecated and will be removed in a future Home Assistant release. Your existing YAML configuration is automatically imported on upgrade to this release; and thus can be safely removed from your YAML configuration after upgrading.

(@TomBrien - #45354) (coinbase docs)


Only accounts explicitly included in account_balance_currencies will be loaded. Excluding the option will no longer load all provided accounts as Coinbase’s API now provides at least 29 accounts even if they are not configured in your API settings on Coinbase.

(@TomBrien - #51981) (coinbase docs)

Database (statistics table)

The statistics table is a Home Assistant data table that is not exposed or used by Home Assistant yet and is part of an alpha / feature that is in development. However, it does exist and you might already want to check it out or find a use for it.

In this release, the content of this table is reset. This does not impact any state history and this data isn’t used by Home Assistant as of yet.

If you have no idea what this message is about, you can safely ignore it. We have merely listed this to be complete in our backward-incompatible changes report.

(@emontnemery - #52331) (history docs)

DSMR Slimme Meter

Configuring the DSMR integration via YAML has been deprecated and will be removed in Home Assistant 2021.9. If you have an existing YAML configuration for the DSMR platform is will be imported into the UI automatically on upgrade. You can safely remove the DSMR YAML configuration after upgrading Home Assistant.

(@frenck - #52179) (dsmr docs)


The Hourly Gas Consumption sensor has been removed from the DSMR integration. This sensor was calculated and it is not an actual datapoint from the energy meter.

If you are looking for a replacement, you can use the Derivative integration to re-create the hourly (or any other timeframe) sensor based on the total Gas consumption sensor.

(@frenck - #52147) (dsmr docs)

Google Play Music Desktop Player (GPMDP)
  • The integration has been disabled since it requires an old version of the websocket-client library which is incompatible with the requirements of other integrations that are actively maintained.

  • It’s not clear if this integration still works with the gpmdp app that now only supports YouTube Music. If there’s someone that uses the integration successfully and wants to take on the maintenance task that is required to get the integration in a compatible state, please create an issue to discuss the future of this integration.

(@MartinHjelmare - #51509) (gpmdp docs)

Growatt

The Growatt API has changed individual PV array units from Watts to Kilowatts. This change is to update the units used for these values in Home Assistant, therefore the units for these values will change.

(@muppet3000 - #52021) (growatt_server docs)

Kuler Sky

Kuler Sky lights no longer supports the deprecated white_value attribute for its lights. Use the rgbw_color attribute instead.

(@emontnemery - #52080) (kulersky docs)

MeteoAlarm

You can no longer use the 2 letters of your country code, but must now use the complete country name in your configuration. To find out which country names you can use, please look at meteoalarm.org.

(@rolfberkenbosch - #51383) (meteoalarm docs)

Modbus

As announced in 2021.4, the “old style” YAML was deprecated and now removed:

Example “old style” configuration, that is now invalid:

modbus:
  - name: hub1
    type: tcp
    host: IP_ADDRESS
    port: 502

binary_sensor:
  platform: modbus
  registers:
    - name: Sensor1
      hub: hub1
      slave: 1
      register: 100

Same configuration in valid new style:

modbus:
  - name: hub1
    type: tcp
    host: IP_ADDRESS
    port: 502
    binary_sensors:
      - name: Sensor1
        slave: 1
        address: 100

(@janiversen - #51117) (modbus docs)


The coil and register configuration options are changed to address and (if not default) input_type.

Previous configuration example:

modbus:
  - name: hub1
    type: tcp
    host: IP_ADDRESS
    port: 502
    covers:
      - name: Door1
        coil: 117
      - name: Door2
        register: 131
        state_open: 1
        state_closed: 0

The new configuration looks like this:

modbus:
  - name: hub1
    type: tcp
    host: IP_ADDRESS
    port: 502
    covers:
      - name: Door1
        input_type: coil
        address: 117
      - name: Door2
        address: 131
        state_open: 1
        state_closed: 0

(@janiversen - #51154) (modbus docs)


The configuration attributes curent_temp_register and current_temp_register_type are changed to address and input_type in order for all platforms to have a common configurations.

Before this PR, this was legal:

modbus:
  - name: hub1
    type: tcp
    host: IP_ADDRESS
    port: 502
    climates:
      - name: "Watlow F4T"
        current_temp_register: 27586
        current_temp_register_type: holding

This changes to:

modbus:
  - name: hub1
    type: tcp
    host: IP_ADDRESS
    port: 502
    climates:
      - name: "Watlow F4T"
        address: 27586
        input_type: holding

(@janiversen - #51202) (modbus docs)


Modbus sensor ‘reverse_order’ is no longer supported, please use ‘swap’ instead.

Old configuration:

modbus:
  - name: hub1
    type: tcp
    host: IP_ADDRESS
    port: 502
    sensors:
      - name: Sensor1
        address: 100
        reverse_order: true

New configuration:

modbus:
  - name: hub1
    type: tcp
    host: IP_ADDRESS
    port: 502
    sensors:
      - name: Sensor1
        address: 100
        swap: word

(@janiversen - #51665) (modbus docs)


data_count is no longer supported, please use count.

No longer supported:

modbus:
  - name: hub1
    type: tcp
    host: IP_ADDRESS
    port: 502
    climates:
      - name: "Watlow F4T"
        address: 27586
        input_type: holding
        data_count: 1
        ...

Please change it to:

modbus:
  - name: hub1
    type: tcp
    host: IP_ADDRESS
    port: 502
    climates:
      - name: "Watlow F4T"
        address: 27586
        input_type: holding
        count: 1
        ...

(@janiversen - #51668) (modbus docs)

MQTT

It’s no longer possible to set attributes defined in the base component via a configured json_attributes_topic.

For example, a light no longer accepts brightness via the json_attribute_topic. This was unintended and an undocumented functionality that lead to unexpected behavior.

This change applies to all supported MQTT platforms.

(@emontnemery - #52242 #52278 #52280 #52285 #52286 #52283 #52289 #52291 #52290 #52288 #52282 #52279) (mqtt docs)

Nettigo Air Monitor

The AirQuality platform has been marked as deprecated. The air_quality entities will be deleted and replaced with sensor entities. You need to update your automations and dashboards if you have been using these air_quality entities in those.

(@bieniu - #52152) (nam docs)

Open Z-Wave

Open Z-Wave lights no longer support the deprecated white_value attribute, use rgbw_color instead.

(@emontnemery - #52063) (ozw docs)

Prometheus

Prometheus is now converting temperatures in °F to °C. If you are relying on temperature_c being in Fahrenheit, you will need to make adjustments, for example by doing a unit conversion in a PromQL query.

(@masto - #52212) (prometheus docs)

Recorder

The underlying library that is used for the database connections, has been updated. This fixes a bug, that might be a breaking change for you.

If you use an @ in your database username or password, you will have to adjust your database connection string to use %40 instead.

Database connection strings are considered URLs, thus special characters need to be encoded. %40 is the URL encoded version of @.

Rituals Perfume Genie

The switch extra state attributes fan_speed and room_size will be removed in the next release. As of this release, both attributes are available as entities, making it possible to change the value with Home Assistant.

(@milanmeu - #51993) (rituals_perfume_genie docs)

Sony Bravia TV

From April 2020, the Sony Bravia TV integration has been automatically importing your import of existing YAML configurations. Now we have removed this option for migration. Your existing configuration has been imported to the UI already and can now be safely removed from your YAML configuration files.

(@bieniu - #52141) (braviatv docs)

Spain electricity hourly pricing (PVPC)

With the change to the new, and unique, electric tariff 2.0TD, if you previously had configured multiple PVPC sensors monitoring prices for more than one of the old tariffs, only the first one will survive. This means if you have any automation or script that depends on these removed sensors, you might need to adjust them.

(@azogue - #51789) (pvpc_hourly_pricing docs)

Tasmota

Tasmota doesn’t support independent control of all four channels of an RGBW light, so rgbw_color was a very poor fit for it and gave counter-intuitive results. Tasmota lights supporting color and white will now be added as a light supporting color modes hs and white, not as a light supporting color_mode rgbw. now supports setting white instead.

Scenes setting a Tasmota light can be updated by using the scene UI editor.

Automations setting a Tasmota light need to be updated manually, to set a light to white mode do:

  - service: light.turn_on
    target:
      entity_id: light.genbbc05
    data:
      white: 242

(@emontnemery - #51608) (tasmota docs)

Switcher

In preparation for multi-device support, configuration via the UI and support for discovery; this integration is migrating entity attributes into sensors to be later added as device entities. The following switch entity attributes migrated to sensors:

Attribute Sensor Name
power_consumption Power Consumption
electric_current Electric Current
remaining_time Remaining Time
auto_off_set Auto Shutdown

(@thecode - #51964) (switcher_kis docs)

Yamaha MusicCast

The integration has been rewritten from the ground up and is now configurable via the user interface only. Existing platform YAML config will automatically be imported into the user interface on upgrade and can be safely removed from the YAML configuration after the upgrade has been completed.

(@vigonotion - #51561) (yamaha_musiccast docs)

Zero-configuration networking (zeroconf)

The IPv6 configuration option has been deprecated in favor of the settings provided by the network integration.

(@bdraco - #51173) (zeroconf docs)

All changes

Click to see all changes!