Compare commits

...

9 Commits

Author SHA1 Message Date
  Maurice Makaay e5ad209f25 Add ESPHome version checks for component release 2021.10.0 1 year ago
  Maurice Makaay fa771ad6aa Add hotfix for issue #104 to 2022.10.0 1 year ago
  Maurice Makaay 4901999bd3 Merge branch 'dev' into release/2021.10.0 3 years ago
  Maurice Makaay 0584961c74 Merge branch 'dev' into release/2021.10.0 3 years ago
  Maurice Makaay 90aa28f5fa Add configuration upgrade guide for 2021.10.0 3 years ago
  jsuanet 9467505724
Update core.yaml (#59) 3 years ago
  Maurice Makaay 954f273e14 Modified release branch naming. 3 years ago
  Maurice Makaay 80befaff89 Fixed schema in core.yaml 3 years ago
  Maurice Makaay 557293e9b6 Bump for release. 3 years ago
4 changed files with 68 additions and 25 deletions
Split View
  1. +16
    -0
      CHANGELOG.md
  2. +45
    -23
      components/xiaomi_bslamp2/__init__.py
  3. +1
    -1
      example.yaml
  4. +6
    -1
      packages/core.yaml

+ 16
- 0
CHANGELOG.md View File

@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2021.10.0] Hotfix for ESP-IDF platform upgrade
### Changed
- Due to changes in the ESP-IDF framework, and ESPHome 2022.12.0 using the newer version
of the framework, flashing the lamp with ESPHome 2022.12.0 could result in a
failing device. It would not connect to WiFi anymore and serial logging showed a reboot
loop, crashing at the WiFi setup.
This release of the lamp firmware forces the use of the last known working version
of the ESP-IDF framework. This is not a final solution, because I don't want to be
stuck to old versions for dependencies, but for now this change at least should fix
the issue for users that flash their lamps.
**If you already flashed your lamp and it ended up bricked**, then check out this
information from the related GitHub issue report:
[https://github.com/mmakaay/esphome-xiaomi_bslamp2/issues/104#issuecomment-1356182034](Fix recipe from issue #104)
## [2021.10.0]
**Note**: This release requires ESPHome 2021.10.0 and Home Assistant 2021.8.0 or newer.


+ 45
- 23
components/xiaomi_bslamp2/__init__.py View File

@ -8,6 +8,8 @@ from esphome.const import (
CONF_LIGHT, CONF_RED, CONF_GREEN, CONF_BLUE, CONF_WHITE,
CONF_I2C, CONF_ADDRESS, CONF_TRIGGER_PIN, CONF_ID
)
from esphome.util import parse_esphome_version
from voluptuous import Invalid
CODEOWNERS = ["@mmakaay"]
@ -40,29 +42,49 @@ FRONT_PANEL_LED_OPTIONS = {
"10": FrontPanelLEDs.LED_10,
}
CONFIG_SCHEMA = cv.COMPONENT_SCHEMA.extend({
# RGBWW Light
cv.Required(CONF_LIGHT): cv.Schema(
{
cv.GenerateID(CONF_LIGHT_HAL_ID): cv.declare_id(LightHAL),
cv.Required(CONF_RED): cv.use_id(LEDCOutput),
cv.Required(CONF_GREEN): cv.use_id(LEDCOutput),
cv.Required(CONF_BLUE): cv.use_id(LEDCOutput),
cv.Required(CONF_WHITE): cv.use_id(LEDCOutput),
cv.Required(CONF_MASTER1): cv.use_id(GPIOBinaryOutput),
cv.Required(CONF_MASTER2): cv.use_id(GPIOBinaryOutput),
}
),
# Front panel I2C
cv.Required(CONF_FRONT_PANEL): cv.Schema(
{
cv.GenerateID(CONF_FRONT_PANEL_HAL_ID): cv.declare_id(FrontPanelHAL),
cv.Required(CONF_I2C): cv.use_id(I2CBus),
cv.Required(CONF_ADDRESS): cv.i2c_address,
cv.Required(CONF_TRIGGER_PIN): cv.All(pins.internal_gpio_input_pin_schema)
}
),
})
def check_version_compatibility(config):
esphome_version = parse_esphome_version()
if esphome_version < (2021, 10, 0):
raise Invalid(
"This xiaomi_bslamp2 component requires at least ESPHome " +
"version 2021.10.0; Please upgrade ESPHome and try again."
)
if esphome_version >= (2022, 12, 0):
raise Invalid(
"This xiaomi_bslamp2 component does not work with " +
"ESPHome 2022.12.0 or later; Please use a newer version of " +
"the component and try again."
)
return config
CONFIG_SCHEMA = cv.All(
check_version_compatibility,
cv.COMPONENT_SCHEMA.extend({
# RGBWW Light
cv.Required(CONF_LIGHT): cv.Schema(
{
cv.GenerateID(CONF_LIGHT_HAL_ID): cv.declare_id(LightHAL),
cv.Required(CONF_RED): cv.use_id(LEDCOutput),
cv.Required(CONF_GREEN): cv.use_id(LEDCOutput),
cv.Required(CONF_BLUE): cv.use_id(LEDCOutput),
cv.Required(CONF_WHITE): cv.use_id(LEDCOutput),
cv.Required(CONF_MASTER1): cv.use_id(GPIOBinaryOutput),
cv.Required(CONF_MASTER2): cv.use_id(GPIOBinaryOutput),
}
),
# Front panel I2C
cv.Required(CONF_FRONT_PANEL): cv.Schema(
{
cv.GenerateID(CONF_FRONT_PANEL_HAL_ID): cv.declare_id(FrontPanelHAL),
cv.Required(CONF_I2C): cv.use_id(I2CBus),
cv.Required(CONF_ADDRESS): cv.i2c_address,
cv.Required(CONF_TRIGGER_PIN): cv.All(pins.internal_gpio_input_pin_schema)
}
),
})
)
async def make_light_hal(config):
light_hal = cg.new_Pvariable(config[CONF_LIGHT][CONF_LIGHT_HAL_ID])


+ 1
- 1
example.yaml View File

@ -32,7 +32,7 @@ substitutions:
packages:
bslamp2:
url: https://github.com/mmakaay/esphome-xiaomi_bslamp2
ref: dev
ref: release/2021.10.0
files:
- packages/core.yaml
- packages/behavior_default.yaml


+ 6
- 1
packages/core.yaml View File

@ -25,13 +25,18 @@ esp32:
CONFIG_FREERTOS_UNICORE: y
advanced:
ignore_efuse_mac_crc: true
# Work-around for bricking-after-upgrade-to-2022-12-0-issue.
# See: https://github.com/mmakaay/esphome-xiaomi_bslamp2/issues/104
version: 4.3.2
source: ~3.40302.0
platform_version: platformio/espressif32 @ 3.5.0
# Retrieve the code for the xiaomi_bslamp2 platform from GitHub.
external_components:
- source:
type: git
url: https://github.com/mmakaay/esphome-xiaomi_bslamp2
ref: dev
ref: release/2021.10.0
refresh: 60s
# Disable the reboot timeout. By default, the lamp reboots after 15


Loading…
Cancel
Save