Email Alarm if PLC loses power

i am trying to set up an email alarm i would like to be notified if my plc happens to lose power is there a way to do this and if so what is the best way to go about it.

@dleedy76

I believe a good option here is to use basic scripting to see if the PLC is responding to pings and then send an email out or change the value of a tag (which will trigger an alarm).

I’m basing this script off a similar question listed here:




This script has 2 sections.
Init section and another section that I created call PING.

Every 120 seconds, the eWON will check if it can ping the PLC and if it cannot then it will send an email.
You will need to replace the PLC IP with your own, and ensure you have an SMTP relay setup in the eWON for this to work.


TSET 2,120 // every 2 minutes
ONTIMER 2, "goto Ping"

PING (CUSTOM SECTION):
Ping:  
    PRINT "Initiating PING to PLC IP 10.0.120.122:80,10 at ";Time$  
    CLOSE 1  
    ONSTATUS "goto ProcessStatus" 
    OPEN "tcp:10.0.120.122:80,10" FOR BINARY OUTPUT AS 1  
    a% = GETSYS PRG,"ACTIONID" 
END  
   
ProcessStatus:  
    PRINT "Process starting ";Time$  
    b% = GETSYS PRG,"EVTINFO" 
    IF b%=a% THEN  
        SETSYS PRG,"ACTIONID",a%  
        c% = GETSYS PRG,"ACTIONSTAT" 
        IF c%=0 THEN  
            PRINT "PING 10.0.120.122:80 success" 
        ELSE  
            PRINT "PING FAILED, Sending out notification email ";Time$
            SENDMAIL "YourEmail@example.com", "", "Subject", "Message"
        ENDIF  
        CLOSE 1  
    ENDIF  
END

@dleedy76

One additional option that I can think of here would be to use the digital inputs on the eWON to monitor the power status of the PLC. The base connector on the Flexy has a few digitial inputs right on the terminal block.

What I am proposing is wire up a connection from your PLC to the Digital Input of the eWON that would always be on. Then in the eWON we can create a tag that would monitor the DI state, when the DI turns to a zero we would know the power has been lost and can trigger an action at that point.

Do you think something like this would fit your purposes?

@dleedy76

Were you able to resolve your issue?