This playbook sets up your laptop to monitor if it's on AC power or not. Alerts can be sent a variety of ways.
If you answer yes to the following questions then it might be what you need:
- Do you use a laptop in your homelab?
- Does it have a battery?
- Do you experience brownouts || blackouts?
Under the hood it checks the value of /sys/class/power_supply/AC/online
:

If the value changes then an alert will be sent to the user.


WhatsApp notifications using CallMeBot (free + no sign up) source
- Add the phone number +34 644 95 73 56 into your Phone Contacts. (Name it it as you wish)
- Send this message "I allow callmebot to send me messages" to the new Contact created (using WhatsApp of course)
- Wait until you receive the message "API Activated for your phone number. Your APIKEY is 123123" from the bot.
- Edit the
inventory
file with your phone number and API Key that you got from step 3 - Run the playbook against your laptop host