Merge pull request #2544 from esphome/bump-2021.10.0b5

2021.10.0b5
This commit is contained in:
Jesse Hills 2021-10-18 16:37:43 +13:00 committed by GitHub
commit d6d037047b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 170 additions and 17 deletions

View file

@ -758,7 +758,12 @@ def run_esphome(argv):
args = parse_args(argv)
CORE.dashboard = args.dashboard
setup_log(args.verbose, args.quiet)
setup_log(
args.verbose,
args.quiet,
# Show timestamp for dashboard access logs
args.command == "dashboard",
)
if args.deprecated_argv_suggestion is not None and args.command != "vscode":
_LOGGER.warning(
"Calling ESPHome with the configuration before the command is deprecated "

View file

@ -11,6 +11,8 @@ namespace ble_client {
static const char *const TAG = "ble_client";
float BLEClient::get_setup_priority() const { return setup_priority::AFTER_BLUETOOTH; }
void BLEClient::setup() {
auto ret = esp_ble_gattc_app_register(this->app_id);
if (ret) {

View file

@ -81,6 +81,7 @@ class BLEClient : public espbt::ESPBTClient, public Component {
void setup() override;
void dump_config() override;
void loop() override;
float get_setup_priority() const override;
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
esp_ble_gattc_cb_param_t *param) override;

View file

@ -27,13 +27,10 @@ from .const import ( # noqa
KEY_ESP32,
KEY_SDKCONFIG_OPTIONS,
KEY_VARIANT,
VARIANT_ESP32,
VARIANT_ESP32S2,
VARIANT_ESP32S3,
VARIANT_ESP32C3,
VARIANT_ESP32H2,
VARIANTS,
)
from .boards import BOARD_TO_VARIANT
# force import gpio to register pin schema
from .gpio import esp32_pin_to_code # noqa
@ -190,7 +187,7 @@ def _esp_idf_check_versions(value):
platform_version = value.get(CONF_PLATFORM_VERSION, ESP_IDF_PLATFORM_VERSION)
value[CONF_PLATFORM_VERSION] = str(platform_version)
if version != RECOMMENDED_ARDUINO_FRAMEWORK_VERSION:
if version != RECOMMENDED_ESP_IDF_FRAMEWORK_VERSION:
_LOGGER.warning(
"The selected ESP-IDF framework version is not the recommended one. "
"If there are connectivity or build issues please remove the manual version."
@ -199,6 +196,21 @@ def _esp_idf_check_versions(value):
return value
def _detect_variant(value):
if CONF_VARIANT not in value:
board = value[CONF_BOARD]
if board not in BOARD_TO_VARIANT:
raise cv.Invalid(
"This board is unknown, please set the variant manually",
path=[CONF_BOARD],
)
value = value.copy()
value[CONF_VARIANT] = BOARD_TO_VARIANT[board]
return value
CONF_PLATFORM_VERSION = "platform_version"
ARDUINO_FRAMEWORK_SCHEMA = cv.All(
@ -250,12 +262,11 @@ CONFIG_SCHEMA = cv.All(
cv.Schema(
{
cv.Required(CONF_BOARD): cv.string_strict,
cv.Optional(CONF_VARIANT, default="ESP32"): cv.one_of(
*VARIANTS, upper=True
),
cv.Optional(CONF_VARIANT): cv.one_of(*VARIANTS, upper=True),
cv.Optional(CONF_FRAMEWORK, default={}): FRAMEWORK_SCHEMA,
}
),
_detect_variant,
set_core_data,
)

View file

@ -1,3 +1,5 @@
from .const import VARIANT_ESP32, VARIANT_ESP32S2, VARIANT_ESP32C3
ESP32_BASE_PINS = {
"TX": 1,
"RX": 3,
@ -925,3 +927,125 @@ ESP32_BOARD_PINS = {
},
"xinabox_cw02": {"LED": 27},
}
"""
BOARD_TO_VARIANT generated with:
git clone https://github.com/platformio/platform-espressif32
for x in platform-espressif32/boards/*.json; do
mcu=$(jq -r .build.mcu <"$x");
fname=$(basename "$x")
board="${fname%.*}"
variant=$(echo "$mcu" | tr '[:lower:]' '[:upper:]')
echo " \"$board\": VARIANT_${variant},"
done | sort
"""
BOARD_TO_VARIANT = {
"alksesp32": VARIANT_ESP32,
"az-delivery-devkit-v4": VARIANT_ESP32,
"bpi-bit": VARIANT_ESP32,
"briki_abc_esp32": VARIANT_ESP32,
"briki_mbc-wb_esp32": VARIANT_ESP32,
"d-duino-32": VARIANT_ESP32,
"esp320": VARIANT_ESP32,
"esp32-c3-devkitm-1": VARIANT_ESP32C3,
"esp32cam": VARIANT_ESP32,
"esp32-devkitlipo": VARIANT_ESP32,
"esp32dev": VARIANT_ESP32,
"esp32doit-devkit-v1": VARIANT_ESP32,
"esp32doit-espduino": VARIANT_ESP32,
"esp32-evb": VARIANT_ESP32,
"esp32-gateway": VARIANT_ESP32,
"esp32-poe-iso": VARIANT_ESP32,
"esp32-poe": VARIANT_ESP32,
"esp32-pro": VARIANT_ESP32,
"esp32-s2-kaluga-1": VARIANT_ESP32S2,
"esp32-s2-saola-1": VARIANT_ESP32S2,
"esp32thing_plus": VARIANT_ESP32,
"esp32thing": VARIANT_ESP32,
"esp32vn-iot-uno": VARIANT_ESP32,
"espea32": VARIANT_ESP32,
"espectro32": VARIANT_ESP32,
"espino32": VARIANT_ESP32,
"esp-wrover-kit": VARIANT_ESP32,
"etboard": VARIANT_ESP32,
"featheresp32-s2": VARIANT_ESP32S2,
"featheresp32": VARIANT_ESP32,
"firebeetle32": VARIANT_ESP32,
"fm-devkit": VARIANT_ESP32,
"frogboard": VARIANT_ESP32,
"healthypi4": VARIANT_ESP32,
"heltec_wifi_kit_32_v2": VARIANT_ESP32,
"heltec_wifi_kit_32": VARIANT_ESP32,
"heltec_wifi_lora_32_V2": VARIANT_ESP32,
"heltec_wifi_lora_32": VARIANT_ESP32,
"heltec_wireless_stick_lite": VARIANT_ESP32,
"heltec_wireless_stick": VARIANT_ESP32,
"honeylemon": VARIANT_ESP32,
"hornbill32dev": VARIANT_ESP32,
"hornbill32minima": VARIANT_ESP32,
"imbrios-logsens-v1p1": VARIANT_ESP32,
"inex_openkb": VARIANT_ESP32,
"intorobot": VARIANT_ESP32,
"iotaap_magnolia": VARIANT_ESP32,
"iotbusio": VARIANT_ESP32,
"iotbusproteus": VARIANT_ESP32,
"kits-edu": VARIANT_ESP32,
"labplus_mpython": VARIANT_ESP32,
"lolin32_lite": VARIANT_ESP32,
"lolin32": VARIANT_ESP32,
"lolin_d32_pro": VARIANT_ESP32,
"lolin_d32": VARIANT_ESP32,
"lopy4": VARIANT_ESP32,
"lopy": VARIANT_ESP32,
"m5stack-atom": VARIANT_ESP32,
"m5stack-core2": VARIANT_ESP32,
"m5stack-core-esp32": VARIANT_ESP32,
"m5stack-coreink": VARIANT_ESP32,
"m5stack-fire": VARIANT_ESP32,
"m5stack-grey": VARIANT_ESP32,
"m5stack-timer-cam": VARIANT_ESP32,
"m5stick-c": VARIANT_ESP32,
"magicbit": VARIANT_ESP32,
"mgbot-iotik32a": VARIANT_ESP32,
"mgbot-iotik32b": VARIANT_ESP32,
"mhetesp32devkit": VARIANT_ESP32,
"mhetesp32minikit": VARIANT_ESP32,
"microduino-core-esp32": VARIANT_ESP32,
"nano32": VARIANT_ESP32,
"nina_w10": VARIANT_ESP32,
"node32s": VARIANT_ESP32,
"nodemcu-32s": VARIANT_ESP32,
"nscreen-32": VARIANT_ESP32,
"odroid_esp32": VARIANT_ESP32,
"onehorse32dev": VARIANT_ESP32,
"oroca_edubot": VARIANT_ESP32,
"pico32": VARIANT_ESP32,
"piranha_esp32": VARIANT_ESP32,
"pocket_32": VARIANT_ESP32,
"pycom_gpy": VARIANT_ESP32,
"qchip": VARIANT_ESP32,
"quantum": VARIANT_ESP32,
"sensesiot_weizen": VARIANT_ESP32,
"sg-o_airMon": VARIANT_ESP32,
"s_odi_ultra": VARIANT_ESP32,
"sparkfun_lora_gateway_1-channel": VARIANT_ESP32,
"tinypico": VARIANT_ESP32,
"ttgo-lora32-v1": VARIANT_ESP32,
"ttgo-lora32-v21": VARIANT_ESP32,
"ttgo-lora32-v2": VARIANT_ESP32,
"ttgo-t1": VARIANT_ESP32,
"ttgo-t7-v13-mini32": VARIANT_ESP32,
"ttgo-t7-v14-mini32": VARIANT_ESP32,
"ttgo-t-beam": VARIANT_ESP32,
"ttgo-t-watch": VARIANT_ESP32,
"turta_iot_node": VARIANT_ESP32,
"vintlabs-devkit-v1": VARIANT_ESP32,
"wemosbat": VARIANT_ESP32,
"wemos_d1_mini32": VARIANT_ESP32,
"wesp32": VARIANT_ESP32,
"widora-air": VARIANT_ESP32,
"wifiduino32": VARIANT_ESP32,
"xinabox_cw02": VARIANT_ESP32,
}

View file

@ -57,7 +57,7 @@ void ESP32BLEBeacon::setup() {
);
}
float ESP32BLEBeacon::get_setup_priority() const { return setup_priority::DATA; }
float ESP32BLEBeacon::get_setup_priority() const { return setup_priority::BLUETOOTH; }
void ESP32BLEBeacon::ble_core_task(void *params) {
ble_setup();

View file

@ -154,7 +154,7 @@ void BLEServer::gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t ga
}
}
float BLEServer::get_setup_priority() const { return setup_priority::BLUETOOTH - 10; }
float BLEServer::get_setup_priority() const { return setup_priority::AFTER_BLUETOOTH; }
void BLEServer::dump_config() { ESP_LOGCONFIG(TAG, "ESP32 BLE Server:"); }

View file

@ -40,6 +40,8 @@ uint64_t ble_addr_to_uint64(const esp_bd_addr_t address) {
return u;
}
float ESP32BLETracker::get_setup_priority() const { return setup_priority::BLUETOOTH; }
void ESP32BLETracker::setup() {
global_esp32_ble_tracker = this;
this->scan_result_lock_ = xSemaphoreCreateMutex();

View file

@ -171,6 +171,7 @@ class ESP32BLETracker : public Component {
/// Setup the FreeRTOS task and the Bluetooth stack.
void setup() override;
void dump_config() override;
float get_setup_priority() const override;
void loop() override;

View file

@ -19,7 +19,8 @@ from esphome.const import (
CONF_TX_BUFFER_SIZE,
)
from esphome.core import CORE, EsphomeError, Lambda, coroutine_with_priority
from esphome.components.esp32 import get_esp32_variant, VARIANT_ESP32S2, VARIANT_ESP32C3
from esphome.components.esp32 import get_esp32_variant
from esphome.components.esp32.const import VARIANT_ESP32S2, VARIANT_ESP32C3
CODEOWNERS = ["@esphome/core"]
logger_ns = cg.esphome_ns.namespace("logger")

View file

@ -1,6 +1,6 @@
"""Constants used by esphome."""
__version__ = "2021.10.0b4"
__version__ = "2021.10.0b5"
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"

View file

@ -49,8 +49,10 @@ def color(col: str, msg: str, reset: bool = True) -> bool:
class ESPHomeLogFormatter(logging.Formatter):
def __init__(self):
super().__init__(fmt="%(asctime)s %(levelname)s %(message)s", style="%")
def __init__(self, *, include_timestamp: bool):
fmt = "%(asctime)s " if include_timestamp else ""
fmt += "%(levelname)s %(message)s"
super().__init__(fmt=fmt, style="%")
def format(self, record):
formatted = super().format(record)
@ -64,7 +66,9 @@ class ESPHomeLogFormatter(logging.Formatter):
return f"{prefix}{formatted}{Style.RESET_ALL}"
def setup_log(debug=False, quiet=False):
def setup_log(
debug: bool = False, quiet: bool = False, include_timestamp: bool = False
) -> None:
import colorama
if debug:
@ -79,4 +83,6 @@ def setup_log(debug=False, quiet=False):
logging.getLogger("urllib3").setLevel(logging.WARNING)
colorama.init()
logging.getLogger().handlers[0].setFormatter(ESPHomeLogFormatter())
logging.getLogger().handlers[0].setFormatter(
ESPHomeLogFormatter(include_timestamp=include_timestamp)
)