Skip to content

Commit 7daebad

Browse files
authored
Add coordinator example for PARALLEL_UPDATES in IQS (#2482)
1 parent 4e624ca commit 7daebad

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

docs/core/integration-quality-scale/rules/parallel-updates.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,27 @@ class MySensor(SensorEntity):
3131

3232
:::info
3333
When using a coordinator, you are already centralizing the data updates.
34-
This means that usually only the action calls will be relevant to consider for setting the number of parallel updates.
34+
This means you can set `PARALLEL_UPDATES = 0` for read-only platforms (`binary_sensor`, `sensor`, `device_tracker`, `event`)
35+
and only the action calls will be relevant to consider for setting an appropriate number of parallel updates.
3536
:::
3637

38+
`sensor.py`
39+
```python {1,2} showLineNumbers
40+
# Coordinator is used to centralize the data updates
41+
PARALLEL_UPDATES = 0
42+
43+
class MySensor(CoordinatorEntity, SensorEntity):
44+
"""Representation of a sensor."""
45+
46+
def __init__(self, device: Device) -> None:
47+
"""Initialize the sensor."""
48+
...
49+
```
50+
3751
## Additional resources
3852

3953
For more information about request parallelism, check the [documentation](/docs/integration_fetching_data#request-parallelism) for it.
4054

4155
## Exceptions
4256

43-
There are no exceptions to this rule.
57+
There are no exceptions to this rule.

0 commit comments

Comments
 (0)