Calefactores de terraza en enchufes de 433 MHz: encendido al atardecer desde una regla a través de una Pi
Traducido del English por IA ·
La terraza de nuestro hotel tiene cuatro calefactores de exterior con enchufes remotos baratos de 433 MHz. El personal se olvida de encenderlos por la noche y de apagarlos de madrugada. Ya tengo una Raspberry Pi que se encarga de la temperatura de la terraza para Hermetry.Leí sobre el truco de usar la Pi como transmisor FM/RF con solo un cable en GPIO4 y me entusiasmé, pero luego me confundí. ¿Cómo funciona eso exactamente? ¿Un pin GPIO puede transmitir radio de verdad? ¿Podría usarlo para enviar los códigos de los enchufes? Y me gustaría que Hermetry lo hiciera automáticamente: encendido al atardecer y apagado a las 23:00. ¿Eso es una regla o un flow?
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?
Traducido del English por IA ·
El truco de GPIO4 usa el generador de reloj de la Pi: puede emitir una onda cuadrada de decenas de MHz, y el software varía la frecuencia para generar FM. Una onda cuadrada está llena de armónicos, así que también estás transmitiendo en frecuencias que no tienes derecho a usar. Vale para una demo de laboratorio, pero no lo pondría en la terraza de un hotel.
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.
Traducido del English por IA ·
Para los enchufes, un módulo transmisor FS1000A de 433 MHz de 2 dólares y el paquete de Python rpi-rf. Primero capture los códigos del mando con el receptor correspondiente (rpi-rf_receive) y después reprodúzcalos.
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.
Traducido del English por IA ·
vale, pedí el par emisor + receptor. La parte de la Pi ya está clara, pero ¿cómo lo activo desde Hermetry al atardecer?
ok I ordered the transmitter + receiver pair. So the Pi part is clear, but how do I trigger it from Hermetry at sunset?
Traducido del English por IA ·
Tarjeta de reglas. Así gestiono los horarios de ventilación del laboratorio.Primero asigna al perfil de la Pi un comando, p. ej. heaters.set con un parámetro Sí/No on, nivel Basic. En la 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)
(Tus códigos y la duración del pulso provienen del sniff, los míos son marcadores de posición.)Luego, en la tarjeta de Reglas del asset de la terraza:
- Regla «Heaters on»: When Sunrise or sunset, Sunset, offset -15. Then Send a command
heaters.seton = yes to the Pi. - Regla «Heaters off»: When A time of day 23:00, every day. Then the same with on = no.
El atardecer necesita la ubicación del lugar, así que pon la latitud/longitud en el asset de la terraza y coloca la Pi debajo de él; de lo contrario, la regla no se guardará. Además, 433 MHz no tiene retroalimentación, así que envía el comando dos veces con un minuto de diferencia si quieres asegurarte. Documentación: Time, sunrise/sunset, dates and holidays.
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.
Traducido del English por IA ·
¡Lleva funcionando una semana! El mensaje «El amanecer y el atardecer necesitan la ubicación de este lugar» fue exactamente el que me salió; añadí las coordenadas y se guardó. También añadí una segunda regla de apagado a las 23:05, porque un enchufe pierde el código de vez en cuando. El personal no notó nada, salvo que las estufas simplemente están encendidas cuando deben estarlo.
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.
- Debes estar registrado para responder a este debate.
Únete a la conversación
Inicia sesión para preguntar y responder, dar me gusta a las publicaciones útiles y marcar la respuesta que resolvió tu problema. Cada aportación suma puntos y niveles.

