mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-08 09:56:30 +00:00
Add coordinator example for PARALLEL_UPDATES in IQS (#2482)
This commit is contained in:
parent
4e624caf11
commit
7daebad76c
@ -31,9 +31,23 @@ class MySensor(SensorEntity):
|
||||
|
||||
:::info
|
||||
When using a coordinator, you are already centralizing the data updates.
|
||||
This means that usually only the action calls will be relevant to consider for setting the number of parallel updates.
|
||||
This means you can set `PARALLEL_UPDATES = 0` for read-only platforms (`binary_sensor`, `sensor`, `device_tracker`, `event`)
|
||||
and only the action calls will be relevant to consider for setting an appropriate number of parallel updates.
|
||||
:::
|
||||
|
||||
`sensor.py`
|
||||
```python {1,2} showLineNumbers
|
||||
# Coordinator is used to centralize the data updates
|
||||
PARALLEL_UPDATES = 0
|
||||
|
||||
class MySensor(CoordinatorEntity, SensorEntity):
|
||||
"""Representation of a sensor."""
|
||||
|
||||
def __init__(self, device: Device) -> None:
|
||||
"""Initialize the sensor."""
|
||||
...
|
||||
```
|
||||
|
||||
## Additional resources
|
||||
|
||||
For more information about request parallelism, check the [documentation](/docs/integration_fetching_data#request-parallelism) for it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user