Share My Creation Power monitor with SMS notification (free w/ source)

juacochero

Member
Licensed User
Hi everyone!
Here's the power monitor I built for my lab in B4A.
Its fairly simple: if the device gets unplugged (power goes off), it waits for a moment and sends an SMS notification to the specified number. If the power comes back, it also sends a new SMS notification.
We use it in an old phone which we leave plugged to the same electric line as our sample freezers and servers, so we get notified if the building looses electricity, something quite common here during the summer.
The code is not perfect or thoroughy commented, but I think its pretty straightforward.
I'm attaching the B4A project. There is also Spanish version also in the repo in GitHub.
Hope it is useful for someone else too!


EDIT: 23/02/2021 code was corrected thanks to @Xfood
 

Attachments

Last edited:

Xfood

Well-Known Member
Licensed User
congratulations, a nice utility,
when I disconnect the cell from the current it sends the message, as soon as I hang up the cell, it does not send the message energy back on?
 

juacochero

Member
Licensed User
congratulations, a nice utility,
when I disconnect the cell from the current it sends the message, as soon as I hang up the cell, it does not send the message energy back on?
thanks!
Yes it sends a message once the power returns, but it also waits some time before sending the SMS. This is in case the power comes back and goes out again.
But you can configure both timers from the app: how long it waits to send the message when the power goes out and how long it waits when the power comes back.
Cheers!
 

cklester

Active Member
Licensed User
How are you sending the SMS message? Does it require an external library or service/API? (I'm not at my computer right now to view the source...)
 

Xfood

Well-Known Member
Licensed User
I'm sorry if I disturb you, but if I restart my phone, even if the service starts it doesn't send any sms, I have to turn on the app and press the monitor. if i turn off the power it sends sms, if i reconnect the power it does not send sms, i also lowered the timeout to 0.1
 

juacochero

Member
Licensed User
I'm sorry if I disturb you, but if I restart my phone, even if the service starts it doesn't send any sms, I have to turn on the app and press the monitor. if i turn off the power it sends sms, if i reconnect the power it does not send sms, i also lowered the timeout to 0.1
Thank you @Xfood, there were timer issues. Try it now, I reuploaded it in this post and corrected the files in GitHub!
 
Top