# OPC-UA device protocol - cyclic read vs. subscription

**URL:** <https://community.cumulocity.com/t/opc-ua-device-protocol-cyclic-read-vs-subscription/1443>\
**Category:** Forum\
**Tags:** device-connectivity, cumulocity\
**Created:** [May 10, 2022, 3:47pm UTC](https://community.cumulocity.com/t/opc-ua-device-protocol-cyclic-read-vs-subscription/1443 "2022-05-10T15:47:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kai\_Sieben](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/kai_sieben/32/5541_2.png) [@Kai\_Sieben](https://community.cumulocity.com/u/Kai_Sieben)\
**Post date:** [May 10, 2022, 3:47pm UTC](https://community.cumulocity.com/t/opc-ua-device-protocol-cyclic-read-vs-subscription/1443/1 "2022-05-10T15:47:10Z")

</div>

The OPC-UA device protocols allow to choose between 2 mechanisms for data reporting:

> **[Cumulocity documentation](https://cumulocity.com/docs/)**
>
> This documentation offers comprehensive information on the Cumulocity platform both from a user and from a developer perspective. It reflects the latest state of the Cumulocity platform and is continuously updated to align with recent software...

Cyclic read vs. subscription.

What are the pros & cons for each mechanism?  
When should subscription be used and when not?

From the first glance cyclic read works fine and is easier to setup.

Thanks for any advice!

Edit:  
Regarding the deadband percentage, please be aware of this answer as well:

> [@OPC-UA device protocol - cyclic read vs. subscription](https://community.cumulocity.com/t/opc-ua-device-protocol-cyclic-read-vs-subscription/1443/4):
>
> Hi there, I would like to add some information about this topic. I am not sure if it is a good way to reply to this topic. Any suggestions are welcome. First: a correction. As defined [here](https://reference.opcfoundation.org/v104/Core/docs/Part8/6.2/), the deadband in Percent is not a corresponding change of %-Value of the current value but rather depending on the EU-Range. e.g. EU-Range High = 100.0 EU-Range Low = 50.0 Deadband Percent = 10% --\> \*\*deadband value = 5.0\*\* // ( hi - low ) \* deadband / 100.0 Calculation is done based on the last tr…

---

<div class="post-metadata">

**Author:** ![Marco\_Stoffel](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/marco_stoffel/32/19453_2.png) [@Marco\_Stoffel](https://community.cumulocity.com/u/Marco_Stoffel)\
**Post date:** [May 11, 2022, 6:23am UTC](https://community.cumulocity.com/t/opc-ua-device-protocol-cyclic-read-vs-subscription/1443/2 "2022-05-11T06:23:44Z")

</div>

Hi Kai,

Cyclic Read is just polling the value every x seconds. This leads to a lot of data event when the value in the OPC-UA Server does not change.

As subscription can be configured to give only updates of the value if something changes. E.g. value, status or timestamp. Even more sophisticated is the deadband value where you can define over which threshold from the last value you would like to get a reading (e.g. 10% more).

I always prefere subscription over cyclic read.

Regards,

Marco

---

<div class="post-metadata">

**Author:** ![Alexander\_Pester](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/alexander_pester/32/5725_2.png) [@Alexander\_Pester](https://community.cumulocity.com/u/Alexander_Pester)\
**Post date:** [May 11, 2022, 7:02am UTC](https://community.cumulocity.com/t/opc-ua-device-protocol-cyclic-read-vs-subscription/1443/3 "2022-05-11T07:02:22Z")

</div>

Hi Kai,

Marco did already summarize it very well. I would like to add something. If your OPC UA Server supports subscription you should use subscription, that is the standard way to go. However, there are OPC UA Server out there which don’t support subscription. For that reason, cyclic read is available as workaround. The OPC UA gateway is frequently doing a read, nothing else…

Best regards,  
Alex

PS:  
Have a look at unified-automation (a good source about OPC UA) [High Performance OPC UA Server SDK: OPC UA Subscription Concept](https://documentation.unified-automation.com/uasdkhp/1.4.1/html/_l2_ua_subscription.html)

---

<div class="post-metadata">

**Author:** ![strasser.manfred](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/strasser.manfred/32/32198_2.png) [@strasser.manfred](https://community.cumulocity.com/u/strasser.manfred)\
**Post date:** [August 1, 2022, 6:41am UTC](https://community.cumulocity.com/t/opc-ua-device-protocol-cyclic-read-vs-subscription/1443/4 "2022-08-01T06:41:37Z")

</div>

Hi there,  
I would like to add some information about this topic.

I am not sure if it is a good way to reply to this topic. Any suggestions are welcome.

**First** : a correction.  
As defined [here](https://reference.opcfoundation.org/v104/Core/docs/Part8/6.2/), the deadband in Percent is not a corresponding change of %-Value of the current value but rather depending on the EU-Range.

```auto
e.g. 
EU-Range High = 100.0
EU-Range Low = 50.0

Deadband Percent = 10% --> **deadband value = 5.0** // ( hi - low ) * deadband / 100.0

Calculation is done based on the last transmitted value

Examples:
The information in the original post suggests that it would need to change from 
50.0 to 55.0 
or
90.0 to 99.0 (10% of last transmitted value)

**Correct**
50.0 to 55.0
or
90.0 to 95.0

```

**Second** :  
There is a problem in the Current UI of the device-management (as of UI: 1011.0.12)  
In the section of the device-protocol where one could configure the deadband of the protocol, it does not work (there exists a workaround for e.g. Postman)  
It is supposed to be solved in  
UI: 1011.0.15 upwards

–  
BR Manfred

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [October 30, 2022, 6:41am UTC](https://community.cumulocity.com/t/opc-ua-device-protocol-cyclic-read-vs-subscription/1443/5 "2022-10-30T06:41:54Z")

</div>

Closed on October 30, 2022, 6:41am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
