From 7c427c4c0c55981c2f0f0101ef52ec2f8220f9a8 Mon Sep 17 00:00:00 2001 From: Maurice Makaay Date: Mon, 19 Dec 2022 23:52:42 +0100 Subject: [PATCH] Suppress 'GPIO is a Strapping PIN and should be avoided' warnings --- components/xiaomi_bslamp2/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/xiaomi_bslamp2/__init__.py b/components/xiaomi_bslamp2/__init__.py index ce40e5a..913d633 100644 --- a/components/xiaomi_bslamp2/__init__.py +++ b/components/xiaomi_bslamp2/__init__.py @@ -4,6 +4,7 @@ from esphome import pins from esphome.components.ledc.output import LEDCOutput from esphome.components.gpio.output import GPIOBinaryOutput from esphome.components.i2c import I2CBus, I2CDevice +from esphome.components.esp32 import gpio_esp32 from esphome.const import ( CONF_LIGHT, CONF_RED, CONF_GREEN, CONF_BLUE, CONF_WHITE, CONF_I2C, CONF_ADDRESS, CONF_TRIGGER_PIN, CONF_ID @@ -100,6 +101,15 @@ async def make_front_panel_hal(config): cg.add(fp_hal.set_i2c_bus(fp_i2c_var)) cg.add(fp_hal.set_i2c_address(config[CONF_FRONT_PANEL][CONF_ADDRESS])) + +# Clear the configuration of strapping pins in ESPHome, to suppress pin +# usage warnings that often confuse users of this firmware (when there +# are problems, these often pop up as "is this the issue?"). +# The hardware on the lamp is as-is, and warnings about pins that might +# better not be used are futile. +gpio_esp32._ESP32_STRAPPING_PINS = {} + + async def to_code(config): await make_light_hal(config) await make_front_panel_hal(config)