MQTT2NotifySend
1.0.0
? Ponte entre o MQTT e o Freedesktop.org Notificar notificações de comprimidos de compra (Ubuntu e outras distritos)?, Para enviar notificações ao seu desktop sobre o 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 (execute ./mqt2notifysend.sh --help para saber mais).title : Título de Notificação (Opcional)text : Corpo de notificação (necessário)level : Nível de urgência de notificação (Opcional; um de: low , normal , critical ; Padrão: normal )iconB64 : Imagem do ícone de notificação, codificado como string base64 (opcional)Certas configurações podem ser ajustadas usando as seguintes variáveis de ambiente:
RECONNECTION_DELAY : Hora de esperar entre tentativas de conexão, em segundos (Padrão: 5 )DEFAULT_TITLE : Título padrão para notificações enviadas sem título (Padrão: MQTT2NotifySend )DEFAULT_LEVEL : Notify-Send Nível de Notificar padrão para notificações enviadas sem nível (Padrão: normal )LOG_ENABLE : se true ou 1 , ative logs de script (padrão: false )ICON_BASE_PATH : onde o arquivo de ícone de notificação é baixado, para cada notificação. Este é um caminho absoluto/relativo do arquivo, usado como prefixo (padrão: /tmp/mqtt2notifysend-icon )ICON_DELETE_DELAY : segundos para esperar entre o ícone são decodificados e excluídos. Não pode ser zero, pois o comando notifysend pode atrasar um pouco e o ícone pode ser removido quando a notificação aparecer, não mostrando o ícone (padrão: 5 )Uso:
LOG_ENABLE=true RECONNECTION_DELAY=1 DEFAULT_TITLE= " Very important notification " DEFAULT_LEVEL=critical
bash mqtt2notifysend.sh -h localhost -t notifications