2021.5:稳定性、性能、触发器与颜色模式!

一个月后,我又来了。你已经习惯这种每月一次的发布节奏了吗?你好啊,2021.5!很高兴在这个五月见到你!

要我说,这次发布相比上一个版本,功能上的“爆点”确实少一点(在我看来,上个版本真的很传奇!)。不过这并不是坏事!

这次发布带来了不少非常棒的稳定性改进!它们不是那种你会立刻冲去尝试的热门新功能,但这些基础能力会在当下以及未来,切实帮助我们的系统表现得更好。这也让这次升级对大多数人来说都会相当顺利(记得查看向后不兼容变更部分)。

这次发布里最显眼的变化,大概要数集成仪表板的焕新改版了。哦,还有灯光的新颜色模式,也同样是个非常出色的改进!

五月……对我来说,就像夏天正在慢慢探出头来,我已经开始期待了 🕶。你有没有准备一个夏季的 Home Assistant 自动化项目呢?

哦,对了,别忘了今天晚些时候来收看发布派对直播! (小剧透:我听说我们可能会有一位特别嘉宾,只是 Paulus 不肯告诉我是谁……)

2021.5 Stream Party on YouTube: https://www.youtube.com/watch?v=bvAKUz-bmqU

../Frenck

数据库升级与性能

这次发布包含数据库升级,不过别担心,数据库升级现在会在后台进行,不会再阻止 Home Assistant 启动。 在迁移完成之前,Home Assistant 会阻止重启或停止操作。

感谢 @lmagyar@raman325,我们现在可以存储最长 64 个字符的事件名, 即使有事件超过这个长度,recorder 也不会再因此卡住。

如果你曾经遇到过 recorder 迟迟关不掉的情况,现在也不用再担心了,因为即使数据库损坏,Home Assistant 现在也能顺利关闭。

说到损坏的数据库:如果你曾经遇到 SQLite 数据库损坏,就一定知道要把系统重新救活有多折腾。 我们最近加入了实时恢复能力,让 Home Assistant 在 recorder 保存事件或状态到数据库时 遇到损坏,也能自动恢复并启用一个新的数据库。这次发布进一步把这项实时恢复扩展到了迁移与清理阶段。 这也意味着,在异常关机后,你再也不用苦等数据库检查了!

最后,我们还通过降低写入频率提升了 recorder 的性能。

启动可见性:到底是什么拖慢了启动?

你有没有想过,为什么 Home Assistant 启动总是这么久?

现在不用再猜了,因为你终于可以看到到底是哪一个集成拖慢了启动速度。Home Assistant 启动时,会直接显示耗时最长的集成。

Screenshot of Home Assistant starting Screenshot of Home Assistant reporting 集成 that are being set up.

如果你错过了这些通知,之后也可以随时在信息面板中查看。

Screenshot of information 面板 showing 集成 set up times Screenshot of information 面板 showing 集成 set up times.

这个 My 按钮会直接带你过去:

为什么我按了重启按钮,Home Assistant 却没有重启?

那么,为什么你按下重启按钮后,Home Assistant 没有重启? 这个问题我们已经见过很多次了,而且确实非常烦人。现在,这个体验已经得到改进。

现在,重启按钮会直接给出反馈!这样一来,如果因为配置无效、集成损坏,或者数据库正在升级而无法重启,你会第一时间知道原因。

我们调整了超时设置,也修复了一些会让关闭流程无限卡住的问题。 例如,在重启 Home Assistant 时会检查配置,而之前就存在某些情况下会在这一步永久挂起的问题。

这也意味着现在重启更快了!因为 Home Assistant 的更多部分现在都能比以前更好地响应或取消关闭流程 (这也是 What the Heck 月活动的一部分成果)。

我们还审查了使用量最高的 35 个集成,确保它们在停止时会正确停止轮询。 感谢大家启用分析功能

焕然一新的集成仪表板

集成仪表板 现在已经更新,界面更紧凑,同时也能提供更有用的信息。

例如,它现在会显示集成的状态;如果加载失败,也会直接告诉你失败原因。

Screenshot of the updated 集成 仪表盘 Screenshot of the updated 集成 仪表盘.

此外,你现在还可以分辨依赖云端的集成(会显示一个小云朵标签),以及以自定义集成方式安装的集成(会显示一个小包裹标签)。

颜色模式!

我们现在支持 RGBWW、RGBW 以及更多颜色模式了!

以前,我们主要依赖 HS(Hue Saturation)和亮度(HSB/HSV),Home Assistant 中的颜色处理基本都建立在这套模型上。 而现在,集成可以直接提供灯光真实支持的颜色模式。这样一来,Home Assistant(以及各类集成) 就能针对具体灯光做出更准确的行为适配。

例如,前端会根据灯光的颜色模式调整取色器;灯光的“更多信息”对话框也已经完成现代化改版,以支持这项变化:

Screenshot of the updated more info dialog for 灯光 Screenshot of the updated more info dialog for 灯光.

请注意,目前还不是所有集成都已经支持颜色模式。不过,所有灯光都会拥有截图中那样更新后的漂亮界面。

基于触发器的二进制模板传感器

上一期发布中,我们引入了基于触发器的模板传感器。这次发布在此基础上进一步扩展,新增了基于触发器的二进制模板传感器支持。

基于触发器的二元传感器还可以配置 auto_off 持续时间。 这样一来,它会在指定时间后自动把二元传感器状态切换回 off

template:
  - trigger:
      - platform: event
        event_type: netatmo_event
        event_data:
          type: movement
    binary_sensor:
      - name: "Motion"
        # We use auto_off, so just set it to true on each trigger
        state: "true"
        device_class: motion
        # Automatically turn off 60 seconds after the last event
        auto_off: 60

还有一些其他思路:

Docker 镜像现已签名,并可通过 GitHub 容器注册表获取

我们现在同时使用 DockerHub 和新的 GitHub 容器 Registry。

如果你想使用新的 GitHub 容器注册表,只需要使用:

ghcr.io/home-assistant/home-assistant

(Instead of homeassistant/home-assistant)

我们的核心镜像现在也已经使用 CodeNotary 签名, 这样你就可以验证镜像的完整性。

CodeNotary 是一个分布式账本方案,使用 immudb 作为数据库,内置加密证明与验证能力。

如果你运行的是 Home Assistant Operating System 或受监管模式安装, 我们已经会自动检查分发内容的完整性。 如果你使用的是容器安装方式,则可以安装 VCN 工具。

然后你可以这样使用它:

docker pull ghcr.io/home-assistant/home-assistant:2021.5.0
vcn authenticate --org home-assistant.io docker://ghcr.io/home-assistant/home-assistant:2021.5.0

这样就可以告诉你并确认:你拿到的镜像,确实是由 Home Assistant 项目构建并发布的。

其他值得注意的变化

这次发布还有很多内容;下面是其中一些同样值得关注的变化:

  • 你是不是经常开会?新的 mutesync 集成可以在 Home Assistant 中显示你是否正在开会、是否处于静音状态,这能解锁很多很酷的“请勿打扰”自动化。
  • We did an audit of memory leaks and fixed a couple of generic cases in our 核心 codebase. But also fixed over 15 cases during unload/重载 in popular 集成.
  • The TTS 服务 by Home Assistant Cloud now uses an improved bitrate, making it sound even more impressive.
  • ClimaCell now supports the v4 API. So, If you've wanted to test it out you can now actually use it with the new API keys. Thanks @raman325!
  • If you are into templating, we now have min() and max() available as functions in Jinja templates.
  • The AdGuard 集成 now supports multiple instances thanks to @eifinger.
  • When viewing your 日志 in the 前端, the 日志 entry will tell you if the 日志 was 创建 by a custom 集成.
  • If you have a Sonos Move or Sonos Roam, you can now see their battery level and charging 状态. Thanks for that @hufman and @jjlawren.
  • Template 遮盖 now can have an opening and closing 状态, which was added by @bdr99, thanks for that!
  • The ZHA 集成 now has 配置 options in the UI, allowing you to set things like default transition times for your 灯光. Thanks @dmulcahey!
  • The Z-Wave JS 集成 now allows you to re-interview a 设备 from the UI thanks to @cgarwood.
  • @cgarwood didn't stop there, you can now opt-in for sending Z-Wave JS telemetry to the Z-Wave JS project to help them out. This can be turned on in the Z-Wave JS 配置 面板.

新集成

欢迎以下新集成加入本次发布:

新平台

以下集成新增了对新平台的支持:

现已支持通过 UI 设置的集成

以下集成现在可以直接通过 Home Assistant UI 进行设置:

发布 2021.5.1 - May 7

发布 2021.5.2 - May 10

发布 2021.5.3 - May 11

发布 2021.5.4 - May 14

发布 2021.5.5 - May 19

如果你需要帮助……

……欢迎随时使用我们非常活跃的论坛,或者加入我们的聊天频道

如果你遇到了这次发布引入的问题,请到我们的 issue tracker 提交反馈,并确保填写问题模板中的所有字段。

Backward-incompatible changes

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

We no longer run an udev instance inside our 容器. This was used by the Supervisor which now is using the host udev in all 容器.

For now, we have a fallback environment variable USING_UDEV=1 which you can set on your 容器 to get the old behavior. This gives you time for using the Docker way to map/use 设备.

If you run a system that uses the Supervisor, this is automatically taken care of.

(@pvizeli- #180)

Custom 集成 now require a 版本 key in their manifest file, this also means that all custom 集成 now require a manifest file.

If you are using a legacy custom 集成 like custom_components/awesome.py this now needs to move to custom_components/awesome/__init__.py so you can add custom_components/awesome/manifest.json to it.

更多信息 about 集成, manifests have a look here: https://开发者.home-assistant.io/docs/creating_integration_manifest

Custom 集成 that do not have this will be blocked from loading if it’s missing a 版本 in the manifest starting with Home Assistant 2021.6.

If you see these 错误, please report the issue with the author of that custom 集成.

(@ludeeus - #49726)

An event fired with an event_type of more than 64 characters would previously result in recorder 错误 but the event would otherwise work. Now, firing an event with more than 64 characters in the event type will raise immediately.

If you are using long events in your 自动化 or 脚本, you should adjust to this change. Custom 集成 authors should review their event types.

(@raman325 - #48115)

The device_tracker 实体 状态 属性 ip_address has been changed and is now be named ip. You need to 更新 自动化 and 脚本 that use this 属性.

(@bieniu - #48764)

The AVM FRITZ!Box Tools 集成 is now configured via the UI. Configuring the 集成 via YAML is now deprecated. Existing YAML 配置 is automatically imported on 升级 and can be safely removed after 升级.

(@chemelli74 - #48287)

YAML 配置 for AVM FRITZ!SmartHome has been removed, after it has been deprecated for 12 months. 配置 via UI is fully integrated. Existing YAML 配置 has already been imported automatically in the previous releases and can now safely be removed from your 配置 files.

(@mib1185 - #49663)

The pin 配置 option is currently an integer but will need to be prefixed with D for 树莓派 platforms.

Please adjust your YAML 配置 for this change.

(@TheGardenMonkey - #41525)

ecobee 温控 设备 will change the reported temperature precision for their current_temperature 属性 from whole degrees to 0.1 degree increments. 自动化 which rely on whole-number precision may need adjustments.

(@jjlawren - #48697)

Setting a 风扇 hold in the ecobee 集成 will no longer also set a temperature hold. If any 自动化 assumed that the temperature would be set when calling the set_fan_mode 服务 on an ecobee 设备, those 自动化 will need to add the appropriate set_temperature 服务 call.

(@bjpetit - #48086)

Enphase Envoy has fully transitioned to 配置 via UI. YAML 配置 will be removed in an upcoming 版本. Existing YAML 配置 will be imported automatically, and can now safely be removed from your 配置 files.

All 传感器 are now configured by default. Each inverter has a unique ID and can now be disabled in the UI.

(@bdraco - #48517)

The Ezviz 集成 is now configured via the UI. Configuring the 集成 via YAML is now deprecated. Existing YAML 配置 is automatically imported on 升级 and can be safely removed after 升级.

All 摄像头 状态 属性 were removed and replaced by binary_sensors, 传感器 or 开关.

List of old 摄像头 状态 属性 with their new replacements:

  • "privacy": 开关 实体, camera_name.privacy
  • "audio": 开关 实体, camera_name.sound
  • "ir_led": 开关 实体, camera_name.infrared
  • "state_led": 开关 实体, camera_name.灯光
  • "follow_move": 开关 实体, camera_name.tracking
  • "alarm_notify": camara status, "Recording"
  • "alarm_sound_mod": 传感器, camera_name.alarm_sound_mod
  • "encrypted": binary_sensor, camera_name.encrypted
  • "local_ip": 传感器, camera_name.local_ip
  • "detection_sensibility": 传感器, camera_name.detection_sensibility

If you are using one of these 属性 in your 自动化 or 脚本, you will need to adjust to this change.

(@RenierM26 - #45722)

The unit of measurement from Garmin Connect timestamp 传感器 has been removed. It used to be set to empty string. If you have 自动化, 脚本 or external data recvorder that rely on unit of measurement for these 传感器, you might need to adjust to this change.

(@MartinHjelmare - #48431)

The GNTP (Growl) 集成 has been deprecated and is going to be removed in Home Assistant 核心 2021.6.

The Growl project has now fully retired, see: https://growl.github.io/growl/

(@frenck - #49273)

The Google Travel Time 集成 is now configured via the UI. Configuring the 集成 via YAML is now deprecated. Existing YAML 配置 is automatically imported on 升级 and can be safely removed after 升级.

(@raman325 - #43509)

The existing Hive 服务 heating_boost will be deprecated in Home Assistant 发布 2021.6 and a new 服务 to replace it has been 创建 called heating_boost_on.

If you use the heating_boost Hive 服务 please 更新 your 配置 to the new 服务. A deprecation 警告 will be printed to the 日志 when the deprecated 服务 is used.

(@KJonline - #48701)

The config_file YAML option for KNX was deprecated before and has now been removed.

(@marvin-w - #48799)

When a 灯光 实体 has a default profile associated, the default profile will only be applied for the light.turn_on 服务 call when the 灯光 状态 is off or no data is sent with the 服务 call.

The transition 属性 from the default profile in light_profiles.csv will also be applied when light.turn_off is called.

(@karliemeads - #49376) (灯光 docs)

reset_waste_drawer, set_sleep_mode, and set_wait_time now have their own 服务. Previously, they were triggered by using send_command. If you used any of those commands in your 自动化 or 脚本, you'll need to replace them with their 服务 counter-part.

(@natekspencer - #48300)

A new option SWAP replaces REVERSE_ORDER, however REVERSE_ORDER is still accepted and silently converted to SWAP=WORD.

Note: REVERSE_ORDER will be removed in a future 发布.

Old 配置 example:

modbus:
  sensors:
    - name: "sensor1"
      address: 17
      reverse_order: true
      ...
   - name: "sensor2"
      address: 17
      reverse_order: false
      ...

New 配置 example:

modbus:
  sensors:
    - name: "sensor1"
      address: 17
      swap: word
      ...
   - name: "sensor2"
      address: 17
      swap: none
      ...

Swap allows none/byte/word/word_byte options.

(@janiversen - #49719)

Recollect Waste pickup dates are now stored as UTC timestamps.

(@bachya - #48690)

Database migrations are now done in the background and no longer prevent Home Assistant from starting.

The migration is started shortly after the started event since they are CPU intensive (mostly just sqlite since it's in the same process) and we do not want to compete with startup.

Events 创建 by your system are queued and processed when the migration is completed. There is a safety to start discarding events if more than ~30000 events happen before migration is completed to avoid memory exhaustion.

During migration, Home Assistant will prevent being started or stopped and this will also disable the homeassistant.stop and homeassistant.start 服务 until the migration has been completed.

The sqlite database recovery logic can now recover at point after 设置 including purge, migration, and event insert. In short we can always (hopefully) recover and start a new db without a 重启.

The quick check is no longer performed on unclean shutdown since we can always recover live. The db_integrity_check option has been deprecated.

(@bdraco - #49036 #49098)

If you are using a PostgreSQL database please verify that your connection URL starts with postgresql://. In case you use still an old URL starting with postgres://, please replace it with postgresql:// otherwise you will get an 错误 to set up the recorder.

The RoonLabs music player media_player previously had 集成 specific 服务 for roon.join and roon.un_join. These have been removed removes and replaced with the media_player.join and media_player.unjoin 服务.

If you use these 服务 in your 自动化 or 脚本, you need to adjust those.

(@pavoni - #49667)

The Shelly Wi-Fi RSSI 传感器 unit was wrong, it is dBm and not dB. If you rely on the unit of measurement from this 传感器, you might need to adjust to this change.

(@thecode - #49265)

The unpublished SimpliSafe cloud API no longer provides a functioning websocket. Therefore, the 集成 will no longer be able to receive SIMPLISAFE_EVENT or SIMPLISAFE_NOTIFICATION events, nor will it be possible for stage changes performed outside of Home Assistant (e.g., via the keypad) to be reflected in Home Assistant in near-realtime.

(@bachya - #49876) (simplisafe docs)

The SMA 集成 is now configured via the UI. Configuring the 集成 via YAML is now deprecated. Existing YAML 配置 is automatically imported on 升级 and can be safely removed after 升级.

Using custom 传感器 is deprecated and not possible using the UI. Feel free to submit additional 传感器 to be added as standard 传感器 to the pysma library.

The pv_power 传感器 is now reporting DC power of solar 面板 side A and named pv_power_a for new installations. grid_power is the total power supplied to the grid.

(@rklomp - #48003)

The following YAML 配置 options have been deprecated:

  • feeders
  • flaps
  • pets
  • scan_interval

If you have one of these options in your YAML 配置, you can safely remove those.

(@benleb - #49223)

FEON/BAFU changed their data which required removing some of the 属性.

The following 属性 are no longer available:

  • delta-24h
  • max-1h
  • min-1h
  • mean-1h
  • previous-24h

(@Bouni - #49119)

The unit of measurement from System Monitor timestamp 传感器 has been removed. It used to be set to empty string. If you have 自动化, 脚本 or external data recorder that rely on unit of measurement for these 传感器, you might need to adjust to this change.

(@MartinHjelmare - #48431)

Tasmota 灯光 no longer supports deprecated white_value, use rgbw_color instead.

(@emontnemery - #49599) (tasmota docs)

The Tasmota Wi-Fi RSSI 传感器 unit was wrong, it is dBm and not dB. If you rely on the unit of measurement from this 传感器, you might need to adjust to this change.

(@thecode - #49263) (tasmota docs)

The Waze Travel Time 集成 is now configured via the UI. Configuring the 集成 via YAML is now deprecated. Existing YAML 配置 is automatically imported on 升级 and can be safely removed after 升级.

(@raman325 - #43419)

If the default_interface is not set, the value is auto-detected based on the system routing next hop for the mDNS broadcast address (224.0.0.251).

If the next-hop cannot be detected or is a loopback address, zeroconf will broadcast on all interfaces. If the next hop is a non-loopback address, zeroconf will only broadcast on the default interface.

Setting the default_interface to true or false will override the auto detection.

(@bdraco - #49529)

Farewell to the following

The following 集成 are no longer available as of this 发布:

Both 集成 were in a broken 状态 and using webscaping methods to gather their data, which is not allowed for 核心 集成.

All changes