Add blog post for ha-state-icon properties changes (#2064)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Paul Bottein 2024-01-30 15:43:00 +01:00 committed by GitHub
parent 9a7890b5f9
commit e0fd1027c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,35 @@
---
author: Paul Bottein
authorURL: https://github.com/piitaya
title: "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](/docs/core/entity#icons).
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
```html
<ha-state-icon .state="${stateObj}"></ha-state-icon>
```
### After 2024.2
```html
<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.
```html
<ha-state-icon
.hass="${hass}"
.stateObj="${stateObj}"
.state="${stateObj}"
></ha-state-icon>
```