Wi-Fi-Lampen über einen Pi mit einem Board-Switch schalten, ohne Hersteller-App
Von English mit KI übersetzt ·
Wieder ich (der Gaszähler-Typ). Nächstes Projekt: die Lichter in unserem Flur und Wohnzimmer. Ich möchte sie über einen Switch auf meinem Hermetry-Board ein- und ausschalten und später auch über Regeln. Ich möchte nicht von der Handy-App eines Lampenherstellers abhängig sein, also soll der Raspberry Pi mit den Lampen in meinem Heimnetzwerk sprechen.Gibt es smarte Lampen, die ein Pi direkt über das LAN steuern kann? Und wie erreicht der Board-Switch den Pi? Ich habe versucht, eine Switch-Karte hinzuzufügen, aber es heißt „Wählen Sie in den Einstellungen dieses Widgets einen Befehl aus“ und die Befehlsliste ist leer.
Me again (the gas meter guy). Next project: the lights in our hallway and living room. I want to turn them on and off from a Switch on my Hermetry board, and later from rules. I don’t want to depend on a bulb vendor’s phone app, so the idea is the Raspberry Pi talks to the bulbs on my home network.
Are there smart bulbs that a Pi can control directly over the LAN? And how does the board Switch reach the Pi? I tried adding a Switch card but it says „Choose a command in this widget’s settings“ and the command list is empty.
Von English mit KI übersetzt ·
Was kosten solche Lampen? Ich überlege, sie für das Büro anzuschaffen
How much are bulbs like that? Thinking about it for the office
Von English mit KI übersetzt ·
Zeigt der Schalter an, wenn jemand das Licht an der Wand eingeschaltet hat?
Will the switch show if someone turned the light on at the wall?
Von English mit KI übersetzt ·
Habe das letzten Winter zu Hause gemacht. Lampen: Nimm welche mit dokumentierter lokaler LAN-API. WiZ-Lampen nehmen JSON über UDP-Port 38899 an, LIFX hat sein LAN-Protokoll; beides funktioniert mit Python ohne Cloud-Konto, sobald sie im WLAN sind. Etwa 10-15 GBP pro Stück.
Die Liste ist leer, weil der Switch nur Befehle aus dem Commands-Katalog des Geräteprofils senden kann. Also:
1. Im Profil des Pi, Tab Commands, light.set hinzufügen, Stufe Basic, Parameter room (Choice: hallway, living) und on (Yes / no). Boards senden nur Befehle der Stufe Basic aus dem Katalog, ein Privileged-Befehl wird auf einem Board abgelehnt.
2. Auf dem Pi v1/rpc/req/+ verarbeiten, die Lampe schalten, auf v1/rpc/res/{id} antworten und den echten Zustand als Telemetrie als Zahlen veröffentlichen: {"hallway_on": 1}.
3. Einstellungen der Switch-Karte: Wenn dieses Steuerelement benutzt wird, Befehl ausführen, Gerät = der Pi, Befehl light.set, room als fester Wert, on aus dem Wert des Steuerelements. Dann Current state an hallway_on binden.
Der letzte Schritt beantwortet David: Der Switch zeigt, was der Pi meldet. Also die Lampe alle 30 s oder so abfragen und veröffentlichen, dann zeigt sich auch eine Änderung am Wandschalter. Wenn ein Wandschalter den Strom abschaltet, ist die Lampe einfach weg, also die Wandschalter eingeschaltet lassen. Details unter Control cards.
Did this at home last winter. Bulbs: pick ones with a documented local LAN API. WiZ bulbs take JSON over UDP port 38899, LIFX has its LAN protocol, both work from Python without any cloud account once they’re on your Wi-Fi. Around 10-15 GBP each.
The list is empty because the Switch can only send commands from the device profile’s Commands catalog. So:
1. On the Pi’s profile, Commands tab, add light.set, tier Basic, parameters room (Choice: hallway, living) and on (Yes / no). Boards send only Basic tier catalog commands, a Privileged one gets refused on a board.
2. On the Pi, handle v1/rpc/req/+, switch the bulb, answer on v1/rpc/res/{id}, and publish the real state as telemetry, as numbers: {"hallway_on": 1}.
3. Switch card settings: When this control is used, Run a command, device = the Pi, command light.set, room as a fixed value, on from the control’s value. Then bind Current state to hallway_on.
That last step answers David: the Switch shows what the Pi reports, so poll the bulb every 30 s or so and publish it, then a wall switch change shows up too. With a wall switch cutting power the bulb is just gone, so leave the wall switches on. Details on Control cards.
Von English mit KI übersetzt ·
Und wer das Board benutzt, braucht die Berechtigung, Widget-Befehle auszuführen, sonst sagt der Switch einfach nein. Einen Kollegen hat es bei der Arbeit damit erwischt.
And whoever uses the board needs the permission to run widget commands, or the Switch just says no. Caught a colleague out at work.
Von English mit KI übersetzt ·
Warum muss es unbedingt ein Katalogbefehl sein, könnte das Board nicht einfach beliebige Daten senden?
Why does it have to be a catalog command, couldn’t the board send anything?
Von English mit KI übersetzt ·
Absichtlich. Ein Board wird von vielen Leuten angeklickt, daher erhält es nur die sicheren Befehle, die du aufgelistet hast.
On purpose. A board is something many people click, so it only gets the safe commands you listed.
Von English mit KI übersetzt ·
Funktioniert! Ich habe zwei WiZ-Lampen. Die Befehlsliste füllte sich, sobald ich light.set zum Katalog hinzugefügt hatte. In der ersten Version zeigte der Switch nur seinen Text Unknown an, weil ich Current state noch nicht gebunden hatte. Jetzt ist es an hallway_on gebunden und bleibt stabil, selbst wenn meine Frau den eigenen Knopf der Lampe benutzt.
Working! Got two WiZ bulbs. The command list filled up as soon as I added light.set to the catalog. First version the Switch only ever showed its Unknown text, because I hadn’t bound Current state yet. Bound it to hallway_on and it stays put now, even when my wife uses the bulb’s own button.
- Du musst angemeldet sein, um auf dieses Thema antworten zu können.
Mitdiskutieren
Melde dich an, um Fragen zu stellen und zu beantworten, hilfreiche Beiträge mit „Gefällt mir“ zu markieren und die Antwort zu kennzeichnen, die dein Problem gelöst hat. Jeder Beitrag bringt Punkte und Stufen.

