Skip to main content

· One min read

Starting with Home Assistant 2022.7, the update coordinator supports keeping track of context for each listening entity. This can be used to limit the requests against APIs based on enabled entities.

This could be a breaking change for custom components that rely on update coordinators and inspect the internal variable self._listeners and/or overload the method async_remove_listener() to detect when there is no listeners anymore. Switch to using async_update_listeners() to trigger updates on all listeners, and overload _unschedule_refresh() to detect when there is no listeners.

See the updated integration fetching documentation for more information on current use.

· One min read

Before 2022.6, the entity_matches_only flag prevented the logbook from providing context data in exchange for performance improvement when querying specific entities. Selecting the context data for particular entities is no longer an intensive process with the new logbook design. No immediate action is required as the flag will be ignored, and removing the flag from any active code paths can be done at your leisure.

· 2 min read

We started to update our base images to use the new s6-Overlay v3. A migration article also explains the new possibilities around this change. This blog post explains the minimal changes needed to be able to use our new base images.

We have updated our example add-on to include the new behaviors.

Minimum

Add init: false to your addon's config.yaml if you don't have this already. In V3, S6 enforces that their init is used correctly. If Docker default system init is used you will see the following error when you start your addon:

s6-overlay-suexec: fatal: can only run as pid 1

Make sure all your executable/script files have the execution permission set on your git repository rootfs folder. You can update the permissions using:

$ git update-index --chmod=+x rootfs/etc/service.d/my-service/run

If you use finish scripts in your S6-overlay services, for example, to stop the container on an error, you have to replace the line s6-svscanctl -t /var/run/s6/services with /run/s6/basedir/bin/halt.

AppArmor

You have to tweak your AppArmor profile to get it working with the new s6-Overlay. We updated our documentation with the default profile. The following changes need to be made:

# S6-Overlay
/init ix,
/bin/** ix,
/usr/bin/** ix,
/run/{s6,s6-rc*,service}/** ix,
/package/** ix,
/command/** ix,
/etc/services.d/** rwix,
/etc/cont-init.d/** rwix,
/etc/cont-finish.d/** rwix,
/run/{,**} rwk,
/dev/tty rw,

host_pid option

Addons running without protection mode enabled can set host_pid: true in their configuration. As described in the documentation:

Allow to run container on host PID namespace. Works only for not protected add-ons.

This is a problem because S6 expects to be PID 1 (it's literally in the tagline) and that's impossible when using the host PID namespace.

In V2, S6 didn't actually check that it was running as PID 1. This is why it "worked" when in this mode in the past (although it required some workarounds to keep s6 from breaking systems when running this way). In V3 S6 checks that it is actually PID 1 and refuses to start otherwise.

To fix this, don't use s6 overlay in your addon as it's not designed for this use case. You can continue to use the addon base images by overriding /init with a no-op script and then use the normal docker init system. Or you can switch to a different base image like stock alpine or debian and add what you need.

· One min read

For Home Assistant Core 2022.5, we have deprecated many constants and replaced them with enums.

All SUPPORT_* constants have been deprecated, and are summerised in a previously published blog article.

Additionally, the following constants have been deprecated:

  • Alarm Control Panel

    Deprecated constants:

    • FORMAT_TEXT
    • FORMAT_NUMBER

    Use the new CodeFormat enum instead.

  • Camera

    Deprecated constants:

    • STREAM_TYPE_HLS
    • STREAM_TYPE_WEB_RTC

    Use the new StreamType enum instead.

  • Climate

    Deprecated constants:

    • CURRENT_HVAC_COOL
    • CURRENT_HVAC_DRY
    • CURRENT_HVAC_FAN
    • CURRENT_HVAC_HEAT
    • CURRENT_HVAC_IDLE
    • CURRENT_HVAC_OFF
    • HVAC_MODE_AUTO
    • HVAC_MODE_COOL
    • HVAC_MODE_DRY
    • HVAC_MODE_FAN_ONLY
    • HVAC_MODE_HEAT_COOL
    • HVAC_MODE_HEAT
    • HVAC_MODE_OFF

    Use the new HVACAction and HVACMode enums instead.

  • Light

    Deprecated constants:

    • COLOR_MODE_UNKNOWN
    • COLOR_MODE_ONOFF
    • COLOR_MODE_BRIGHTNESS
    • COLOR_MODE_COLOR_TEMP
    • COLOR_MODE_HS
    • COLOR_MODE_XY
    • COLOR_MODE_RGB
    • COLOR_MODE_RGBW
    • COLOR_MODE_RGBWW
    • COLOR_MODE_WHITE

    Use the new ColorMode enum instead.

· One min read

As of Home Assistant Core 2022.6, access to discovery information via the, previously deprecated, dictionary methods have been removed.

This applies to the DhcpServiceInfo, MqttServiceInfo, SsdpServiceInfo, UsbServiceInfo, and ZeroconfServiceInfo instances.

Custom integrations are required to migrate to use the new dataclass properties.

· One min read

Starting with Home Assistant 2022.5, the TTS say service will set the media content ID to be a media source URI. These need to be resolved inside the media player using the media source integration.

Previously the TTS integration would set the media content ID to a URL that pointed at Home Assistant and it required no extra work from the media players.

Media players need to support the media source integration as documented here.

· One min read

With Home Assistant Core 0.113, we began transiting to using the asyncio event loop for scheduling events.

With 2022.5, we are excited to announce that this process is now complete. The legacy time_changed event, also known as EVENT_TIME_CHANGED is no longer fired every second. Integrations that listen for all events no longer need to filter out EVENT_TIME_CHANGED. Integrations that run in a separate thread may see slight performance benefits since they will no longer be awakened every second.

With the previous implementation, consumers would subscribe to the time_changed event and check the time every time it fired to see if it was a match. This pattern led to many callbacks where most of the time, the callback would reject the event and continue receiving callbacks until the desired time was reached.

If your custom integration is still relying on listening for time_changed events, it will need to transition to using one of the built-in event helpers, which are, in most cases, a one-line drop-in replacement. For more information, please review the integration documentation on listening for events.

· One min read

As of Home Assistant Core 2022.5, CalendarDeviceEntity is deprecated and superseded by CalendarEntity. The new entity has a more well defined data model, and a streamlined websocket API. CalendarDeviceEntity will be removed in a future Home Assistant release and custom components are required to migrate to the new APIs. See the new Calendar Entity developer documentation for details.

· One min read

As of Home Assistant Core 2022.5, integrations that register a config_entry_oauth2_flow.LocalOAuth2Implementation must have a manifest dependency on the auth component.

This is motivated by a broader effort to improve OAuth Application Credentials handling, which required changing how the HTTP endpoint for the OAuth callback is registered.