* New light transformer implementation
* Fixed missing ; in the code, thanks Jos!
* Removed backward compatibility code for v1.20.x (because there were too many other changes that broke the build, and for which creating a work-around was not feasible).
* Fixed duplicate api section in the example.yaml (thanks @badbroechten\!) and updated the example to not use an underscore in the hostname.
* Prepare for release
* Added OTA progress to the example.yaml.
* Updated the changelog for the ota progress support in the example.yaml.
* Implemented front_panel.set_level action for easier control of the slider LEDs.
* Updated documentation for 1.18.0 release with external components support.
* Moved example.yaml to the root dir, in line with the recommendations from the ESPHome external components guide.
* Normalized the version numbering for ESPHome references.
* Fixed the styling of the example.yaml references.
Co-authored-by: Maurice Makaay <mmakaay1@xs4all.net>
The reasoning behind this can be found in this issue:
https://github.com/mmakaay/esphome-yeelight_bs2/issues/7
When you are already using a previous version of the firmware,
then note that the following changes are necessary:
* Update to the latest version of the custom component code.
* Rename your folder `custom_components/yeelight_bs2` to
`custom_components/xiaomi_bslamp2`
* Update your yaml config by changing all occurrences of `yeelight_bs2`
into `xiaomi_bslamp2`
The links to the github repository will remain functional after
the renaming operation, so it's not required to grab a fresh clone.
For example: `id(${id_light_mode}).state == "night"`
This is used in the example.yaml to turn off the illumination
of the front panel, when the lamp goes into night light mode.
The indicator was not halfway when using 0.5 as the output value.
Also added an example of how the output could be wrapped in a
light component, to expose it to Home Assistant as a monochromatic
light. Not that useful probably, but a nice display of ESPHome's
flexibility.
The example.yaml now also updates the brightness indicator when
the light brightness changes. When switching the device to night
light mode, it will turn off the front panel illumation completely.
And last but not least: the example configuration now shows a way
to set the device to a random color when touching the color button.
A HUB component was introduced. This HUB component has all the knowledge
about the Yeelight Bedside Lamp 2 hardware. It known what pins are used,
that PWM frequencies to use, what pins to switch in binary mode, etc. etc.
No configuration is required for this HUB component. It's automatically
loaded when the light component is loaded. The light component will use the
HUB component to access the pins that are required for driving the LED
circuitry.
Note that this simplifies the configuration by A LOT. There's no need
anymore to configure the pinouts in the YAML file. This is a logical route
to take, since we're talking about a factory-produced PCB with a soldered on
ESP32 chip, which uses the same GPIO's and settings on all produced devices
(I presume). It would be quite redundant to force every user into
configuring these pinouts themselves.
** Beware to update your device yaml configuration **
There are a few pinouts left to move into the HUB. I will do that in the
next commit. Your device yaml configuration can be simplified along with
these changes. Some of the keys in the existing light configuration block
will no longer work and will have to be removed (red, green, blue, white).
** Further development **
The HUB will be extended make it the central component that also handles
the I2C communication. This way, there is a central place to regulate the
traffic to and from the front panel. We will be able to build upon this
by implementing extra, fully separated components that handle for example
the front panel light level, the power button, the color button and
the slider.
** Interrupt handler for the I2C IRQ trigger pin **
One requirement for the I2C communication has already been implemented: an
interrupt handler for the GPIO that is used by the front panel to signal the
ESP that a new touch or release event is avilable to be read.
It doens't do anything functionally right now, but if you watch the log
file, you will see that touch events are detected and that they trigger some
log messages.