Update off and unavailable in standby state (#2728)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Shay Levy 2025-07-16 23:11:49 +03:00 committed by GitHub
parent 612d557084
commit 2c2ebba1d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View File

@ -73,7 +73,7 @@ To avoid calculations in a property method, set the corresponding [entity class
| ------------------------ | ------------------------------| ------- | ----------- | ------------------------ | ------------------------------| ------- | -----------
| assumed_state | `bool` | `False` | Return `True` if the state is based on our assumption instead of reading it from the device. | assumed_state | `bool` | `False` | Return `True` if the state is based on our assumption instead of reading it from the device.
| attribution | <code>str &#124; None</code> | `None` | The branding text required by the API provider. | attribution | <code>str &#124; None</code> | `None` | The branding text required by the API provider.
| available | `bool` | `True` | Indicate if Home Assistant is able to read the state and control the underlying device. | available | `bool` | `True` | Indicate if Home Assistant is able to read the state or control the underlying device, see [entity-unavailable](/docs/core/integration-quality-scale/rules/entity-unavailable.md) for more details.
| device_class | <code>str &#124; None</code> | `None` | Extra classification of what the device is. Each domain specifies their own. Device classes can come with extra requirements for unit of measurement and supported features. | device_class | <code>str &#124; None</code> | `None` | Extra classification of what the device is. Each domain specifies their own. Device classes can come with extra requirements for unit of measurement and supported features.
| entity_picture | <code>str &#124; None</code> | `None` | Url of a picture to show for the entity. | entity_picture | <code>str &#124; None</code> | `None` | Url of a picture to show for the entity.
| extra_state_attributes | <code>dict &#124; None</code> | `None` | Extra information to store in the state machine. It needs to be information that further explains the state, it should not be static information like firmware version. | extra_state_attributes | <code>dict &#124; None</code> | `None` | Extra information to store in the state machine. It needs to be information that further explains the state, it should not be static information like firmware version.

View File

@ -92,6 +92,12 @@ The state of a media player is defined by using values in the `MediaPlayerState`
| `PAUSED` | Entity has an active media and is currently paused | | `PAUSED` | Entity has an active media and is currently paused |
| `BUFFERING` | Entity is preparing to start playback of some media | | `BUFFERING` | Entity is preparing to start playback of some media |
:::note
It is common that media players can't be controlled when in a standby state. If Home Assistant can turn on the device using another protocol or method, it should be shown as `off` even if the main channel used to control the device is currently unavailable. If Home Assistant has no way to turn on the device, it should be shown as `unavailable`. See [entity-unavailable Exceptions](/docs/core/integration-quality-scale/rules/entity-unavailable.md#Exceptions) for more details.
:::
## Methods ## Methods
### Play media ### Play media

View File

@ -81,7 +81,13 @@ For more information about managing integration state, see the [documentation](/
## Exceptions ## Exceptions
There are no exceptions to this rule. If an integration can turn on a device, either via a user-defined automation trigger or by automatically creating a secondary control channel (e.g., using Wake-on-LAN or infrared blaster), then the device should be reported as `off` when it is in standby and unresponsive to the main channel (e.g., TCP). If no such method exists, and the device cannot be controlled in its current state, it should be reported as `unavailable`.
An example scenario, for a media player that enters standby mode and can only be turned on using an external device (e.g., an IR blaster):
- When first added to Home Assistant, and there's no active connection, the device will be shown as `unavailable`.
- If the user configures an automation (e.g., using an IR blaster) to turn it on, the device will be shown as `off` while in standby.
- Once turned on via the external method, and the main connection is established, the state will update to `on`.
## Related rules ## Related rules