EXAMPLE 1

Upon receipt of a chat message from an active user containing the text S1, exactly and only S1 activate output 1.


CHE CHAT FROM USER 

$S16=S1 LAST CHAT MESSAGE = S1 





out1=1





trigger event is the receipt of a chat message from an active user.

The first condition to check is that the text of the message received is equal (exactly) to S1.

The first action contains the command that activates output 1.

EXAMPLE 2

Upon receipt of a chat message from an active user containing the text R1, turn off output 1.


CHE CHAT FROM USER 

$S16(R1 LAST CHAT MESSAGE ( R1 





out1=0





trigger event is the receipt of a chat message from an active user.

The first condition to check is that the chat message received contains (also) the text R1.

The first action contains the command that turns output 1 off.

EXAMPLE 3

Upon receiving a chat message from an unknown user, the device appends a line containing the date, time, and sender's phone number to a file in the LOGS folder of the S: unit, and informs all subscribers of this unit that an unauthorized command has been received, specifying the sender's phone number.


CHU CHAT FROM UNKNOWN 

 





AT#AFILE=S:LOGS/log.txt,T,"$D14 $D15 : $S14"

AT#HTTP=POST,https://contriveiot.eu/t?w=$D13&v=$VH1&type=alert&name=TEST.POD,”Bad request from: $D14"




trigger event is the receipt of a chat message from an unknown sender.

The first action Executes the command to append a new line to the log.txt located in the LOGS folder of the S: unit:
TAG $D14 is the current date
TAG $D15 is the current time
TAG $S14 phone number of the last chat sender
The file contents will look like this:
210308 121014 : +391234565
210328 162044 : +441234567

The second action sends an HTTP request to the Telegram service to return the text "Bad request from:" followed by the sender phone number ($S14) to all users subscribed to receive messages from this unit.
Assuming (varH=$D13§$D07) variable H contains the hash of the WebID combined with the password which is used to validate the request.