loolpaso
(Stanislav)
October 17, 2021, 11:39am
1
I want to send three files with different names and extensions via MQTT topic.
All three files are formatted text.
If possible, as a JSON string, for example {“dev”: {“file1”: “CONTENT”, “file2”: “CONTENT”, “file3”: “CONTENT”}}
I am a beginner and do not know how it should look and if it is possible at all.
Any advice would be helpful.
koying
(Chris B)
October 17, 2021, 12:01pm
2
MQTT is definitely not meant for file transfer, generally.
Specifically, HA doesn’t have a way to read a file content that I know of.
Bottom-line: Think of another way to send your files (FTP? Samba? …)
Kdem
October 17, 2021, 12:42pm
3
Another alternative to investigate is Node-Red, a bit of learning up front, but very worthwhile IMHO. The file-in node can import text from a file, as a string, or msg per line, and it can be used in HA by an HA entity node, or sent via MQTT out node. The multiple files you refer to can be combined and manipulated in other nodes. For example I import text from a file on my RPi’s and display the contents as a sensor in HA. The size/contents of the files may be a limiting factor.
1 Like
loolpaso
(Stanislav)
October 18, 2021, 1:51am
5
@francisp , @koying
A receiver is an IoT device without file system capabilities.
Kdem:
Another alternative to investigate is Node-Red
The file-in node can import text from a file, as a string, or msg per line, and it can be used in HA by an HA entity node, or sent via MQTT out node.
Any tutorial for this?
Each file contains about 1250 characters.
koying
(Chris B)
October 18, 2021, 6:04am
6
3 files of 1k to IoT is not exactly file transfer as I call it.
What are those files? binary / text / json/…? How often would they be transferred?
loolpaso
(Stanislav)
October 18, 2021, 6:45am
7
@koying ,
They are text.
How often would they be transferred?
On demand. Not very often.
Kdem
October 18, 2021, 11:26am
8
You could start here: https://github.com/hassio-addons/addon-node-red
and here: https://nodered.org/docs/getting-started , and maybe here https://christian-schou.dk/how-to-get-started-with-node-red-and-home-assistant/
There is lots available on the internet, just be sure its very current. The file-in and mqtt nodes will be available when you are up and running. I believe on Linux you would be able to pull in 64K of text, so your small file size should be fine.