I’m using rtl_433
(a command line tool) on a Raspberry Pi to receive data from a home temperature sensor. I get it to output JSON in the Terminal using this command:
rtl_433 -F json
An example of the output in the Terminal is:
{"time" : "2023-04-12 17:55:57", "model" : "Inkbird-ITH20R", "id" : 9537, "battery" : 90, "sensor_num" : 3, "mic" : "CRC", "temperature_C" : 17.700, "temperature_2_C" : 130.000, "humidity" : 130.000}
I need to POST that JSON to my server so I can process it. For debugging of my server app, it’s running on a different computer on port 5124 on the same network (123.123.123.123
is an obfuscated IP):
rtl_433 -F json | curl -H "Content-Type: application/json" -X POST -d @- 123.123.123.123:5124
Nothing is ever received by my server.
However if I do a quick test to make sure my server is receiving with this:
echo "{}" | curl -H "Content-Type: application/json" -X POST -d @- 123.123.123.123:5124
It works.
I think I must be piping the output from rtl_433
wrong but I’m not sure where.
2
Answers
Try like a subcommand. Idk where your output from rtl_433 will be used, but adjust:
Not sure how exactly
rtl_433
is supposed to function, but-w -
writes its output toSTDOUT
, so this works for me:(
netcat
listening on port 8888 –netcat -l -p 8888
)