mqtt-shell
mqtt-shell copied to clipboard
Question: How to propperly pub base64 encoded file content...
Want To:
Send Base64 encoded FileContent to MQTT Topic...
Trying:
mqtt-shell -b homeassistant.mydomain.to:1883 -c mqtt-shell -ni -cmd "pub geilomat/nowplaying/screen64 \"$(cat /tmp/qix2.png|base64)\""
Get:
Successfully connected to mqtt broker.
panic: runtime error: index out of range [1] with length 0
goroutine 1 [running]:
github.com/rainu/mqtt-shell/internal/io.glob..func1({0x7fff38c44f30, 0x2844})
github.com/rainu/mqtt-shell/internal/io/interpreter.go:52 +0xad2
github.com/rainu/mqtt-shell/internal/io.(*processor).Process(0xc0001ae060, 0xc000153f10?)
github.com/rainu/mqtt-shell/internal/io/processor.go:43 +0x7d
main.main()
github.com/rainu/mqtt-shell/cmd/mqtt-shell/main.go:91 +0x4ce
Tried quiet some derivates of Quotation / Double- / Single-Quotes with or without masking...to no avail...
mqtt-shell -b homeassistant.mydomain.to:1883 -c mqtt-shell -ni -cmd 'pub geilomat/nowplaying/screen64 "'$(cat /home/un/Bilder/qix2.png|base64)'"'
Successfully connected to mqtt broker.
Unterminated double-quoted string
Any advice welcome...
Using:
~ >>> mqtt-shell -v
v2.3.0 - b9e05d2
~ >>> pamac info mqtt-shell
Name : mqtt-shell
Version : 2.3.0-1
Beschreibung : A interactive shell-like command line interface (CLI) for MQTT written in go.
URL : https://github.com/rainu/mqtt-shell
Lizenzen : MIT
Paketquelle : AUR
Installierte Größe : 7,8 MB
Gruppen : --
Hängt ab von : --
Optionale Abhängigkeiten : --
Abhängigkeiten zum Erstellen : git go>=1.14
Abhängigkeiten zum Überprüfen : --
Benötigt von : --
Optional für : --
Stellt bereit : --
Ersetzt : --
Konflikt mit : --
Packer : Unknown Packager
Betreiber : rainu
Zuerst übermittelt : Mo 02 Aug 2021 22:55:38 CEST
Zuletzt verändert : Mi 03 Mai 2023 16:31:45 CEST
Stimmen : 3
Veraltet : --
Erstelldatum : Mo 19 Feb 2024 16:38:52 CET
Installiert am : Mo 19 Feb 2024 16:39:05 CET
Installationsgrund : Ausdrücklich installiert
Validiert von : Nichts
Dateisicherungen : --
Try this:
echo pub geilomat/nowplaying/screen64 $(cat /tmp/qix2.png|base64|tr '\n' ' '|sed 's/ //g') | mqtt-shell -b homeassistant.mydomain.to:1883 -c mqtt-shell -ni
This will use all what echo produces as input for the mqtt shell ... therefore you should have less quoting issues. In my testcase i could not publish a huge image ... im not sure if this is an mqtt limitation.