A device can send notifications and receive commands directly to you.
To send an email see SMTP clients.
Receiving email can be done with postfix or E-MailRelay and custom scripts.
But email server is problematic to set up on a router because of many limitations: it needs for a static IP, ISP often blocks the SMTP port, spam and DDoS problems.
This is the most used option. The Telegram has an advanced Bots API with easy access via simple HTTP API with a long pooling.
The alexwbaule/telegramopenwrt is a TG bot based on the curl and supports many commands:
The XMPP (Jabber) is badly supported but used. You can install the Prosody XMPP server and use it as client too with a little Lua scripting.
The sendxmpp is a perl-script to send xmpp, similar to what sendmail does for email. To send and receive messages over HTTP API with wget or curl you may install REST API plugin on the XMPP server (mod_http_rest for Prosody). The XEP-0124 BOSH probably can be used.
UnifiedPush is an open specification and tools that lets the user choose how push notifications are delivered. Different apps supports it:
Example of a script to send a notification via the ntfy.sh into the example queue (you should create your own private queue):
NTFY_QUEUE="example" NEW_CLIENT_IP="192.168.1.42" MSG="Someone joined network A new client with IP $NEW_CLIENT_IP joined. Please check if it's not an intruder." wget -q -O - "ntfy.sh/$NTFY_QUEUE" \ --header "Priority: urgent" \ --header "Tags: ghost" \ --header "Click: http://192.168.1.1/" \ --header "Actions: http, Open Luci, https://192.168.1.1/cgi-bin/ntfy-action.cgi?block=$NEW_CLIENT_IP, clear=true" \ --header "Email: root@OpenWrt" \ --post-data="$MSG"
NOTE: the --header option was added to the uclient-fetch on Jul 2024 so if you wish to use extended properties you'll need to install the wget-ssl package.