Automating Monthly Reports with eWON Devices

Protonest IoT
3 min readMar 29, 2024

--

In the world of IIoT, eWON gadgets are a big help. They make it easy to keep track of important information every month, helping businesses work better and make smarter choices. This article talks about how using eWON devices can be used to generate monthly reports.

Step 1: SMTP Server Configuration

Before any email can be sent from your eWON device, you need to ensure that the SMTP settings are correctly configured.

  • SMTP Server: Use a reliable SMTP server. The eWON devices, for example, can use “relay.talk2m.com” as the SMTP server with port 25.
  • Internet Connection: Run the Internet Wizard on your eWON device to ensure it has internet access. This step is crucial for email functionality as it relies on an active internet connection to send reports.

Step 2: Implementing Email Script

Note: Before calling the tags here, you need to add the tags. For that you can follow,

https://www.youtube.com/watch?v=H2HJ95NI1RU

Implement the script provided below by opening the basic IDE tab,

Init:
CLS
TSET 1,900
ONTIMER 1, "GOTO LogData"
TSET 2,86400
ONTIMER 2, "GOTO CheckDate"
GlobalData$ = ""
END

LogData:
CurrentTime$ = TIME$
DataPoint$ = "<tr><td>" + CurrentTime$ + "</td><td>" + STR$(RunTime@) + "</td><td>" + STR$(TotalPowerProduced@) + "</td></tr>"
GlobalData$ = GlobalData$ + DataPoint$

END

CheckDate:
A$ = TIME$
A% = DAY A$
PRINT A%
IF A% = 1 THEN
PRINT "Today is 1st"
Goto SendData
ENDIF
END

SendData:
$EmailTo$ = "kumarasenau@gmail.com"
$EmailCC$ = ""
$EmailSubject$ = "Monthly Operational Data Report"


$EmailBody$ = "<html><body><h2>Monthly Operational Data Report</h2><table border='1'><tr><th>Time</th><th>Run Time (hours)</th><th>Total Power Produced (kW)</th></tr>"

$EmailBody$ = $EmailBody$ + GlobalData$

$EmailBody$ = $EmailBody$ + "</table></body></html>"


Sendmail $EmailTo$, $EmailCC$, $EmailSubject$, $EmailBody$

PRINT "Monthly report emailed to: "; $EmailTo$
GlobalData$ = ""
EN
  • Logging Data: It logs operational data every 15 minutes. This frequency can be adjusted as needed by changing the “TSET 1,900” line, where “900” represents the logging interval in seconds.
  • Compiling Data: It accumulates logged data into a global string variable, “GlobalData”, formatting each data point as a row in an HTML table for easy viewing in the email.
  • Monthly Email: It checks the date every 24 hours (‘TSET 2,86400’) and triggers the “SendData” subroutine if it’s the first day of the month, compiling “GlobalData$” into an HTML email and sending it to the specified email address.

Step 3: Debugging and Event Logging

Use the eWON device’s event log for debugging and monitoring the script’s execution. The event log can provide valuable insights into the script’s operation, such as confirming successful email transmissions or highlighting errors in data logging.

After successful implementation, you will get the email as below,

Implementing automated monthly reports on an eWON device streamlines the process of monitoring operational data.

By following the steps outlined in this article, you can set up your eWON device to automatically log key data points, compile them into an easily readable format, and ensure they’re delivered to your inbox at the start of each month.

Contact us for any consultations or projects related to IoT and IIoT.

Protonest for more details.

Protonest specializes in transforming IoT ideas into reality. We offer prototyping services from concept to completion. Our commitment ensures that your visionary IoT concepts become tangible, innovative, and advanced prototypes.

Our Website: https://www.protonest.co/

Email: udara@protonest.co

If you enjoyed this article and would like to show some support, consider buying me a coffee on Ko-Fi.

Your support not only helps me keep creating content like this but also fuels me! ☕️📚

Thank you for being an amazing reader!

Here’s my Ko-Fi link: https://ko-fi.com/udarakumarasena

Cheers!

--

--

Protonest IoT
Protonest IoT

Written by Protonest IoT

We make your IoT ideas a reality

No responses yet