Traduit de English par IA ·
Carte Règles. J’exécute les plannings de ventilation du labo de cette façon.Commencez par donner au profil du Pi une commande, par exemple heaters.set avec un paramètre Oui/Non on, niveau Basic. Sur le 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)
(Vos codes et la durée d’impulsion proviennent du sniff, les miens sont des valeurs provisoires.)Puis, sur la carte Règles de l’asset terrasse :
- Règle « Heaters on » : When Sunrise or sunset, Sunset, offset -15. Then Send a command
heaters.seton = yes to the Pi. - Règle « Heaters off » : When A time of day 23:00, every day. Then the same with on = no.
Le coucher du soleil nécessite la localisation du lieu : renseignez donc la latitude/longitude sur l’asset terrasse et placez le Pi sous celui-ci, sinon la règle ne sera pas enregistrée. Par ailleurs, le 433 MHz n’offre aucun retour, donc envoyez la commande deux fois à une minute d’intervalle si vous voulez être sûr. Doc : 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.

