Smooth

Overview

A smooth can be configured on a Value so that changes are only published after being stable for a defined duration.

Warning

Errors on a smoothed Value are also smoothed.

@startuml
skinparam backgroundColor transparent
robust "Smooth value" as smooth
robust "External value" as value

@0
value is 0
smooth is 0

@1
value is 10
value -> smooth : Trigger

@smooth
@1 <-> @2 : 1s

@2
smooth is 10

@3
value is 15
value -> smooth : Trigger

@smooth
@3 <-> @4 : 1s

@3.5
value is 20
value -> smooth : Trigger

@smooth
@3.5 <-> @4.5 : 1s

@4.5
smooth is 20

@enduml

  • The External value is the source of the smooth.

  • The Smooth value is the resulting value as published by OnSphere.

  • The blue arrow indicates that the value is read by OnSphere.

  • The red arrow indicates the duration of the smooth. If it overlaps with another, it indicates the timer was reset by the change.

Example

This can be used for example to open a door only if a button is kept pressed for 5 seconds.