Philips Hue Behavior in Home Assistant when the light goes

A few weeks ago I was telling you the limitations I had found in Home Assistant during the first weeks of use. One of the problems that brought me home is the impossibility of configuring the behavior of the Philips Hue lights when the light goes out… and I’ve been able to fix it! I tell you how.

The problem: the lights turn on when the light goes

I mean, it’s not like they turn on when the light goes, obviously if there’s no light, they can’t turn on… but… When the light comes back, all turn on at 100%. in warm tones, i.e. in the default configuration of the bulbs.

In my house the light doesn’t go too often, but sometimes we turn on too many things at once… and the automatic jumps. Well, as soon as I give the light again, all the lights and all the lights are on. the Philips Hue plugs, which I currently have in the bathroom heaters.

In addition, until Home Assistant does not start all over again and the switches are reconnected it is not possible to turn them off… so those 3 or 4 minutes it takes the Pi to turn on and Home Assistant to be available are made ETERNOS while my wife looks at me with the face that means ‘Honey, it’s okay, but I’d like this to work better, take it as a suggestion, my love. ‘. You understand me.

If we have the bridge of Philips Hue original is possible to configure the behavior of the light bulbs when the light returns from the app. The possibilities are typical: ON (all lights are turned on), OFF (all lights are kept off) and RECOVER (the lights recover the state they had before the light went out). In addition, The bridge is integrable with Home Assistant, so if you keep the Philips Hue bridge you won’t have any problems.

But you know I’m a debrain and I decided to remove all the zigbee bridges and use only Home Assistant with the dongle zigbee SonOFF… which clearly (never better said) has brought me more problems than advantages I’ve learned a lot and I think is faster than the official bridge as there is no information exchange between platforms, all devices are connected to the SonOFF dongle and managed through the IP, so after investigating for a while I checked bitterly that there is no parmetr

or to configure the performance of the bulbs : (

The solution: Mosquitto Broker

Eclipse Mosquitto is a software to send light messages, so to understand us. It basically publishes lines of messages you can subscribe to. I’m not gonna mess you up anymore, if someone’s interested in deepening this issue can get into the web of the Broker Mosquitto. https: / / mostto.org / or read the BBits post where they explain it beautifully.

The point is, in my Home Assistant installation I use Mosquitto to post messages and Zigbee2MQTT so that Mosquitto can post Zigbee messages. It sounds complicated but it’s almost the standard installation.

The most normal thing is that there was a configuration parameter in Zigbee2MQTT which is where we have all the devices to configure the behavior. This is where I told you that there was the option to remove the Delay from the Hue lights, the little one-second gradient they do when they turn on and off… which is very nice but adds delay. And the funniest thing is that this cannot be modified from the Hue bridge or from the official app or from anywhere… but from the low-level configuration of the device in Zigbee2MQTT:

But with the behavior when the light comes back, it gets a little more complicated. Basically you have to send a command through Mosquitto that modifies the behavior of light in ‘zigbee language’. I explain it to you in a simple way:

The command you have to send is «hue _ power _ on _ behavior» and you have to send it directly to the topic zigbee2mqtt / name _ light / set / with the parameter we want to set. You haven’t heard anything, have you? That’s how ‘user-friendly ‘ It’s some Home Assistant stuff, I don’t know why I get into these mop…

The command ‘hue _ power _ on _ behavior’ is the one that controls what the bulb does when the light returns. Accept the parameters’ on ‘(light is turned on when light returns),’ off ‘(it is turned off),’ default ‘(default behaviour of the bulb, usually 100% light and warm tone) and’ recover ‘(return to the state in which it was when light is gone). I mean, in my case what I want is for them to stay out, I’d have to send a ‘hue _ power _ on _ behavior = off’ to each of the bulbs. Oh, and also the sockets that control the heaters.

For this, we must enter the configuration of the Broker MQTT Mosquitto and here we tell you that we want to send the topic (or theme if you have it in Spanish) zigbee2mqtt / Name Device / set / hue _ power _ on _ behavior simply an ‘off’:

We can hear that topic to see if the change has come right, as you see at the bottom of the image.

Remember that you have to do it for all light bulbs or switches, as you cannot configure the behavior globally, Although from the original Hue bridge it was not possible either, it had to be made bulb by bulb.

And this simple way… xD

https: / / youtube.com / short / C1dr7Da7go4

https: / / youtube.com / short / e8Q3GbFL90E

I have to say, the ‘recover’ didn’t work for me. In my opinion this would be the perfect behavior, because if for example someone is in the bathroom when the light goes out, or in the kitchen or something like that, the light will be turned on as it was before, while those who were off will remain out.

I recognize that is not a simple solution I’ve been running a lot of tests and research until I’ve got the key… and don’t imagine the tests I’ve done and the times I’ve made the automatic jump by taking advantage of when my wife was out of the house (to avoid me) until it finally works as I needed it to work. It is true that the light may go away when someone is in the shower and then I have to wait for those 3-4 minutes until the light can be turned on, but I hope that never happens. I’ll keep testing and see if the pick-up works at any time and I’ll set them all up again. I already have.

I will:)

And if this entry has proved useful to save you some of the two hundred hours I’ve needed to get the solution, you could invite me to a cafe;)

Buy Me a Coffee at ko-fi.com wp: block {«ref»: 1612} /

10 comentarios en “Philips Hue Behavior in Home Assistant when the light goes”

  1. Gracias por este resumen, lo probe directamente enviando comando

    mosquitto_pub -t ‘zigbee2mqtt/0x001788010bd58d86/set’ -m ‘{ «hue_power_on_behavior»: «off» }’

    Pero veo que funciona a medias, en tu video veo como parece intentar de querer encender y se apaga inmediatamente.

    En mi caso no tengo ese efecto, pero si es cierto que si apago y enciendo el interruptor en poco tiempo. Se pierde esta configuracion o eso parece.

    Entiendo que realmente la configuracion del estado ON OFF o el RECOVER (que no parece funcionar) no se guarda internamente en la propia bombilla, si no que es el Mosquitto el que envio como tiene que comportarse cada vez que se engacha no?

    Gracias!

    1. Hola sabido! Muchas gracias por tu mensaje! Pues no te sé decir porque si es mosquitto quien manda el mensaje, como es que cuando se va la luz y luego vuelve, la bombilla sigue apagada? No debería ser así ya que cuando vuelve la corriente a la bombilla mosquitto todavía no puede publicarle nada ya que no se ha levantado aun, por lo que debe almacenar algo de información en la misma bombilla, no?

      En mi caso funciona perfecto, el video de la lamparilla no hace justicia ya que en este momento no hay ligero parpadeo ni luz residual que creo que se debía al mismo interruptor de la lamparilla. Estos días han saltado los plomos en varias ocasiones debido al calor y haber encendido demasiadas cosas y te aseguro que funciona como debe, cuando vuelve la luz se quedan APAGADAS por defecto sin tintineo ni energía residual ni nada 🙂

  2. Yo tengo 3 lamparas HUE numero de modelo 929001821602, monocromaticas dimmeables, que no se por que razon me las toma el zigbee2mqtt como 8718699673147. La opcion «recover,» no esta, esta la opcion «prervious» que debe ser lo mismo, y el comportamiento es erratico: por ahi respeta el ultimo estado y por ahi no.Ya no se que setearle……

    1. Hola Ben! Muchas gracias por tu comentario! En realidad eso no te soluciona mucho y estás añadiendo complejidad a la red, ya que los SAIs no son baratos, hay que cambiarles las baterías cada cierto tiempo… y aún así, la bombilla se quedará quedando sin luz y aparecerá como desconectada en Home Assistant! Es verdad que cuando cuelga la luz, en cuanto se conecte ya sabrá el estado en el que tiene que ponerse, pero tendremos que elegir igualmente cuál es su estado por defecto cuando vuelva la corriente y todavía no se haya conectado a la plataforma.

  3. Ese problema tenia en Home Assistant también, la solución sencilla fue cambiar en la configuración del dispositivo zigbee cambiar el estado de encendido en el desplegable LastState (Último estado) que es lo que haría una bombilla normal.
    Todavía no utilizo Mosquitto y eso que compre otra antena para cacharrear si puedo aguantar todo en ZHA lo haré aunque sea a base de cacharrear con los Quirks y es que soy nuevo en esto de HA y la cosa es compleja para, como me llamo a mi mismo, fontanero informático.
    A estas alturas supongo lo tendrás solucionado.
    En realidad encontré este sitio porque tengo instalado en un mini pc home assistant con proxmox y como tu pienso que los intermediarios a la larga no son buenos, la intención es instalarlo en baremetal.

    1. Hola Juan, muchísimas gracias por tu comentario! Sí, ahora ya tienes el desplegable, pero cuando escribí esta entrada aún no existía eso 😀

      Respecto a utilizar ZHA, yo creo que es más robusto y sencillo de utilizar, pero viene muy bien tener MQTT instalado porque hay dispositivos que se pueden gestionar directamente desde MQTT, se ha convertido en un estándar de gestión de colas (no, de esas colas no :D) y, por ejemplo, el Ring intercom se puede gestionar desde la nube de Ring (con lo cual ya no se queda en local) o desde MQTT (con lo cual sí se queda en local). Con los Shelly nos pasa lo mismo, si tienes MQTT los puedes gestionar en local, sino tienes que pasar por el Shelly Cloud.

      Y como bien dices, tengo HA instalado directamente sobre Home Assistant OS en el NUC, sin capa de virtualización ni nada. De momento 0 problemas. Bueno, 0 no, algún problemita puntual, pero nada que hubiera mejorado proxmox o similar 🙂

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.

Scroll al inicio