Switches

A switch is an object that has two (or more) stable states. Each time the user presses the switch on the panel, its status changes accordingly, and a corresponding message is sent to the Controller in order to notify the change.

It is also possible to trigger a switch status change from the Controller, by sending to Panel App a specific message
through the WiFi module.

1. Object definition


To define a switch on the panel, two different syntaxes can be used, depending on the type of switch chosen:

  • the first syntax permits to define a switch with a fixed, already defined, graphic (chosen among those available, at end of this page).
  • the second syntax has been developed to permit to choose the image which should appear for each state of the switch (the images must be selected among those available, see the image gallery). Moreover, it is possible to have more than two states (up to 10 states).

Syntax n. 1

To define a switch on the panel, the syntax is:

W ID [type] [stylers] [events] : status ;

The fields between brackets [ ] are optional.

The following table describes in details the meaning of each field.


Field Lenght Description Value
W
1 char
 Field that defines the object switch W
ID 1 char Unique ID to identify each switch on the panel.
This field can be a decimal digit or an upper-case character.
The max number of switches that can be created on the panel is 20.
(0,9)-(A,J)
[type] variable
One or more upper-case characters that identify the graphical look of the switch. See the collection at the bottom of this page. see below
[stylers] variable One or more stylers that define the graphical appearance of the switch (such as, size, position, opacity, border, background, ...). Some stylers may not take effect because meaningless for this object.
see stylers
[events] variable
One or more event specifiers
see events
status
1 char Define the initial state of the switch (on/off).
Some switch types could have up to 10 states
(0,1) or (0,9)

 

Example (syntax n. 1)

Example n.1

Target:

Panel with a switch type n.0; initial status: OFF

Syntax:

WA0:0;

   

 

Syntax n. 2

To define a switch that permits to specify the images to be used for each switch state, the syntax is:

W ID type
[stylers] [events] : status : image_0 , image_1 , .... , image_N;


Where the fields above have the same meaning described for syntax n.1, with exception that:

  • Field type = M (multi-image)
  • The number N of states are equal to the number of images specified on the fields "image_xx" .

Example

Switch having 4 states (with images n. 1.1, 1.2, 1.3 1.4 respectively):  W1M:0:1.1,1.2,1.3,1.4;


2. Object usage


The follow explanation is valid for all switch types (defined using either syntax n.1 or syntax n.2).

Change the status of the SWITCH (Panel <---> WiFi Module <--> Controller)

Usually the status of a switch is changed from the µPanel APP, when the user click on it; in this case the APP will send the notification to WiFi module. But is also possible for the Controller to change the status of the switch on the panel, by sending to the APP a message with the same following syntax: 

Syntax

#
W
ID status

Examples

  • Turn-ON the switch with ID=1: #W11
  • Turn-OFF the switch with ID=1: #W10

Note:

Some switch types could have more than two states.

 

Events (Panel ---> WiFi Module ---> Controller)

Read events section to  learn how to enable and manage the events for this object.

 

 

3. Switch types

 


 

Type
Status
0







0 1

Type
Status
1





0 1

Type
Status
2



0 1

Type
Status
3







0 1

 

Type
Status
4



0 1

Type
Status
5





0 1

Type
Status
6



0 1

Type
Status
7







0 1

 

Type
Status
8



0 1

Type
Status
9





0 1

Type
Status
A



0 1

Type
Status
B







0 1

 

Type
Status
C



0 1

Type
Status
D





0 1

Type
Status
E



0 1

Type
Status
F







0 1

 

Type
Status
G



0 1

Type
Status
H



0 1

Type
Status
I



0 1

Type
Status
L



0
1

 

Type
Status

N




0 1

Type
Status
O



0 1

Type
Status





Type
Status