Skip to main content

S6-Overlay 3.x update on our docker base images

· 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.

Constant deprecations for 2022.5

· 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.

ServiceInfo model improvements and deprecations

· 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.

Text-to-speech say service to use media source IDs

· 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.

Saying goodbye to the time_changed event

· 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.

Calendar Data Model improvements and deprecations

· 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.

Local OAuth2 Updates

· 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.

Deprecating all SUPPORT_* constants

· 2 min read

As of Home Assistant Core 2022.5, all SUPPORT_* constants are deprecated, each entity platform is providing an EntityFeature enum to replace them.

This applies to, the following platforms:

  • Alarm Control Panel

    Deprecated supported feature constants:

    • SUPPORT_ALARM_ARM_AWAY
    • SUPPORT_ALARM_ARM_CUSTOM_BYPASS
    • SUPPORT_ALARM_ARM_HOME
    • SUPPORT_ALARM_ARM_NIGHT
    • SUPPORT_ALARM_ARM_VACATION
    • SUPPORT_ALARM_TRIGGER

    Use the new AlarmControlPanelEntityFeature enum instead.

  • Camera

    Deprecated supported feature constants:

    • SUPPORT_ON_OFF
    • SUPPORT_STREAM

    Use the new CameraEntityFeature enum instead.

  • Cover

    Deprecated supported feature constants:

    • SUPPORT_OPEN
    • SUPPORT_CLOSE
    • SUPPORT_SET_POSITION
    • SUPPORT_STOP
    • SUPPORT_OPEN_TILT
    • SUPPORT_CLOSE_TILT
    • SUPPORT_STOP_TILT
    • SUPPORT_SET_TILT_POSITION

    Use the new CoverEntityFeature enum instead.

  • Climate

    Deprecated supported feature constants:

    • SUPPORT_TARGET_TEMPERATURE
    • SUPPORT_TARGET_TEMPERATURE_RANGE
    • SUPPORT_TARGET_HUMIDITY
    • SUPPORT_FAN_MODE
    • SUPPORT_PRESET_MODE
    • SUPPORT_SWING_MODE
    • SUPPORT_AUX_HEAT

    Use the new ClimateEntityFeature enum instead.

  • Humidifier

    Deprecated supported feature constants:

    • SUPPORT_MODES

    Use the new HumidifierEntityFeature enum instead.

  • Fan

    Deprecated supported feature constants:

    • SUPPORT_SET_SPEED
    • SUPPORT_OSCILLATE
    • SUPPORT_DIRECTION
    • SUPPORT_PRESET_MODE

    Use the new FanEntityFeature enum instead.

  • Light

    Deprecated supported feature constants:

    • SUPPORT_EFFECT
    • SUPPORT_FLASH
    • SUPPORT_TRANSITION

    Use the new LightEntityFeature enum instead.

    Note that the following light constants were already deprecated, thus LightEntityFeature does not provide a replacement for those.

    • SUPPORT_BRIGHTNESS
    • SUPPORT_COLOR_TEMP
    • SUPPORT_COLOR
    • SUPPORT_WHITE_VALUE

    These cases should instead be migrated to the new color modes.

  • Lock

    Deprecated supported feature constants:

    • SUPPORT_OPEN

    Use the new LockEntityFeature enum instead.

  • Media Player

    Deprecated supported feature constants:

    • SUPPORT_PAUSE
    • SUPPORT_SEEK
    • SUPPORT_VOLUME_SET
    • SUPPORT_VOLUME_MUTE
    • SUPPORT_PREVIOUS_TRACK
    • SUPPORT_NEXT_TRACK
    • SUPPORT_TURN_ON
    • SUPPORT_TURN_OFF
    • SUPPORT_PLAY_MEDIA
    • SUPPORT_VOLUME_STEP
    • SUPPORT_SELECT_SOURCE
    • SUPPORT_STOP
    • SUPPORT_CLEAR_PLAYLIST
    • SUPPORT_PLAY
    • SUPPORT_SHUFFLE_SET
    • SUPPORT_SELECT_SOUND_MODE
    • SUPPORT_BROWSE_MEDIA
    • SUPPORT_REPEAT_SET
    • SUPPORT_GROUPING

    Use the new MediaPlayerEntityFeature enum instead.

  • Remote

    Deprecated supported feature constants:

    • SUPPORT_LEARN_COMMAND
    • SUPPORT_DELETE_COMMAND
    • SUPPORT_ACTIVITY

    Use the new RemoteEntityFeature enum instead.

  • Siren

    Deprecated supported feature constants:

    • SUPPORT_DURATION
    • SUPPORT_TONES
    • SUPPORT_TURN_OFF
    • SUPPORT_TURN_ON
    • SUPPORT_VOLUME_SET

    Use the new SirenEntityFeature enum instead.

  • Vacuum

    Deprecated supported feature constants:

    • SUPPORT_TURN_ON
    • SUPPORT_TURN_OFF
    • SUPPORT_PAUSE
    • SUPPORT_STOP
    • SUPPORT_RETURN_HOME
    • SUPPORT_FAN_SPEED
    • SUPPORT_BATTERY
    • SUPPORT_STATUS
    • SUPPORT_SEND_COMMAND
    • SUPPORT_LOCATE
    • SUPPORT_CLEAN_SPOT
    • SUPPORT_MAP
    • SUPPORT_STATE
    • SUPPORT_START

    Use the new VacuumEntityFeature enum instead.

  • Water Heater

    Deprecated supported feature constants:

    • SUPPORT_TARGET_TEMPERATURE
    • SUPPORT_OPERATION_MODE
    • SUPPORT_AWAY_MODE

    Use the new WaterHeaterEntityFeature enum instead.

New features for developers in 2022.4

· 2 min read

There are a handful of new features for developers in 2022.4.

  • Integration Type: Integrations can now mark themselves as helper.
  • Backup platform: Integrations can now pause work during a backup by implementing the new backup platform.
  • hidden_by in entity registry: Entities can now be hidden via the entity registry. These entities should default to not be included when exposing entities to an external UI like voice assistants.
  • New and updated selectors: We added a bunch of new selectors to be used in blueprints, services.yaml, and config flows.
  • Selectors in backend flows: You can now use the selector helper in your config flows. It is configured and renders just like selectors in services.yaml/blueprints.
  • ha-form context: Context is a new way to allow selectors to be dynamically configured based on values from other fields. Currently only available for the attribute selector.
  • config flow helper text for fields: Config flow fields can now have a description.
  • Schema Config Flow helper: New helper to create config flows based on a config schema. Example implementation
  • Show Menu step: This new step in a data entry flow shows a menu to the user.
  • Fan speed: We introduced a new format and this transition is now completed.
  • Device State Attributes: Backwards compatibility support for this property has been removed after being deprecated since Home Assistant 2021.4. Use extra_state_attributes instead.
  • Cameras without width/height: The compatbility layer for cameras without width/height has been removed.
  • Calendar offset: Calendar method signatures for calculate_offset and is_offset_reached have changed, in preparation for typing improvements in Calendar, and potential simplification of offsets more generally.

Introducing the update entity

· 2 min read

Home Assistant 2022.4 will provide a brand new entity platform: the update entity.

The update entity can be provided by integrations to indicate there is an update available, for a device or service, towards the Home Assistant user. It allows you to provide additional information about the update, such as the latest version available, a summary of the release notes and a link to the full release announcement online.

Additionally, the install method can be implemented, so the user can install the update directly from within Home Assistant.

Adding the update platform to your integration is relatively simple to do, as it is just a couple of properties and, if available for the integration, a single install method. Most other details are handled by Home Assistant automatically.

In Home Assistant Core 2021.12 we moved updates provided by the Supervisor to the Configuration panel, using this new platform, we will be able to extend that in the near future by the information provided by these brand new entities.

See our developer documentation for how to implement this in an integration.

If your integration previously provided a binary_sensor or button entity with the update device class, please consider replacing those with the update entity.