MQTT2NotifySend
1.0.0
? Bridge entre MQTT et Freedesktop.org Notify-Send Desktop Notifications (Ubuntu & Other Distros) ?, Pour envoyer des notifications à votre bureau sur MQTT.
# Dependencies are: libnotify-bin, mosquitto-clients, jq, coreutils
sudo apt install libnotify-bin mosquitto-clients jq coreutils
# Download the script & set as executable (optional)
curl -O https://raw.githubusercontent.com/David-Lor/MQTT2NotifySend/master/mqtt2notifysend.sh
chmod u+x mqtt2notifysend.sh
# Run!
./mqtt2notifysend.sh -h localhost -t notifications
# Send a message to the broker from other terminal window
mosquitto_pub -h localhost -t notifications -m " { " title " : " Custom notification " , " text " : " Hello world " } "mosquitto_sub (exécuter ./mqt2notifysend.sh --help pour en savoir plus).title : Titre de notification (facultatif)text : corps de notification (requis)level : Notification Niveau d'urgence (facultatif; l'un des: low , normal , critical ; par défaut: normal )iconB64 : Image de l'icône de notification, encodée sous forme de chaîne Base64 (facultative)Certains paramètres peuvent être modifiés en utilisant les variables d'environnement suivantes:
RECONNECTION_DELAY : il est temps d'attendre entre les tentatives de connexion, en secondes (par défaut: 5 )DEFAULT_TITLE : Titre par défaut pour les notifications envoyées sans titre (par défaut: MQTT2NotifySend )DEFAULT_LEVEL : Niveau de notifage par défaut pour les notifications envoyées sans niveau (par défaut: normal )LOG_ENABLE : si true ou 1 , activez les journaux de script (par défaut: false )ICON_BASE_PATH : où le fichier d'icône de notification est téléchargé, pour chaque notification. Il s'agit d'un chemin absolu / relatif du fichier, utilisé comme préfixe (par défaut: /tmp/mqtt2notifysend-icon )ICON_DELETE_DELAY : les secondes d'attente entre l'icône sont décodées et supprimées. Ne peut pas être nul, car la commande notifysend peut retarder un peu et l'icône peut être supprimée lorsque la notification apparaît, sans montrer l'icône (par défaut: 5 )Usage:
LOG_ENABLE=true RECONNECTION_DELAY=1 DEFAULT_TITLE= " Very important notification " DEFAULT_LEVEL=critical
bash mqtt2notifysend.sh -h localhost -t notifications