Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-user:services:remote_control:im_email [2024/12/14 23:48] – [XMPP] stokitodocs:guide-user:services:remote_control:im_email [2024/12/17 16:07] (current) – grammar stokito
Line 1: Line 1:
-====== Remote control OpenWrt device with instant messengers (Telegram, XMPP) and EMail ======+====== Remote control OpenWrt device via instant messengers (Telegram, XMPP) and EMail ======
 A device can send notifications and receive commands directly to you. A device can send notifications and receive commands directly to you.
  
  
 ===== EMail ===== ===== EMail =====
-To send email see [[:docs:guide-user:services:email:smtp.client|SMTP clients]].+To send an email see [[:docs:guide-user:services:email:smtp.client|SMTP clients]].
 Receiving email can be done with ''postfix'' or [[docs:guide-user:services:email:emailrelay|E-MailRelay]] and custom scripts. Receiving email can be done with ''postfix'' or [[docs:guide-user:services:email:emailrelay|E-MailRelay]] and custom scripts.
-But email server is problematic to setup on a router because of many limitations: it needs for a static IP, ISP often blocks the SMTP port, spam and DDoS problems.+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.
  
  
 ===== Telegram ===== ===== Telegram =====
-This is the most used option. The Telegram has an advanced Bots API with easy access via simple HTTP API with a long pooling.+This is the most used option. The Telegram has an [[https://core.telegram.org/bots|advanced Bots API]] with easy access via simple HTTP API with a long pooling.
  
 The [[https://github.com/alexwbaule/telegramopenwrt|alexwbaule/telegramopenwrt]] is a TG bot based on the ''curl'' and supports many commands: The [[https://github.com/alexwbaule/telegramopenwrt|alexwbaule/telegramopenwrt]] is a TG bot based on the ''curl'' and supports many commands:
  
   * cam_movie: Record 25 seconds of a camIP and send it.   * cam_movie: Record 25 seconds of a camIP and send it.
-  * cam_mv: Move the camera arround.+  * cam_mv: Move the camera around.
   * cam_shot: Get a Pic from the camera.   * cam_shot: Get a Pic from the camera.
   * cam_vdo: Get a 25 seconds record from a camIP.   * cam_vdo: Get a 25 seconds record from a camIP.
-  * chromego_add: Include to a user in chromego, a word to be used in permissions (block url/youtube channel/etc). +  * chromego_add: Include to a user in chromego, a word to be used in permissions (block url/YouTube channel/etc). 
-  * chromego_del: Remove a word from a user in chromego to be used in permissions (block url/youtube channel/etc). +  * chromego_del: Remove a word from a user in chromego to be used in permissions (block url/YouTube channel/etc). 
-  * chromego_list: List all permissions in chromego (block url/youtube channel/etc).+  * chromego_list: List all permissions in chromego (block url/YouTube channel/etc).
   * fw_add: Block a hostname using a deny rule in firewall, if append time to command will block from 23:00 to 8:00   * fw_add: Block a hostname using a deny rule in firewall, if append time to command will block from 23:00 to 8:00
   * fw_delete: Remove a hostname from a deny firewall rule, if hostname is empty, will remove all rules created by this bot.   * fw_delete: Remove a hostname from a deny firewall rule, if hostname is empty, will remove all rules created by this bot.
Line 31: Line 31:
   * fw_unblock: Remove a hostname from a deny firewall rule, if hostname is empty, will remove all rules created by this bot.   * fw_unblock: Remove a hostname from a deny firewall rule, if hostname is empty, will remove all rules created by this bot.
   * get_ip: Get WAN IPAddress.   * get_ip: Get WAN IPAddress.
-  * get_mac: Get the Organization that onwer the MacAddr. +  * get_mac: Get the Organization that own the MacAddr. 
-  * get_ping: Ping address or host, return Up or Down.+  * get_ping: Ping an address or host, return Up or Down.
   * get_uptime: Return the uptime from this Device.   * get_uptime: Return the uptime from this Device.
   * hst_list: Get hosts in the dhcp Leases. If a hostname is present, search only for this hostname.   * hst_list: Get hosts in the dhcp Leases. If a hostname is present, search only for this hostname.
   * ignoredmac_add: Add a new macaddress to the allowlist and avoid being notified about it.   * ignoredmac_add: Add a new macaddress to the allowlist and avoid being notified about it.
   * ignoredmac_list: Shows the list of ignored mac addresses that will not be notified by the bot.   * ignoredmac_list: Shows the list of ignored mac addresses that will not be notified by the bot.
-  * interface_down: Shutdown interface by name. +  * interface_down: Shutdown an interface by name. 
-  * interface_restart: Restart interface by name.+  * interface_restart: Restart an interface by name.
   * interfaces_list: Get interfaces configuration.   * interfaces_list: Get interfaces configuration.
-  * interface_up: Start up interface by name.+  * interface_up: Start up an interface by name.
   * lights: Turn On or Off house Lights.   * lights: Turn On or Off house Lights.
   * msg_tv: Send Message to Samsung TV   * msg_tv: Send Message to Samsung TV
   * netstat: Prints netstat table in ESTABLISHED, CLOSED and TIME_WAIT State.   * netstat: Prints netstat table in ESTABLISHED, CLOSED and TIME_WAIT State.
   * opkg_install: Install a package from opkg.   * opkg_install: Install a package from opkg.
-  * opkg_update: Update list of packages avaliable.+  * opkg_update: Update list of packages available.
   * ping_udp: Create a UDP packet to puncture a hole through a NAT firewall of your ISP   * ping_udp: Create a UDP packet to puncture a hole through a NAT firewall of your ISP
   * proc_list: List all process in execution   * proc_list: List all process in execution
Line 61: Line 61:
   * wifi_list: List all wireless devices.   * wifi_list: List all wireless devices.
   * wifi_restart: Restart a wireless device radio.   * wifi_restart: Restart a wireless device radio.
-  * wll_list: Get a wifi clients list that is connected to this device    * Unordered List Item+  * wll_list: Get a Wi-Fi clients list that is connected to this device
  
  
Line 68: Line 68:
 The [[https://sendxmpp.hostname.sk/|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 ([[https://modules.prosody.im/mod_http_rest|mod_http_rest]] for Prosody). The [[https://xmpp.org/extensions/xep-0124.html|XEP-0124 BOSH]] probably can be used. The [[https://sendxmpp.hostname.sk/|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 ([[https://modules.prosody.im/mod_http_rest|mod_http_rest]] for Prosody). The [[https://xmpp.org/extensions/xep-0124.html|XEP-0124 BOSH]] probably can be used.
  
-  * [[https://github.com/stanson-ch/xmppcd|xmppcd]] Small XMPP client daemon +  * [[https://github.com/stanson-ch/xmppcd|xmppcd]] Small XMPP client daemon
   * [[https://www.reddit.com/r/openwrt/comments/11auq9n/send_a_xmpp_message_from_router/|Reddit: Send a xmpp message from router]]   * [[https://www.reddit.com/r/openwrt/comments/11auq9n/send_a_xmpp_message_from_router/|Reddit: Send a xmpp message from router]]
 +
 +
 +===== UnifiedPush =====
 +
 +[[https://unifiedpush.org/|UnifiedPush]] is an open specification and tools that lets the user choose how push notifications are delivered. Different apps supports it:
 +
 +  * [[https://docs.ntfy.sh/|ntfy.sh]] (pronounced "notify") is an HTTP-based publish-subscriber notification service. It allows you to send notifications to your phone or desktop via scripts from any computer, and/or using a REST API. It has apps for Android and iOS.
 +  * The same but I want to use Google for some reason: [[https://unifiedpush.org/users/distributors/fcm/|gCompat-UP Distrib (Android)]]
 +  * I have a Nextcloud server: [[https://unifiedpush.org/users/distributors/nextpush/|NextPush (Android)]]
 +  * I use Conversations XMPP client: [[https://unifiedpush.org/users/distributors/conversations/|Conversations (Android)]]
 +
 +==== Send push notification via ntfy.sh ====
 +Example of a script to send a notification via the [[https://docs.ntfy.sh/|ntfy.sh]] into the [[https://ntfy.sh/example|example]] queue (you should create your own private queue):
 +
 +<code bash>
 +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"
 +</code>
 +
 +**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.
 +
 +==== See also ====
 +
 +[[https://github.com/bitfireAT/webdav-push/|WebDAV Push]]
 +
  • Last modified: 2024/12/14 23:48
  • by stokito