Skip to main content

counter

Syntax

  identifier:
type: counter
interval: interval
  • identifier is the name of the identifier that will represent the counter value.
  • type: Must be set to the value counter. Indicates this is a counter generator.
  • interval: The time interval between each count increment.

Description

The counter generator is a self-contained data source that continuously increases a counter value by a fixed interval. Counters can be used to know how long the adapter script has been executing since it was last restarted, and can be used in variables to generate periodic data.

Counters can be used as a stable clock in device types that provde data intermittently.

Examples

generators:
runtime:
type: counter
interval: 1s
info

In the above example, runtime is the identifier that can be referenced by other parts of the adapter script.

This creates a counter that incrememnts once every second.