I need to monitor the state of a generator. When the generator turns on ( testing or power failure) there is a relay that goes high/low. I can read from either state. I need for the pi to send email when it comes on, once, and then a different email when it turns off. I have found code that is close, but not sure how to configure to work the way i need it to. I presume i will need 2 seperate .py files one for power on and one for power off... at least i presume i will. I have a similar setup that monitors a ups (APCUPSD) sends email. I may use this in conjunction with the relay monitor as to tell me there is actually a power outage, and that the generator comes on.
I am looking to install this setup at 4 different locations for monitoring backup generators. Would also like to work on other sensors such as battery voltage, temperature and oil pressure sensors ect.. but that can wait..lol
I have been using the code within this post, Raspberry Pi to email when power outage occurs
I have UPS for pi and internet router etc..
Any help would be greatly appreciated!