developers.home-assistant/blog/2024-01-30-ha-state-icon-pr...

938 B

author authorURL title
Paul Bottein https://github.com/piitaya Properties changes for ha-state-icon

In Home Assistant 2024.2, integrations have a new way to provide icons. To support this new feature, ha-state-icon component properties have changed.

Read more about icon translations in our documentation.

If you are a custom card developer using this component, you must adjust the properties passed to the component to avoid displaying the wrong icons in your custom card.

Before 2024.2

<ha-state-icon .state=${stateObj}></ha-state-icon>

After 2024.2

<ha-state-icon .hass=${hass} .stateObj=${stateObj}></ha-state-icon>

Backward compatibility

If you want to support both old and new version on Home Assistant, you can pass all the properties.

<ha-state-icon
  .hass=${hass}
  .stateObj=${stateObj}
  .state=${stateObj}
></ha-state-icon>