Vermont Energy Control Systems

Practical monitoring and control for the real world

Toggle Widget

Screenshot of a toggle widget screenshot of the code to create a toggle widget toggle widget in the menu bar

The toggle widget is an active widget intended to be used with discrete (on/off) elements. By default, it displays a red button if the element is true, and a grey button if the element is false. In addition to displaying status, it allows that value to be controlled.

There are three possible behaviors: Clear, Set, or Toggle. 'Clear' sets the Vesta element to false (or zero). 'Set' sets the element to true (or 1). 'Toggle' inverts the current value, changing true to false and vice versa.

If the element is changed by some other mechanism (such as a rule on the Vesta controller) the toggle widget will update to display the correct state.

Besides the normal five required parameters, the toggle widget has four additional parameters. The first is required - it specifies the desired behavior.

Parameter Value in Example Description If Not Present Default
Toggle Type2 Selects behaviors. 0=clear, 1=set, 2=toggle Required 2
Off Image [blank] Image to be displayed for 'Off' (false) condition Grey button ""
On Image [blank] Image to be displayed for 'On' (true) condition Red button ""
Label Text Toggle Label text to be displayed to left of widget No label Toggle