Skip to main content

Home Assistant is participating in Hacktoberfest 2023!

· 2 min read

📢 Exciting news for Hacktoberfest 2023 participants! We are participating! 🎉

It is not just our 10th anniversary, but also the 10th year of Hacktoberfest! Congratulations! 🎂

Hacktoberfest is a worldwide, month-long celebration of open source. An event open to everyone. Whether you’re a developer, student learning to code, documenter, or designer, you can help drive the growth of open source projects, like Home Assistant. All backgrounds and skill levels are encouraged to complete the Hacktoberfest challenge. And of course, we are happy to help you get your pull requests in.

Just like all other years, Home Assistant participates in Hacktoberfest. All of our repositories have joined, no matter if you want to make a change to the frontend, core, or even our documentation. The issue trackers on these repositories give a good overview of what is possible to contribute to.

But, I’m not a developer?!​

If you are not a developer, new to git, GitHub, or open source in general, documentation can be a great way to get started. A relatively easy way to contribute is by reviewing the documentation of integrations you use or are familiar with. Check if everything is still up to date and is free of spelling/grammar mistakes.

Every single documentation page on our website has a “Edit” button, at the buttom of the page. Using that button, you can change the text on that page and provide a suggestion for improvement.

On our Community forum, there is a good step-by-step guide on how this works: Editing the Documentation and Creating a Pull Request on GitHub.

So, what are you waiting for? Sign-up on the Hacktoberfest website and start hacking! If you have any questions, please, drop by our Discord chat server. We have dedicated developer channels and are happy to assist you.

Happy Hacktoberfest 🎉

New way of excluding state attributes from recording

· One min read

The way in which state attributes are excluded from recording has changed

The recorder platforms have been replaced with two new attributes which can be set in classes derived from Entity:

  • _entity_component_unrecorded_attributes: frozenset[str] - This should be set by base component entity classes, e.g. LightEntity
  • _unrecorded_attributes: frozenset[str] - This should be set by derived platform classes, e.g. HueLight to exclude additional, integration specific, attributes from recording.

More details can be found in the entity documentation.

Background for the change is in architecture discussion #964.

The websocket command entity/source has been modified

· One min read

The websocket command entity/source has been greatly simplified:

  • It's no longer possible to get information for a single entity
  • Only the domain of the entities is included in the response, custom_component, config_entry and source are no longer present.

New response example​

{
"light.entity_1": {
"domain": "template",
},
"switch.entity_2": {
"domain": "shelly",
},
}

Old response example​

{
"light.entity_1": {
"custom_component": false,
"domain": "template",
"source": "platform_config",
},
"switch.entity_2": {
"custom_component": false,
"config_entry": "<config_entry_id>",
"domain": "shelly",
"source": "config_entry",
},
}

The change was introduced in core PR#99439

Entity state formatting

· One min read

In the Home Assistant Core 2023.9 release, we introduced 3 new methods to the hass object to allow entity state formatting with localization support for custom cards:

  • hass.formatEntityState
  • hass.formatEntityAttributeValue
  • hass.formatEntityAttributeName

Example:

hass.formatEntityState(hass.states["cover.living_room_shutter"]); 
// It will return "Open" if the user language is English.
// It will return "Ouvert" if the user language is French.

For more details, refer to the entity state formatting documentation.

HomeAssistant.__init__ requires passing a string to it

· One min read

The signature of HomeAssistant.__init__ has been changed from no arguments to require the configuration directory as a string to be passed to it. Scripts, tests etc. outside of the HomeAssistant core repo which create HomeAssistant objects will need to be updated.

The change was introduced in core PR#98442

If backwards compatibility is important, this is a way to achieve it:

    try:
hass = HomeAssistant() # pylint: disable=no-value-for-parameter
except TypeError:
hass = HomeAssistant(config_dir) # pylint: disable=too-many-function-args

Weather entity forecast types

· One min read

WeatherEntity now allows a single weather entity to support different forecast types meaning it's no longer necessary to create multiple entities for the same location, as an example, an entity providing daily forecast and another entity providing hourly forecast.

Integrations providing weather entities should be updated to implement one or several of the new async methods async_forecast_daily, async_forecast_hourly and async_forecast_twice_daily.

For the upcoming Home Assistant Core 2024.3 release, integrations should remove the deprecated forecast property and also remove any duplicated weather entities which were added to provide multiple forecasts.

See weather developer documentation for details on how to implement the new forecast methods.

The "Weather Forecast Card" has been updated to provide the user with an option to select the preferred forecast to show, if the integration are using the new methods.

Avoid unnecessary callbacks with DataUpdateCoordinator

· One min read

The DataUpdateCoordinator can now reduce unnecessary updates when API data can be compared.

When using the DataUpdateCoordinator, the data being polled is often expected to stay mostly the same. For example, if you are polling a light that is only turned on once a week, that data may be the same nearly all the time. The default behavior is always calling back listeners when the data is updated, even if it does not change. If the data returned from the API can be compared for changes with the Python __eq__ method, set always_update=False when creating the DataUpdateCoordinator to avoid unnecessary callbacks and writes to the state machine.

The naming of MQTT entities changes to correspond with HA guidelines

· One min read

The way MQTT entities are named and how device configuration can be shared between discovered entities has changed

Sharing of device configuration​

Discovered MQTT entities can share device configuration, meaning one entity can include the full device configuration and other entities can link to that device by only setting mandatory fields. The mandatory fields were previously limited to at least one of connection and identifiers, but has now been extended to at least one of connection and identifiers as well as the name.

Naming of MQTT entities​

Naming of MQTT entities has been changed to be aligned with the entity naming guidelines:

  • The has_entity_name entity will be set to True on all MQTT entities
  • Unnamed binary_sensor, button, number and sensor entities will now be named by their device class instead of being named `MQTT binary sensor" etc.
  • It's now allowed to set an MQTT entity's name to None to mark it as the main feature of a device

Translating services

· One min read

We now support translating services in Home Assistant. Previously, the names & descriptions of services and their service fields have been hardcoded into the services.yaml files of each integration.

We have now added support for translating these names & descriptions using our translation system. This means that the names & descriptions of services and their service fields can now be translated into any language.

To achieve this, the name and description keys from each service and service field moves from the hardcoded services.yaml files to the translation files of each integration.

An updated example of a services.yaml service description can be found in our documentation. The backend localization has been extended to have an example of a translated service, matching the example from the service description.

The services translation is available as of Home Assistant 2023.8. We hope this will make Home Assistant more accessible to non-English users.