mirror of
https://github.com/esphome/esphome.git
synced 2024-12-30 17:57:43 +01:00
Mark ESP32-S2 as not having Bluetooth (#4194)
This commit is contained in:
parent
3f1af1690b
commit
e6d8ef98d3
@ -2,12 +2,14 @@ import esphome.codegen as cg
|
|||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.const import CONF_ID
|
from esphome.const import CONF_ID
|
||||||
from esphome.core import CORE
|
from esphome.core import CORE
|
||||||
from esphome.components.esp32 import add_idf_sdkconfig_option
|
from esphome.components.esp32 import add_idf_sdkconfig_option, get_esp32_variant, const
|
||||||
|
|
||||||
DEPENDENCIES = ["esp32"]
|
DEPENDENCIES = ["esp32"]
|
||||||
CODEOWNERS = ["@jesserockz"]
|
CODEOWNERS = ["@jesserockz"]
|
||||||
CONFLICTS_WITH = ["esp32_ble_tracker", "esp32_ble_beacon"]
|
CONFLICTS_WITH = ["esp32_ble_tracker", "esp32_ble_beacon"]
|
||||||
|
|
||||||
|
NO_BLUTOOTH_VARIANTS = [const.VARIANT_ESP32S2]
|
||||||
|
|
||||||
esp32_ble_ns = cg.esphome_ns.namespace("esp32_ble")
|
esp32_ble_ns = cg.esphome_ns.namespace("esp32_ble")
|
||||||
ESP32BLE = esp32_ble_ns.class_("ESP32BLE", cg.Component)
|
ESP32BLE = esp32_ble_ns.class_("ESP32BLE", cg.Component)
|
||||||
|
|
||||||
@ -19,6 +21,15 @@ CONFIG_SCHEMA = cv.Schema(
|
|||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_variant(_):
|
||||||
|
variant = get_esp32_variant()
|
||||||
|
if variant in NO_BLUTOOTH_VARIANTS:
|
||||||
|
raise cv.Invalid(f"{variant} does not support Bluetooth")
|
||||||
|
|
||||||
|
|
||||||
|
FINAL_VALIDATE_SCHEMA = validate_variant
|
||||||
|
|
||||||
|
|
||||||
async def to_code(config):
|
async def to_code(config):
|
||||||
var = cg.new_Pvariable(config[CONF_ID])
|
var = cg.new_Pvariable(config[CONF_ID])
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
@ -3,6 +3,7 @@ import esphome.config_validation as cv
|
|||||||
from esphome.const import CONF_ID, CONF_TYPE, CONF_UUID, CONF_TX_POWER
|
from esphome.const import CONF_ID, CONF_TYPE, CONF_UUID, CONF_TX_POWER
|
||||||
from esphome.core import CORE, TimePeriod
|
from esphome.core import CORE, TimePeriod
|
||||||
from esphome.components.esp32 import add_idf_sdkconfig_option
|
from esphome.components.esp32 import add_idf_sdkconfig_option
|
||||||
|
from esphome.components import esp32_ble
|
||||||
|
|
||||||
DEPENDENCIES = ["esp32"]
|
DEPENDENCIES = ["esp32"]
|
||||||
CONFLICTS_WITH = ["esp32_ble_tracker"]
|
CONFLICTS_WITH = ["esp32_ble_tracker"]
|
||||||
@ -54,6 +55,8 @@ CONFIG_SCHEMA = cv.All(
|
|||||||
validate_config,
|
validate_config,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
FINAL_VALIDATE_SCHEMA = esp32_ble.validate_variant
|
||||||
|
|
||||||
|
|
||||||
async def to_code(config):
|
async def to_code(config):
|
||||||
uuid = config[CONF_UUID].hex
|
uuid = config[CONF_UUID].hex
|
||||||
|
@ -17,6 +17,7 @@ from esphome.const import (
|
|||||||
)
|
)
|
||||||
from esphome.core import CORE
|
from esphome.core import CORE
|
||||||
from esphome.components.esp32 import add_idf_sdkconfig_option
|
from esphome.components.esp32 import add_idf_sdkconfig_option
|
||||||
|
from esphome.components import esp32_ble
|
||||||
|
|
||||||
DEPENDENCIES = ["esp32"]
|
DEPENDENCIES = ["esp32"]
|
||||||
|
|
||||||
@ -187,6 +188,8 @@ CONFIG_SCHEMA = cv.Schema(
|
|||||||
}
|
}
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).extend(cv.COMPONENT_SCHEMA)
|
||||||
|
|
||||||
|
FINAL_VALIDATE_SCHEMA = esp32_ble.validate_variant
|
||||||
|
|
||||||
ESP_BLE_DEVICE_SCHEMA = cv.Schema(
|
ESP_BLE_DEVICE_SCHEMA = cv.Schema(
|
||||||
{
|
{
|
||||||
cv.GenerateID(CONF_ESP32_BLE_ID): cv.use_id(ESP32BLETracker),
|
cv.GenerateID(CONF_ESP32_BLE_ID): cv.use_id(ESP32BLETracker),
|
||||||
|
Loading…
Reference in New Issue
Block a user