By default the device should provide RGB, color temperature and brightness when opening the settings for the light.
In Lovelace, it should work if you add entity “Bedside Lamp RGBW Light” there.
Maybe remove the device from the ESPHome integration and re-add it, if that route only provides brightness.
If it doesn’t work, could you please provide some pictures of my what you see?
The code for the Bedside Lamp 2 is basically ready. The only reason for holding back the final stable release, is that I am waiting for a few updates in ESPHome (connection stability fix + external components support). That release will the epic
Note however that this firmware will not work for the other lamps mentioned. For example the front panel is something that you will not find on the other lamps.
I don’t have the other lamps myself, so I have no way to provide direct hardware help for those.
I see that the ESPHome feature “Implement external custom components installing from YAML esphome#1630 (new-integration)” is included in the preparation for ESPHome version 1.18.0b1. Love it!
When 1.18.0 reaches the stable release, I can modify my repo for using it as an external component in ESPHome, and installing will be a breeze.
Hi @mmakaay, really thank you for your work with the Bedside Lamp 2. Even I’m completely new to the ESP Home stuff, I was able to compile the firmware for my lamp and successfully flash it to the device, by using your tutorials.
One thing I’m still confused with is the (binary)sensors, which come along with the platform. I was able to connect the lamp via the ESP Home integration. Also I can make OTA updates. But only entities are light RGBW and the text senor:
From you example configuration, I just changed values for WiFi, etc. So everything else is completely based on that file. Do I need to specify the sensors somewhere else in my HA yaml files? I tried that, but it ended up in the message that “platform xiaomi_bslamp2 is not existing”, while validating the configuration.
I’m afraid that maybe I got something completely wrong with understanding ESP Home
Goal is to give my son control about his KNX main room light with e.g. long pressing a button on the lamp. That would be very cool.
If you want the binary sensors in HA, give them a name: property. That will expose them there.
A better way to handle this, would be to use multi touch event handling for the binary sensor to recognize the long touch, and add an action to send either the required home assistant service calls, or send an event to home assistant. This event can be used in home assistant to trigger the required actions.
(The example yaml already uses long touch on power to turn on the night light. You can change the actions for that to let it so what you like)
Thanks a lot for your support! I guess the “native API” was the missing piece for me. Somehow I thought that I need to configure sensors, etc. within my HA yaml configuration files, and not directly within the firmware. I’ll give it a try later.
Again, your work on the bedside lamp 2 integration is really appreciated, as it became a bit useless for me since XIAOMI has removed the LAN control feature. Another very nice feature is that “night light” is now available in multiple colors. So I’ll build a time controlled “traffic light” for my son, so that he knows when he wakes up at night, if it’s already in the morning, or still at night.
That night light traffic light is an awesome idea!
I’m planning to gather some ideas for possibilities with the new firmware, and this one will definitely be in there. Thank you!
binary_sensor:
- platform: xiaomi_bslamp2
id: ${id_power_button}
for: POWER_BUTTON
on_multi_click:
- timing:
- ON for at most 0.8s
then:
- light.toggle: ${id_light}
- timing:
- ON for at least 0.8s
then:
- homeassistant.service:
service: light.toggle
data:
entity_id: light.matti_dim
That’s working quite nice! I also adjusted the slider range, so that I’m still able to activate night light by just dimming down:
Perfect! That’s why I love flashing it with ESPHome so much. You can apply your own required behaviors to the lamp and it’s controls. It was great when LAN control worked, but by now I’m greatful for Xiaomi taking that away
Hi, I just noticed a strange behavior with my bedside lamp 2. When I checked by HA logbook entries, there’s a status update from the lamp once a minute, with having also the message that the entity is not available once a minute. I receive these messages regardless if the lamp is on, or off. The lamp itself isn’t flickering, so I don’t thing it’s rebooting all the time. Any ideas?
eingeschaltet = turned on
ausgeschaltet = turned off
nicht mehr verfügbar = not available (anymore)
Edit: I’ve thousands of these messages in my log book. The log via ESP Home does not saying any errors, but also shows timeouts and re connections about every minute.
That looks like the disconnect behaviour in the underlying AsyncTCP library. I ran into that too (somewhere high up in this huge thread ) and have since come up with a fix.
The fix will likely be automatically included in ESPHome 1.18.0 (the next release).
First of all : a BIG thank you for your incredible work. I bought my lamp at around the time you started this project (it was a happy coincidence) and now that I got it, it works like a charm.
I managed to flash without a serial adapter but using a spare ESP8266 I had. The key is to ground the “EN” pin, and then connect RX-RX and TX-TX without crossing. It then worked with ESPflash (but not with esptool, I couldn’t make a backup of the original firmware).
I was wondering : is the inside of the lamp made of one unique big LED or multiples leds ? If it’s multiple leds I thought a candle/fire effect would be nice, with different tones of red and oranges alternating. Even with one unique led it could be nice if done correctly. Is it something you could maybe implement ?
There is multiple LED’s inside the lamp but they are not individually addressable and therefore can’t be individually controlled. There is already multiple effects made for this lamp and you can make pretty much whatever effect that you like. Can’t wait to see what craziness that will spawn from this!
Are you sure they are not individually addressable ? Maybe someone can find a hacky way ?
Is there a guide to get more light effect on homeassistant than slow random and fast random ? I wonder what kind of other effects there are.
Personally I set up this and it works great : https://community.home-assistant.io/t/wake-up-light-alarm-with-sunrise-effect/
I’m pretty sure of this. You shouldn’t look at this lamp as a Yeelight lamp anymore after flashing mmakaay’s FW, so forget about the Yeelight integration. Have a look at ESPHome and customise all you want!
Yes, I’m very sure too. The LEDs are not individually addressable.
This circuit is not something like a WS2812, rolled up in the lamp (that was actually one of the possible crude hacks I had in mind, in case I wouldn’t be able to replace the firmware with something working).
I have been thinking about adding a LED strip in the inner cone of the lamp, and drive that from a free pin (there are a number of those), specifically for something like a flame or a rotating flashing light. That would be quite a stand-alone hack though, which would even represent itself as a separate light in Home Assistant. Not a change to the lamp’s firmware.
Thanks for the wake up light post, @nmb02x5pk7if
My Bedside Lamp in the bedroom is mainly meant as a wake up light.
I will try your the blueprint for mine. My current implementation is a very crude hack, that deserves some improvement.