Hi Norbert,
I also have an
RTL-SDR Blog V4 R828D RTL2832U 1PPM TCXO SMA Software Defined Radio (Dongle Only). It is a USB radio receiver with an antenna. It can be plugged into a USB port and receive all kinds of radio signals with the proper software. In this case the software is rtl_433. rtl_433 gets the radio signal from the RTL-SDR receiver and with its built in protocols (there's one for my weather station) can save or pass on the data. In this case I choose to have the data passed on via a streaming socket. One of my Raspberry Pis (with VA Smalltalk running on them) will have the RTL-SDR receiver connected to it and rtl_433 passing the data on via the streaming socket.
My other computers, mostly Raspberry Pis but also my Windows VA Smalltalk development machine, can get the weather data from the Raspberry Pi running rtl_433 and its streaming socket. That is the code I'm working on now. There are two rtl_433 socket endpoints that make sense for me to use: /events - that streams chunks and /stream that just streams. The frequency of the data transmitting (not the 433 MHz but how often new values are transmitted) varies, I think based upon changing weather conditions like wind speed changes. The data seems to be small JSON objects starting with "{" and ending with "}" and separated by CrLf. I think there can also be just CrLfs, used as a heartbeat or keep alive signal.
I'm trying to decide between two approaches. 1) After getting the data into a ReadStream, use #nextLine to get each JSON object and give it to STONReader to turn into a dictionary. I would skip empty lines as I think the STONReader doesn't like them. 2) Try to feed multiple whole and/or partial chunks into the STONReader, catch and ignore the errors, in the hope that new data will show up soon. A variation on this would be to catch the error of a partial chunk and wait for the rest of it, but that makes #1 look easier.
I'm open to any and all suggestions.
I have a lookup table with the weather data that when new JSON objects come in, I will run their keys and values and add or replace the values in the weather data lookup table. I can then get the most up to date values from the lookup table.
What am I doing all this for? My clock program displays some weather data but it gets it from the internet, this will be from my backyard. My other program has a motion sensor that turns on some blinky lights to scare off the dear. But in times of high wind, the sensor turns the blinky lights on because of the movement of a near by tree and not any dear. So, knowing it is windy, I can reduce the number of times the blinky lights are turned on. The weather station also detects if it is raining. If it is, the program that runs the lawn sprinklers, won't water the lawn.
Lou