Browse Source

Add new version check to dev as well

release/2023.4.0
Maurice Makaay 2 years ago
parent
commit
1ffc209a44
1 changed files with 14 additions and 1 deletions
  1. +14
    -1
      components/xiaomi_bslamp2/__init__.py

+ 14
- 1
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_LIGHT, CONF_RED, CONF_GREEN, CONF_BLUE, CONF_WHITE,
CONF_I2C, CONF_ADDRESS, CONF_TRIGGER_PIN, CONF_ID CONF_I2C, CONF_ADDRESS, CONF_TRIGGER_PIN, CONF_ID
) )
from esphome.util import parse_esphome_version
from voluptuous import Invalid
CODEOWNERS = ["@mmakaay"] CODEOWNERS = ["@mmakaay"]
@ -40,8 +42,19 @@ FRONT_PANEL_LED_OPTIONS = {
"10": FrontPanelLEDs.LED_10, "10": FrontPanelLEDs.LED_10,
} }
def check_version_compatibility(config):
esphome_version = parse_esphome_version()
if esphome_version < (2022, 12, 0):
raise Invalid(
"This xiaomi_bslamp2 component requires at least ESPHome " +
"version 2022.12.0; Please upgrade ESPHome and try again."
)
return config
CONFIG_SCHEMA = cv.All( CONFIG_SCHEMA = cv.All(
cv.require_esphome_version(2022, 12, 0),
check_version_compatibility,
cv.COMPONENT_SCHEMA.extend({ cv.COMPONENT_SCHEMA.extend({
# RGBWW Light # RGBWW Light
cv.Required(CONF_LIGHT): cv.Schema( cv.Required(CONF_LIGHT): cv.Schema(


Loading…
Cancel
Save