|
||
Freezer/Refrigerator ExampleIn many applications, it is useful to be emailed if a certain condition occurs - for example if the temperature of a refrigerator or freezer is getting too high. This example shows how to configure the device to send an alert e-mail when a specific analog pin driven by an analog temperature sensor reaches a certain value. This example also shows you how to edit the contents of the e-mail that is sent by the EZ Web Lynx. For this example, we will trigger an alarm if Input 1 goes above 3 Volts. When the alarm triggers we will send an e-mail. Initial setup: Create a new .htm file in your project called config.htm. This will include all the initial setup required for our application. Once uploaded to the EZ Web Lynx, simply view config.htm once with a web browser and it will be configured. Since the configuration is stored to non-volatile memory, config.htm only needs to be run once. Alternately, you could also configure these settings using the serial port or the UDP command port. Add the following contents to your config.htm: <html> <head> <title>ezWeblynx e-mail alarm setup</title> </head> <body> <!--(EXEC ID=My Device Name)--> <!--(EXEC NVSTRING0=Refrigerator)--> <!--(EXEC EMAIL_HOST=smtp.myisp.com)--> <!--(EXEC EMAIL_PORT=25)--> <!--(EXEC EMAIL_USER=username)--> <!--(EXEC EMAIL_PASS=password)--> <!--(EXEC EMAIL_TO=dest@myisp.com)--> <!--(EXEC EMAIL_FROM=ez@myisp.com)--> <!--(EXEC EMAIL_SUBJECT=ezWeblynx E-mail alert!)--> <!--(EXEC TRIGGER_SAFETY=1)--> <!--(EXEC TRIGGER_DELAY=300)--> <!--(EXEC TRIGGER_INSPECT1=ANALOG,1,1,3.0)--> <!--(EXEC TRIGGER_ACTION1=EMAIL)--> <h1>ezWeblynx configured for e-mail alerts!</h1> </body> </html> Here is an explanation of the commands used:
Now create a new text file called email.txt and add it to your project. When an e-mail is sent by the EZ Web Lynx, it uses the contents of email.txt for the body of the e-mail. Add the following contents to your email.txt: Alarm Condition! Device ID: <!--(READ ID)--> <!--(READ NVSTRING0)--> is greater than 3.0V (current reading is <!--(READ PIN_ANALOG1)-->) Here is an explanation of the commands used:
With this project uploaded the EZ Web Lynx, it will send the alert e-mail whenever the input voltage in Input 1 goes above 3.0V. |
||