Did you ever stop to think about all those radio waves flying around us all the time? Of course you didn’t. That’s why you have me!
Went to Lowes the other day and they had these cool weather stations. I know you don’t think about such things, but I do. How does that display TALK to the sensor that you place outside?
I’ll tell you how. Radio. 433 MHz radio to be exact. This little sensor doodad sends out a transmission to the display every 20 or 30 seconds or so. And that information is totally sent in the clear. No encryption whatsoever.
So yeah, you’re thinking, “So what?” But I’m thinking that I can steal that data and harness it’s power for good and not evil. Lets look at the information it is sending, shall we?
Interesting. A couple times a minute it sends out three messages with essentially the same information. Temperature, humidity, battery condition, what channel it is transmitting on, the sensor ID number and the date and time.
I use a program called HomeAssistant which I would love to just capture that data into and have it display at least the temperature and humidity at my location.
We can do this by installing a program on a Raspberry Pi (or other Linux computer) called RTL_433 First install these dependencies:
sudo apt-get install git libtool libusb-1.0.0-dev librtlsdr-dev rtl-sdr build-essential autoconf cmake pkg-config mosquitto mosquitto-clients
I put the last two in red because the instructions DON’T INCLUDE THEM and ya kinda need them. Drove me crazy for a bit, it did.
Now follow these directions to install:
git clone https://github.com/merbanan/rtl_433.git
cd rtl_433/ mkdir build cd build cmake .. make sudo make install
Now the assumption here is that you have a mosquitto MQTT server running somewhere and an RTL-SDR device OPERATIONAL. If you don’t have a working knowledge of those items better dig in and come back later.
Now make sure your weather station is on and transmitting to the display. Now lets take that radio burst transmission and capture it and send it to our MQTT server. Run this command on your Raspberry Pi.
rtl_433 -F json -M utc | mosquitto_pub -t home/rtl_433 -l -h 192.168.20.6
This command runs the program RTL_433 then converts the data to JSON and publishes it to the MQTT server under the topic “home/rtl_433″ to the mosquitto server (on my network located at 192.168.20.6”.
The data then looks like this:
{"time" : "2019-01-15 03:07:44", "model" : "Acurite tower sensor", "id" : 12644, "sensor_id" : 12644, "channel" : "A", "temperature_C" : 0.900, "humidity" : 77, "battery_low" : 0}
Now we can take this data and import it (import may be a bad phrase) into Home Assistant to display. I made a new group in configuration.yaml called “Weather” and added two sensors by creating these entries:
sensor: - platform: mqtt state_topic: 'home/rtl_433' name: 'Outdoor Temp' unit_of_measurement: 'F' value_template: '{{ ((value_json.temperature_C * 1.8) + 32)|round(1) }}' - platform: mqtt state_topic: 'home/rtl_433' name: 'Outside Humidity' unit_of_measurement: '%' value_template: "{{ value_json.humidity }}"
And what that does is create these entries on my main page:
Wow!
So let’s summarize. I stole information flying about freely in the radio waves and diverted it to somewhere and performed a useful function with it.
Radio waves is COOL!
Hi John!
I’m aware this post is 5 years old – yet I have a project in mind that is super close to this and I could really use an expert opinion 🙂
What I want to do is the opposite of what you did here. I wand to use data in Home Assistant and sent it to the weather station display.
I want to do this, as my old sensor is broken, yet I love the display stand. So I want to feed it with temperature information from Home Assistant.
Do you think this would be possible?
Thank you so much in advance!