LOGGING data on SD card

This example shows how to save periodically data on SD card and sending the file via email.

Configuration

To send and receive emails the SMM server must be active and reachable through a WiFi or PLMN connection.

Users

In user list, add the users enabled to send email request:

NAME:       Batman
TYPE:       EMAIL
IDENTIFIER: batman@gotham.com
GROUP:
START:      01/01/2000 00:00
STOP:       31/12/2099 23:59
WEEKDAYS:   YYYYYYY
TICKETS:    UNLIMITED
NAME:       Superman
TYPE:       EMAIL
IDENTIFIER: clark@super.man
GROUP:
START:      01/01/2000 00:00
STOP:       31/12/2099 23:59
WEEKDAYS:   YYYYYYY
TICKETS:    UNLIMITED

Rules

Rule 001 is triggered every 10 minutes.
No conditions are set.
Append a line with Date,Time and value of analog input 1 (A12) to S:LOGS/myLog.txt.

To ignore a time digit use the wildcard *.
Here the time matches when minutes are 0 ignoring all other digits.
It means every hour at 00 10 20 30 40 50.

SaveAi1OnFile
↯ Scheduled at TIME [hh:mm]   **:*0
✛
✛
✛
✛
✛
> AT#AFILE=S:LOGS/myLog.txt,T,"$D14;$D15;Ain1 value $A12"
>
>
>
>

Rule 002 is triggered at any incoming email from users.
Condition: the email subject contains the word "status".
Avior replies sending an email with attached the LOG file.

A GET request to "webadmin.mobi"
is made to send email with attachment.
D13 is the device WebID
D07 is the device password
S08 is the last email sender address
EmailSubject is the text used for the email subject
S:LOGS/myLog.txt is the file to attach

SendFileEmail
↯ Email from user
✛ SMM - Last Email Subject  status
✛
✛
✛
✛
> AT#HTTP=POST,webadmin.mobi/ava/$D13/$D07/$S08/EmailSubject,S:LOGS/myLog.txt
>
>
>
>

Rule 003 is triggered at any incoming email from users.
Condition: the email subject contains the word "delete".
The LOG file is deleted, a confirmation email sent back to user.

DeleteFileEmail
↯ Email from user
✛ SMM - Last Email Subject  delete
✛
✛
✛
✛
> AT#DFILE=S:LOGS/myLog.txt
> at#email=$S08,"File deleted"
>
>
>