I'm receiving the weather data from my weather station with a dongle on my raspberry pi, that has internet connection via wifi. Now I want to send this data to a rails api/app to save it there in a database. The rails app runs on another server, so I want to post the data via http.
How can I do this. I can't add the curl dependency to the rtl_433 project (https://github.com/merbanan/rtl_433) to send the data directly to my backend. Am I able to run the rtl_433 for example with a python script like: 
 rlt_433 -F json and take that output to send it to my backend or how can I realize that?
rtl_433 on raspberry pi: Send data to api via http post
1.6k Views Asked by st3ffb3 At
        	2
        	
        There are 2 best solutions below
4
                 On
                        
                            
                        
                        
                            On
                            
                                                    
                    
                You should be able to execute rtl_433 as a subprocess using the subprocess module. Normally you would just use subprocess.run, but since rtl_433 produces output until it is killed, you will need to use subprocess.Popen and parse the output.
Another option is to pipe the output of rtl_433 to your program and using input() or sys.stdin.readline() to read lines. Like rtl_433 -flags | python3 script.py.
I figured it now out, how to get the data from the subprocess and listen to it all the time:
I installed
python 3.8to use thedatetimelibrary correctly. This approach is supported withversion >= python 3.7I created a python script, taht is listening to the output of my
rtl_433command. As you can see I'm using:rtl_433 -f 868.300M -F json.here is my
listener.py:after that I can use:
python3.8 listener.pyand get all the data that is sent by the weather station