Patio heaters on 433 MHz sockets: switching them at sunset from a rule through a Pi
Our hotel terrace has four patio heaters on cheap 433 MHz remote sockets. Staff forget to switch them on in the evening and forget to switch them off at night. I have a Raspberry Pi already doing the terrace temperature for Hermetry.
I read about the “Pi as an FM/RF transmitter with just a wire on GPIO4” hack and got excited, then confused. How does that even work, can a GPIO pin really transmit radio? Could I use that to send the socket codes? And then I’d like Hermetry to do it automatically: on at sunset, off at 23:00. Is that a rule or a flow?
The GPIO4 trick uses the Pi’s clock generator: it can put out a square wave at tens of MHz, and the software wiggles the frequency to make FM. A square wave is full of harmonics, so you’re also transmitting on frequencies you have no right to use. Fine for a lab demo, I wouldn’t put it on a hotel terrace.
For the sockets, a 2 dollar FS1000A 433 MHz transmitter module plus the rpi-rf Python package. Sniff the remote’s codes with the matching receiver first (rpi-rf_receive), then replay them.
ok I ordered the transmitter + receiver pair. So the Pi part is clear, but how do I trigger it from Hermetry at sunset?
Rules card. I run lab ventilation schedules this way.
First give the Pi’s profile a command, e.g. heaters.set with a Yes/no param on, Basic tier. On the Pi:
from rpi_rf import RFDevice
tx = RFDevice(17); tx.enable_tx()
CODES = {True: [5592405, 5592407, 5592411, 5592413],
False: [5592404, 5592406, 5592410, 5592412]}
def on_rpc(req_id, body):
if body.get("method") == "heaters.set":
for code in CODES[bool(body["params"]["on"])]:
tx.tx_code(code, 1, 350) # protocol 1, pulse length from the sniff
client.publish(f"v1/rpc/res/{req_id}", '{"ok": true}', qos=1)
(Your codes and pulse length come from the sniff, mine are placeholders.)
Then on the terrace asset’s Rules card:
- Rule “Heaters on”: When Sunrise or sunset, Sunset, offset -15. Then Send a command
heaters.seton = yes to the Pi. - Rule “Heaters off”: When A time of day 23:00, every day. Then the same with on = no.
Sunset needs the place’s location, so put latitude/longitude on the terrace asset and place the Pi under it, otherwise the rule won’t save. Also, 433 MHz has no feedback, so send the command twice a minute apart if you want to be sure. Doc: Time, sunrise/sunset, dates and holidays.
Running for a week now! “Sunrise and sunset need this place’s location” was exactly the message I got, added the coordinates and it saved. I also added a second off rule at 23:05 because one socket misses the code now and then. Staff noticed nothing except the heaters are just on when they should be.
- You must be logged in to reply to this topic.
Join the conversation
Sign in to ask and answer, like helpful posts and mark the reply that solved your problem. Every contribution earns points and levels.

