Skip to main content

New alarm control panel state property and state enum

· One min read

As of Home Assistant Core 2024.11, we have introduced the alarm_state property in the AlarmControlPanelEntity. This newly added property should be used instead of directly setting the state property.

The new alarm_state property should return its state using the new AlarmControlPanelState enum instead of as previously, setting the state using the STATE_ALARM_* constants.

There is a one-year deprecation period, and the constants will stop working from 2025.11 to ensure all custom integration authors have time to adjust.

Example


from homeassistant.components.alarm_control_panel import AlarmControlPanelEntity, AlarmControlPanelState

class MyAlarm(AlarmControlPanelEntity):
"""My alarm."""

@property
def alarm_state(self) -> AlarmControlPanelState | None:
"""Return the state of the alarm."""
if self.device.is_on():
return AlarmControlPanelState.ARMED_AWAY
return AlarmControlPanelState.DISARMED

More details can be found in the alarm control panel documentation.

New helpers and best practises for reauth and reconfigure flows

· 2 min read

New helper methods have been added to the ConfigFlow to facilitate management of reauth and reconfigure flows:

  • self._get_reauth_entry() and self._get_reconfigure_entry() give access at any time to the corresponding config entry
    • these should be used over self.hass.config_entries.async_get_entry(self.context["entry_id"])
    • the config entry should be requested when needed (local variable, once per step) and not cached as class attributes
    • if the steps are shared with discovery or user flows, self.source should be checked against SOURCE_REAUTH and SOURCE_RECONFIGURE before accessing the entry
  • self._abort_if_unique_id_mismatch allows you to abort if the unique_id does not match the unique_id of the config entry to reauthenticate or reconfigure
    • this should be used after a call to self.async_set_unique_id
    • if the steps are shared with discovery or user flows, self.source should be checked against SOURCE_REAUTH and SOURCE_RECONFIGURE
    • other sources should continue to use self._abort_if_unique_id_configured
  • self.async_update_reload_and_abort has been adjusted to update the default message for reconfigure flows
    • the new message reconfigure_successful must be present in strings.json
  • self.async_update_reload_and_abort has a new argument data_updates to merge the data updates with the pre-existing data
    • this is preferred over the data argument, as it reduces the risk of data loss if the schema is updated

More details can be found in the reconfigure and reauthentication documentation.

Extend deprecation period of hass.helpers

· One min read

On March 30, 2024, we announced the deprecation of the hass.helpers attribute for the Home Assistant 2024.11 release. Due to the large number of custom integrations that still use them and the recent HACS v2 update, we have decided to extend the deprecation period for another six months.

This means that starting with Home Assistant 2025.5, hass.helpers will be removed.

We encourage all developers of custom integrations to update their code to avoid any issues prior to the Home Assistant 2025.5 release.

Deprecating state constants for cover

· One min read

As of Home Assistant Core 2024.11, the constants used to return state in CoverEntity are deprecated and replaced by the CoverState enum.

There is a one-year deprecation period, and the constants will stop working from 2025.11 to ensure all custom integration authors have time to adjust.

As the state property is not meant to be overwritten, in most cases this change will only affect other Entity properties or tests rather than the state property.

More details can be found in the cover documentation.

Changes to the UnitOfConductivity enum

· One min read

The UnitOfConductivity enum has been changed from:

  class UnitOfConductivity(StrEnum):
"""Conductivity units."""

SIEMENS = "S/cm"
MICROSIEMENS = "µS/cm"
MILLISIEMENS = "mS/cm"

To:

  class UnitOfConductivity(StrEnum):
"""Conductivity units."""

SIEMENS_PER_CM = "S/cm"
MICROSIEMENS_PER_CM = "µS/cm"
MILLISIEMENS_PER_CM = "mS/cm"

The old enum members can be used during a deprecation period of one year, to give time for custom integrations to migrate to the new enum members.

See core PR #127919 for implementation details.

Introducing the Assist satellite entity

· One min read

Users typically interact with Assist using remote voice satellites, such as the ESP32-S3-BOX-3 running ESPHome, analog phones running VoIP, and more. The integrations managing these satellites have used ad-hoc binary_sensor and select entities to allow users to configure the satellite's pipeline, automate based on the pipeline state, etc.

The new AssistSatelliteEntity provides an entity which represents a voice satellite. Its state follows the underlying Assist pipeline, allowing for easy automation. Additionally:

  • A new announce action is available for making announcements on supported devices.
  • Several websocket commands are also available, providing a uniform way to get and set the active on-device wake words.

The esphome and voip integrations have been transitioned to use AssistSatelliteEntity, and the wyoming integration will be next.

Version compare for Update platform can now be overwritten

· One min read

With the merge of core PR #124797, which will land in Home Assistant Core 2024.10, there is a new method in the update platform: version_is_newer().

Before this change, the compare logic between firmware installed version, new available version and beta version was hardcoded:

def version_is_newer(self, latest_version: str, installed_version: str) -> bool:
"""Return True if latest_version is newer than installed_version."""
return AwesomeVersion(latest_version) > installed_version

Now the new method allows developers to customize this comparison, writing their own method. Here's an example (implemented for Shelly gen1 devices):

def version_is_newer(self, latest_version: str, installed_version: str) -> bool:
"""Return True if available version is newer then installed version."""
return AwesomeVersion(
latest_version,
find_first_match=True,
ensure_strategy=[AwesomeVersionStrategy.SEMVER],
) > AwesomeVersion(
installed_version,
find_first_match=True,
ensure_strategy=[AwesomeVersionStrategy.SEMVER],
)

Additional validation in Climate set temperature

· One min read

As of Home Assistant Core 2024.10, we have added further validation of the parameters passed to the set_temperature method. This means that integrations don't need to implement this validation in their own methods.

Before 2024.10 it was possible to set the temperature parameter in the action when the entity did not set ClimateEntityFeature.TARGET_TEMPERATURE or target_temp_low/target_temp_high parameters when the entity did not set ClimateEntityFeature.TARGET_TEMPERATURE_RANGE. This will no longer be possible and a ServiceValidationError will be raised informing the user that they used an incorrect parameter in the action call.

Also, when setting a temperature range, it was possible to set target_temp_low to a higher value than target_temp_high. This will raise a ServiceValidationError informing the user the high value needs to be higher than the low value.

Enforce SourceType and add shorthand attributes and EntityDescription to device_tracker

· One min read

The source_type property of device_tracker entities is now always expected to be a SourceType enum value. Standard strings are no longer valid.

TrackerEntity and ScannerEntity now have a dedicated ScannerEntityDescription and TrackerEntityDescription, which need to be used as base class when associating an EntityDescription to the Entity.

The source_type for these entities now also defaults to SourceType.GPS and SourceType.ROUTER, and it may be possible to drop the overriding property.

The following shorthand attributes have also been added:

  • BaseTrackerEntity._attr_source_type
  • TrackerEntity._attr_latitude
  • TrackerEntity._attr_location_accuracy
  • TrackerEntity._attr_location_name
  • TrackerEntity._attr_longitude
  • TrackerEntity._attr_source_type (defaults to SourceType.GPS)
  • ScannerEntity._attr_hostname
  • ScannerEntity._attr_ip_address
  • ScannerEntity._attr_mac_address
  • ScannerEntity._attr_source_type (defaults to SourceType.ROUTER)

More details can be found in the device-tracker documentation.

Deprecating constants for Media Player

· One min read

As of Home Assistant Core 2022.5, the feature flag constants used in MediaPlayerEntity were deprecated and replaced by the MediaPlayerEntityFeature enum. Later, in 2022.10, the repeat mode, media type, and media class constants were deprecated and replaced by RepeatMode, MediaType, and MediaClass, respectively.

However, no proper deprecation was done, so now in 2024.10 we start the one-year deprecation period, and the constants will stop working from 2025.10, to ensure all custom integration authors have time to adjust.