Cambiar bombillas Wi-Fi desde un Switch de la placa a través de mi Pi, sin app del fabricante
Traducido del English por IA ·
Otra vez yo (el del contador de gas). Siguiente proyecto: las luces del pasillo y del salón. Quiero encenderlas y apagarlas desde un Switch en mi placa Hermetry, y más adelante desde reglas. No quiero depender de la app del móvil de un fabricante de bombillas, así que la idea es que la Raspberry Pi se comunique con las bombillas en mi red doméstica.¿Hay bombillas inteligentes que una Pi pueda controlar directamente por LAN? ¿Y cómo llega el Switch de la placa a la Pi? Intenté añadir una tarjeta Switch, pero dice «Elija un comando en la configuración de este widget» y la lista de comandos está vacía.
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.
Traducido del English por IA ·
¿Cuánto cuestan bombillas como esas? Estoy pensando en ellas para la oficina
How much are bulbs like that? Thinking about it for the office
Traducido del English por IA ·
¿El interruptor mostrará si alguien encendió la luz desde la pared?
Will the switch show if someone turned the light on at the wall?
Traducido del English por IA ·
Lo hice en casa el invierno pasado. Bombillas: elige unas con una API LAN local documentada. Las bombillas WiZ aceptan JSON por UDP en el puerto 38899, LIFX tiene su protocolo LAN; ambas funcionan desde Python sin cuenta en la nube una vez conectadas a tu Wi-Fi. Unas 10-15 GBP cada una.
La lista está vacía porque el Switch solo puede enviar comandos del catálogo Commands del perfil del dispositivo. Así que:
1. En el perfil del Pi, pestaña Commands, añade light.set, nivel Basic, parámetros room (Choice: hallway, living) y on (Yes / no). Las placas solo envían comandos del catálogo de nivel Basic; un comando Privileged se rechaza en una placa.
2. En el Pi, gestiona v1/rpc/req/+, conmuta la bombilla, responde en v1/rpc/res/{id} y publica el estado real como telemetría, en números: {"hallway_on": 1}.
3. Ajustes de la tarjeta Switch: Cuando se use este control, Ejecutar un comando, dispositivo = el Pi, comando light.set, room como valor fijo, on desde el valor del control. Después vincula Current state a hallway_on.
Ese último paso responde a David: el Switch muestra lo que informa el Pi, así que consulta la bombilla cada 30 s más o menos y publícalo; así también se verá un cambio con el interruptor de pared. Si un interruptor de pared corta la corriente, la bombilla simplemente desaparece, así que deja los interruptores de pared encendidos. Detalles en 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.
Traducido del English por IA ·
Y quien use el panel necesita el permiso para ejecutar comandos de widgets, o el Switch simplemente dice que no. Le pasó a un colega en el trabajo.
And whoever uses the board needs the permission to run widget commands, or the Switch just says no. Caught a colleague out at work.
Traducido del English por IA ·
¿Por qué tiene que ser un comando del catálogo? ¿No podría la placa enviar cualquier cosa?
Why does it have to be a catalog command, couldn’t the board send anything?
Traducido del English por IA ·
A propósito. Un board es algo que muchas personas pulsan, así que solo recibe los comandos seguros que enumeraste.
On purpose. A board is something many people click, so it only gets the safe commands you listed.
Traducido del English por IA ·
¡Funciona! Tengo dos bombillas WiZ. La lista de comandos se llenó en cuanto añadí light.set al catálogo. En la primera versión, el Switch solo mostraba su texto Unknown, porque todavía no había vinculado Current state. Lo vinculé a hallway_on y ahora se mantiene estable, incluso cuando mi mujer usa el botón propio de la bombilla.
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.
- 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.

