Add coordinator example for PARALLEL_UPDATES in IQS (#2482)

This commit is contained in:
epenet
2024-12-06 22:39:31 +01:00
committed by GitHub
parent 4e624caf11
commit 7daebad76c

View File

@@ -31,13 +31,27 @@ 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.
## Exceptions
There are no exceptions to this rule.
There are no exceptions to this rule.