From 7daebad76cf6c0a21691e8a383364e257f7cb00c Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 6 Dec 2024 22:39:31 +0100 Subject: [PATCH] Add coordinator example for PARALLEL_UPDATES in IQS (#2482) --- .../rules/parallel-updates.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/core/integration-quality-scale/rules/parallel-updates.md b/docs/core/integration-quality-scale/rules/parallel-updates.md index fb0c40ab..d089effd 100644 --- a/docs/core/integration-quality-scale/rules/parallel-updates.md +++ b/docs/core/integration-quality-scale/rules/parallel-updates.md @@ -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. \ No newline at end of file +There are no exceptions to this rule.