Skip to main content

Add options to SelectEntityDescription

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

Long term statistics now tracks the source entity's unit

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

Deprecating unit conversion utilities

· 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

New sensor device classes

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

Bluetooth async_track_unavailable API changes for 2022.10

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

Deprecating media player constants

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

The issue registry has been moved to homeassistant.helpers

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

Globally available HomeAssistant object (hass)

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

AutomationActionType deprecation for 2022.9

· One min read

For Home Assistant Core 2022.9, we have deprecated AutomationActionType, AutomationTriggerInfo, and AutomationTriggerData from homeassistant/components/automation/__init__.py. They are being replaced by TriggerActionType, TriggerInfo, and TriggerData from homeassistant/helpers/trigger.py.

OldNew
AutomationActionTypeTriggerActionType
AutomationTriggerInfoTriggerInfo
AutomationTriggerDataTriggerData

Furthermore, we recommend updating the automation_info parameter name for the async_attach_trigger function to trigger_info.