Skip to content

Shared Polling

kreso975 edited this page Nov 26, 2025 · 6 revisions

Shared Polling Explained

Shared Polling allows multiple accessories to reuse the same JSON data source instead of each device making its own HTTP request. This reduces network traffic and ensures all devices stay synchronized with the same data snapshot.

  • Without Shared Polling: Each accessory calls the URL individually → multiple requests per interval.
  • With Shared Polling: One request is made → results are distributed to all accessories in the same group. This is especially useful when:
  • You have many sensors or switches reading from the same JSON file.
  • Your device or API has strict rate limits.
  • You want consistent values across accessories (no timing drift).

📌 Requirements

To ensure Shared Polling works correctly, every accessory in the group must include these fields:

⚙️ Parameters
{
    "sharedPolling": true,
    "sharedPollingId": "nestedOutlet",
    "sharedPollingInterval": 5000, // Miliseconds - 5sec
    "urlStatus": "THIS MUST BE INSERTED FOR ALL IN SHARED POLL",
}

✅ Rules

  • sharedPolling → must be set to true for all devices in the group.
  • sharedPollingId → all devices must use the same group name (e.g., "nestedOutlet").
  • sharedPollingInterval → must be identical across all devices.
    • Value is in milliseconds (e.g., 5000 = 5 seconds).

🌐 Data Source Each accessory must define a JSON source:

  • "urlStatus": "http://IP/source.json" → used for switches, outlets, and most devices.
  • "sensorUrl": "http://IP/source.json" → used only for sensors. Without one of these fields, the accessory cannot receive updates from the shared poll.

Config Examples

Outlet with Shared Polling

{
    "deviceType": "Outlet",
    "deviceName": "Nested SW",
    "urlON": "http://IP/POWER?state=ON",
    "urlOFF": "http://IP/POWER?state=OFF",
    "sharedPolling": true,
    "sharedPollingId": "nestedOutlet",
    "urlStatus": "http://IP/test/nastedJson.json",
    "stateName": "switches.switch3",
    "onStatusValue": "ON",
    "offStatusValue": "OFF",
    "inUseStateName": "switches.inuse3",
    "inUseOnStatusValue": "true",
    "inUseOffStatusValue": "false",
    "sharedPollingInterval": 5000
}

Air Quality Sensor with Shared Polling

{
    "deviceType": "AirQualitySensor",
    "deviceName": "AirQuality",
    "sharedPolling": true,
    "sharedPollingId": "nestedOutlet",
    "urlStatus": "http://IP/test/nastedJson.json",
    "paramNameAirQuality": "AirQualitySensor.AirQuality",
    "paramNamePM2_5Density": "AirQualitySensor.PM2_5Density",
    "paramNamePM10Density": "AirQualitySensor.PM10Density",
    "paramNameOzoneDensity": "AirQualitySensor.OzoneDensity",
    "paramNameNitrogenDioxideDensity": "AirQualitySensor.NitrogenDioxideDensity",
    "paramNameSulphurDioxideDensity": "AirQualitySensor.SulphurDioxideDensity",
    "paramNameCarbonMonoxideLevel": "AirQualitySensor.CarbonMonoxideLevel",
    "paramNameVOCDensity": "AirQualitySensor.VOXDensity",
    "sharedPollingInterval": 5000
}

Key Points to Remember

  • All devices in a group must share the same urlStatus.
  • sharedPollingId links devices together.
  • Only one HTTP request is made per interval, regardless of how many devices are in the group.
  • Use dot notation (level1.level2.param) to map nested JSON values.
  • Individual updateInterval can still be set, but the group’s sharedPollingInterval controls the fetch timing.

Clone this wiki locally