MQTT2NotifySend
1.0.0
MQTTとFreedEsktop.orgの間のブリッジNotify-Send Desktop通知(Ubuntuおよびその他のディストリビューション)?、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コマンド(run ./mqt2notifysend.sh --help詳細を知るために)で使用されています。title :通知タイトル(オプション)text :通知機関(必須)level :通知の緊急性レベル(オプション; 1つ: low 、 normal 、 critical 、デフォルト: normal )iconB64 :base64文字列としてエンコードされた通知アイコン画像(オプション)特定の設定は、次の環境変数を使用して微調整できます。
RECONNECTION_DELAY :接続試行の間、秒単位で待つ時間(デフォルト: 5 )DEFAULT_TITLE :タイトルなしで送信された通知のデフォルトタイトル(デフォルト: MQTT2NotifySend )DEFAULT_LEVEL :レベルなしで送信される通知のデフォルトNotify-SENDレベル(デフォルト: normal )LOG_ENABLE : trueまたは1場合、スクリプトログを有効にします(デフォルト: false )ICON_BASE_PATH :通知ごとに通知アイコンファイルがダウンロードされる場所。これは、プレフィックスとして使用されるファイルの絶対/相対パスです(デフォルト: /tmp/mqtt2notifysend-icon )ICON_DELETE_DELAY :アイコンの間に待機する秒がデコードされて削除されます。 notifysendコマンドが少し遅れ、アイコンが表示され、アイコンが表示されないときにアイコンが削除される可能性があるため、ゼロにすることはできません(デフォルト: 5 )使用法:
LOG_ENABLE=true RECONNECTION_DELAY=1 DEFAULT_TITLE= " Very important notification " DEFAULT_LEVEL=critical
bash mqtt2notifysend.sh -h localhost -t notifications