Traduit de English par IA ·
D’après la documentation, l’application mobile sert aux notifications et aux validations. Pour la commande, la console web dans le navigateur du téléphone fonctionne très bien : c’est ainsi que je pilote la pompe de mon jardin partagé.Mise en place :
- Dans le profil d’appareil du Pi, onglet Commands, ajoutez une commande, par exemple la méthode
heater.set, avec un paramètre Oui/Nonon, niveau Basic. Les cartes n’envoient que des commandes de niveau Basic. - Créez un tableau de bord, ajoutez un contrôle Switch, action Run a command, choisissez le Pi et
heater.set, puis liez l’état actuel à une clé que le Pi remonte (par exempleheater_onen 0/1). - Sur le Pi :
def on_connect(c, u, f, rc):
c.subscribe("v1/rpc/req/+", qos=1)
def on_message(c, u, msg):
req_id = msg.topic.rsplit("/", 1)[1]
body = json.loads(msg.payload)
if body.get("method") == "heater.set":
on = bool(body["params"]["on"])
GPIO.output(17, on)
c.publish("v1/telemetry", json.dumps({"heater_on": int(on)}), qos=1)
c.publish(f"v1/rpc/res/{req_id}", json.dumps({"ok": True}), qos=1)
Aucun port n’est ouvert. Ajoutez la carte à l’écran d’accueil de votre téléphone en signet, elle fonctionne pratiquement comme une application. Pour les alertes (pièce trop froide, etc.), l’application envoie des notifications push sur le téléphone, ou vous pouvez utiliser l’e-mail ou une application de messagerie reliée.
From what the docs say, the mobile app is for notifications and approvals. For the switch, the web console in the phone browser works fine, that’s how I run my allotment pump.
What to set up:
- On the Pi’s device profile, Commands tab, add a command, e.g. method
heater.set, one Yes/no parameteron, tier Basic. Boards only send Basic tier commands. - Make a dashboard, add a Switch control, action Run a command, pick the Pi and
heater.set, and bind the current state to a key the Pi reports (sayheater_onas 0/1). - On the Pi:
def on_connect(c, u, f, rc):
c.subscribe("v1/rpc/req/+", qos=1)
def on_message(c, u, msg):
req_id = msg.topic.rsplit("/", 1)[1]
body = json.loads(msg.payload)
if body.get("method") == "heater.set":
on = bool(body["params"]["on"])
GPIO.output(17, on)
c.publish("v1/telemetry", json.dumps({"heater_on": int(on)}), qos=1)
c.publish(f"v1/rpc/res/{req_id}", json.dumps({"ok": True}), qos=1)
No ports opened. Bookmark the board on your phone’s home screen and it’s basically an app. For alerts (room too cold etc.) the app gives you push on the phone, or use e-mail or a linked chat app.

