diff --git a/blog/2024-01-19-icon-translations.md b/blog/2024-01-19-icon-translations.md index b8678c48..fc92f60c 100644 --- a/blog/2024-01-19-icon-translations.md +++ b/blog/2024-01-19-icon-translations.md @@ -34,4 +34,20 @@ Icon translations also support translating entity attribute states. [Read more about icon translations in our documentation](/docs/core/entity#icons). +## Service icons + This change is backward-compatible. The existing `icon` property of entities will continue to work as it did before. However, we recommend the use of the icon translation over the `icon` property. + +Additionally, services provided by integrations now also support icons and can be provided in the same icon translations file. These icons are used in the Home Assistant UI when displaying the service in places like the automation and script editors. The following example shows how to provide icons for the `light.turn_on` and `light.turn_off` services: + +```json +{ + "service": { + "turn_on": "mdi:lightbulb-on", + "turn_off": "mdi:lightbulb-off" + } +} +``` + +[Read more about service icons in our documentation](/docs/dev_101_services#icons). + diff --git a/docs/dev_101_services.md b/docs/dev_101_services.md index 9bf39fd5..b4861aae 100644 --- a/docs/dev_101_services.md +++ b/docs/dev_101_services.md @@ -169,6 +169,24 @@ This is a partial example of a field which is only shown if at least one selecte - light.ColorMode.HS ``` +## Icons + +Services can also have icons. These icons are used in the Home Assistant UI when displaying the service in places like the automation and script editors. + +The icon to use for each service can be defined in the `icons.json` translation file in the integration folder, under the `service` key. The key should be the service name, and the value should be the icon to use. + +The following example, shows how to provide icons for the `turn_on` and `turn_off` services of an integration: + +```json +{ + "service": { + "turn_on": "mdi:lightbulb-on", + "turn_off": "mdi:lightbulb-off" + } +} +``` + + ## Entity Services Sometimes you want to provide extra services to control your entities. For example, the Sonos integration provides services to group and ungroup devices. Entity services are special because there are many different ways a user can specify entities. It can use areas, a group or a list of entities.