towerofpower256 / davidmac.pro

My personal website
0 stars 1 forks source link

posts/2021-07-21-files-over-mqtt/ #22

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Receiving files, pictures, and videos over MQTT

IoT devices use MQTT for a lot of things, but why is it so difficult when they use MQTT to send files, pictures, and videos?

https://davidmac.pro/posts/2021-07-21-files-over-mqtt/

Siddhesh6655 commented 2 years ago

Can you provide a script from publisher end

Siddhesh6655 commented 2 years ago

I am subscribing a text file having a text, but when it published I am getting blank text file without a data available in that.

prabowonofieldi commented 2 years ago

hello sir, from source code u share that python, so from line broker

prabowonofieldi commented 2 years ago

it can we used that link, like mosquitto.org like that

towerofpower256 commented 2 years ago

hello sir, from source code u share that python, so from line broker it can we used that link, like mosquitto.org like that

@prabowonofieldi I was receiving photos sent by a wifi camera when motion was detected. Looking around the custom firmware that I'm using, it was running the below shell command to send the file over MQTT:

https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/firmware_mod/scripts/detectionOn.sh

/system/sdcard/bin/mosquitto_pub.bin -h "$HOST" -p "$PORT" -u "$USER" -P "$PASS" -t "$TOPIC"/motion/snapshot/image $MOSQUITTOOPTS $MOSQUITTOPUBOPTS -f "$snapshot_tempfile-s"

It a nutshell, it's using the Mosquitto command line tool mosquitto_pub to send a message, and the option -f telling it to use the content of the image file as the payload of the MQTT message.

Manual page on mosquitto_pub: https://mosquitto.org/man/mosquitto_pub-1.html

towerofpower256 commented 2 years ago

@prabowonofieldi or is your question around "what address can you use as the MQTT broker"?

I've got an MQTT broker that I have installed within my own personal network. You could use any sort of MQTT broker that's available to you.