Skip to main content

· One min read

As of Home Assistant Core 2022.11, the IMPERIAL_SYSTEM is deprecated, replaced by US_CUSTOMARY_SYSTEM. The is_metric and name properties of a unit system are likewise deprecated and should not be used.

Custom integrations referencing this unit system or these properties will need to be adjusted to use instance checks instead.

Correct:

if hass.config.units is METRIC_SYSTEM:
pass

if hass.config.units is US_CUSTOMARY_SYSTEM:
pass

To avoid confusion with future unit systems, the constants CONF_UNIT_SYSTEM_IMPERIAL and CONF_UNIT_SYSTEM_METRIC are also deprecated and should no longer be referenced:

  • if they were used to compare against the name of a unit system, then this is no longer needed.
  • if they were used for another reason, then local constants should be created instead.

· One min read

As of Home Assistant Core 2022.11, options is available as a standard property of SelectEntityDescription. This might cause issues in custom integrations if a custom options property was previously implemented.

Please adjust the custom integration by either dropping or renaming the custom options property.

· One min read

Long term statistics now allows showing statistics in a different unit than it's stored in. For example, it's possible to show statistics stored as kWh as Wh, kWh or MWh.

The changes are implemented in a series of PRs:

The background is that we allow overriding the unit of several sensor device classes, and this override should also be reflected when viewing long term statistics.

This affects authors of code calling the following WS APIs:

  • recorder/adjust_sum_statistics - A new mandatory parameter adjustment_unit_of_measurement has been added, which defines the unit used by the adjustment parameter.
  • recorder/statistics_during_period - In case of statistics generated from sensor entities, the unit of returned statistics will be converted to the sensor's unit_of_measurement. This behavior can be controlled by passing the optional units parameter.

· One min read

As of Home Assistant Core 2022.10, the following utilities are deprecated:

  • homeassistant/util/distance
  • homeassistant/util/pressure
  • homeassistant/util/speed
  • homeassistant/util/temperature
  • homeassistant/util/volume

Please use the corresponding static classes from homeassistant/util/unit_conversion:

  • DistanceConverter
  • PressureConverter
  • SpeedConverter
  • TemperatureConverter
  • VolumeConverter

· One min read

Several new sensor device classes have been added:

  • distance, a distance measured in either of cm, ft, in, km, m, mi, mm, yd

  • speed, a speed measured in either of ft/s, in/d, in/h, km/h, kn, m/s, mm/d, mph

  • volume, a volume measured in either of fl. oz., ft³, gal, L, mL,

  • weight, a mass measured in either of g, kg, lb, mg, oz, µg

    Like pressure and temperatures sensors, users can freely choose the display unit from the UI for sensors using any of the new device classes.

Long term statistics

Long term statistics will store distance as m, speed as m/s, volume as and weight as g. For existing sensors which are modified to one of the new device classes, statistics will continue to be recorded in the sensor's state_unit but users will be given the option to have existing statistics converted to the normalized unit.

· One min read

For Home Assistant Core 2022.10 we have changed the async_track_unavailable bluetooth API to send the last BluetoothServiceInfoBleak to the callback instead of the address.

Below is a new example of the usage:

from homeassistant.components import bluetooth

def _unavailable_callback(info: bluetooth.BluetoothServiceInfoBleak) -> None:
_LOGGER.debug("%s is no longer seen", info.address)

cancel = bluetooth.async_track_unavailable(hass, _unavailable_callback, "44:44:33:11:23:42", connectable=True)

· One min read

As of Home Assistant Core 2022.10, the following media player constants are deprecated:

  • MEDIA_CLASS_ALBUM

  • MEDIA_CLASS_APP

  • MEDIA_CLASS_ARTIST

  • MEDIA_CLASS_CHANNEL

  • MEDIA_CLASS_COMPOSER

  • MEDIA_CLASS_CONTRIBUTING_ARTIST

  • MEDIA_CLASS_DIRECTORY

  • MEDIA_CLASS_EPISODE

  • MEDIA_CLASS_GAME

  • MEDIA_CLASS_GENRE

  • MEDIA_CLASS_IMAGE

  • MEDIA_CLASS_MOVIE

  • MEDIA_CLASS_MUSIC

  • MEDIA_CLASS_PLAYLIST

  • MEDIA_CLASS_PODCAST

  • MEDIA_CLASS_SEASON

  • MEDIA_CLASS_TRACK

  • MEDIA_CLASS_TV_SHOW

  • MEDIA_CLASS_URL

  • MEDIA_CLASS_VIDEO

  • MEDIA_TYPE_ALBUM

  • MEDIA_TYPE_APP

  • MEDIA_TYPE_APPS

  • MEDIA_TYPE_ARTIST

  • MEDIA_TYPE_CHANNEL

  • MEDIA_TYPE_CHANNELS

  • MEDIA_TYPE_COMPOSER

  • MEDIA_TYPE_CONTRIBUTING_ARTIST

  • MEDIA_TYPE_EPISODE

  • MEDIA_TYPE_GAME

  • MEDIA_TYPE_GENRE

  • MEDIA_TYPE_IMAGE

  • MEDIA_TYPE_MOVIE

  • MEDIA_TYPE_MUSIC

  • MEDIA_TYPE_PLAYLIST

  • MEDIA_TYPE_PODCAST

  • MEDIA_TYPE_SEASON

  • MEDIA_TYPE_TRACK

  • MEDIA_TYPE_TVSHOW

  • MEDIA_TYPE_URL

  • MEDIA_TYPE_VIDEO

  • REPEAT_MODE_ALL

  • REPEAT_MODE_OFF

  • REPEAT_MODE_ONE

  • REPEAT_MODES

Use the new MediaClass, MediaType, and RepeatMode enum instead.

The use of STATE_* constants to reflect media player state is also deprecated. Please use the new MediaPlayerState enum instead.

· One min read

The issue registry has been moved from homeassistant.components.repairs to homeassistant.helpers and is now loaded together with the other registries very early during bootstrapping, before setup of any integrations.

This allows creating issues during validation of the configuration.

· One min read

It's now possible to get a reference to the HomeAssistant instance by calling core.async_get_hass().

Although this means it's no longer strictly necessary to pass hass around, the recommendation is still to only use core.async_get_hass where it's very cumbersome or downright impossible to pass hass to the code which needs it. An example where this can be useful is voluptuous validators, which previously couldn't access hass because voluptuous has no way of passing user data to validators.

@callback
def async_get_hass() -> HomeAssistant:
"""Return the HomeAssistant instance.
Raises LookupError if no HomeAssistant instance is available.
This should be used where it's very cumbersome or downright impossible to pass
hass to the code which needs it.
"""