TL;DR The web_server component is not yet implemented for the new ESPhome ESP-IDF framework support that is used by the Bedside Lamp 2 firmware. Remove the web_server component will make the compile work.
More extended info:
The Bedside Lamp firmware makes use of the new ESP-IDF support in ESPHome. This is the framework that is supplied by the ESP32 manufacturer Espressif. By doing this, the whole Arduino library layer that was used before is dropped (especially good because of its code quality and the slow updates that it gets). Also, using ESP-IDF as the framework allows for building the firmware without needing hacked up, externally maintained platform packages.
The ESP-IDF support is relatively new though (added in 2021.10.0), and not all components have been updated to work with the ESP-IDF framework yet. Some of those components are web_server and mqtt.
And that’s where the problem with your config lies. The web_server is not supported yet.
You can fix the config by removing or commenting out the following bit:
As soon as the ESPHome project gets an implementation for the web_server and mqtt, those will become available automatically as usable components for the bedside lamp. So, that would be a definite yes, but the dependency is on the ESPHome project, not the lamp firmware code.
No, you have to add these lines in you esphome yaml file for the lamp and compile it again. Also remove the HA integration for the lamp and reinstall it after you compiled the firmware with the new name.
Finally!!! At last I found the time during the Christmas holidays to update my lamp with the code from Maurice - Thank you for all of the hard work.
Some feedback from my experience:
Get familiar with ESPHome before starting and make a simple project
Find that really small soldering iron bit
A small breadboard is really good for making the connections to DuPont wires
The config is a bit tricky as there have been some updates to ESPHome and frameworks
I’m quite interested in this project since I have a bslamp2 with the last firmware.
But I don´t know how to install this. I have a lot of ESPhome devices, but if I try to install the example.yaml I get a lot of errors, like this:
INFO Reading configuration /config/esphome/xiaomi-bedside.yaml...
INFO Updating https://github.com/mmakaay/esphome-xiaomi_bslamp2@main
ERROR Unable to import component xiaomi_bslamp2.light:
ImportError: cannot import name 'I2CComponent' from 'esphome.components.i2c' (/usr/local/lib/python3.9/dist-packages/esphome/components/i2c/__init__.py)
ERROR Unable to import component xiaomi_bslamp2.text_sensor:
ImportError: cannot import name 'I2CComponent' from 'esphome.components.i2c' (/usr/local/lib/python3.9/dist-packages/esphome/components/i2c/__init__.py)
ERROR Unable to import component xiaomi_bslamp2.output:
ImportError: cannot import name 'I2CComponent' from 'esphome.components.i2c' (/usr/local/lib/python3.9/dist-packages/esphome/components/i2c/__init__.py)
ERROR Unable to import component xiaomi_bslamp2.binary_sensor:
ImportError: cannot import name 'I2CComponent' from 'esphome.components.i2c' (/usr/local/lib/python3.9/dist-packages/esphome/components/i2c/__init__.py)
ERROR Unable to import component xiaomi_bslamp2.sensor:
Unable to find action with the name 'preset.activate'.
Unable to find action with the name 'light.disco_on'.
Unable to find action with the name 'front_panel.set_level'.
Unable to find action with the name 'light.disco_on'.
Unable to find action with the name 'light.disco_on'.
Platform not found: 'light.xiaomi_bslamp2'.
Platform not found: 'text_sensor.xiaomi_bslamp2'.
Platform not found: 'output.xiaomi_bslamp2'.
Platform not found: 'binary_sensor.xiaomi_bslamp2'.
Platform not found: 'binary_sensor.xiaomi_bslamp2'.
Platform not found: 'sensor.xiaomi_bslamp2'.
I guess I have to install the repository somewhere but I don´t know jow and where
You don’t have to install the repository. It is included by means of the external_component feature of ESPHome. Did you use the base example.yaml configuration file as the starting point? That contains everything that is needed to build the firmware. The included core.yaml configuration package takes care of setting up the required external component.
I was using another example.yaml . With the one you gave me I don´t have any errors, but can I use that code to control my lamp?, or should I add extra lines?. Sorry is the firs time that I saw the packages
All aspects of the lamp can be controlled by ESPHome.
The example configuration provides a basic setup that acts a lot like the original firmware.
If you want specific behavior that is not covered by the default configuration, then you can use all features of ESPHome to get the required behavior.