Add documentation for release notes method for update entity (#1257)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Joakim Sørensen 2022-03-30 09:10:46 +02:00 committed by GitHub
parent 338891c612
commit bba23d6547
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,6 +40,7 @@ Other properties that are common to all entities such as `device_class`, `entity
| 'UpdateEntityFeature.INSTALL' | The update can be installed from Home Assistant.
| 'UpdateEntityFeature.PROGRESS' | This integration is able to provide progress information. If omitted, Home Assistant will try to provide a progress status; although it is better if the progress can be extracted from the device or service API.
| 'UpdateEntityFeature.SPECIFIC_VERSION' | A specific version of an update can be installed using the `update.install` service.
| 'UpdateEntityFeature.RELEASE_NOTES' | The entity provides methods to fetch a complete changelog.
## Methods
@ -75,6 +76,27 @@ class MyUpdate(UpdateEntity):
"""
```
### Release notes
This method can be implemented so users can can get the full release notes in the more-info dialog of the Home Assistant Frontend before they install the update.
The returned string can contain markdown, and the frontend will format that correctly.
This method requires `UpdateEntityFeature.RELEASE_NOTES` to be set.
```python
class MyUpdate(UpdateEntity):
# Implement one of these methods.
def release_notes(self) -> str | None:
"""Return the release notes."""
return "Lorem ipsum"
async def async_release_notes(self) -> str | None:
"""Return the release notes."""
return "Lorem ipsum"
```
### Available device classes
Optionally specifies what type of entity it is.