mirror of
https://github.com/esphome/esphome.git
synced 2024-11-14 02:58:11 +01:00
commit
e5a38ce748
13 changed files with 89 additions and 16 deletions
|
@ -43,7 +43,7 @@ RUN \
|
||||||
# Ubuntu python3-pip is missing wheel
|
# Ubuntu python3-pip is missing wheel
|
||||||
pip3 install --no-cache-dir \
|
pip3 install --no-cache-dir \
|
||||||
wheel==0.36.2 \
|
wheel==0.36.2 \
|
||||||
platformio==5.2.0 \
|
platformio==5.2.1 \
|
||||||
# Change some platformio settings
|
# Change some platformio settings
|
||||||
&& platformio settings set enable_telemetry No \
|
&& platformio settings set enable_telemetry No \
|
||||||
&& platformio settings set check_libraries_interval 1000000 \
|
&& platformio settings set check_libraries_interval 1000000 \
|
||||||
|
|
|
@ -8,6 +8,23 @@ import sys
|
||||||
|
|
||||||
config = configparser.ConfigParser(inline_comment_prefixes=(';', ))
|
config = configparser.ConfigParser(inline_comment_prefixes=(';', ))
|
||||||
config.read(sys.argv[1])
|
config.read(sys.argv[1])
|
||||||
libs = [x for x in config['common']['lib_deps'].splitlines() if len(x) != 0]
|
|
||||||
|
libs = []
|
||||||
|
# Extract from every lib_deps key in all sections
|
||||||
|
for section in config.sections():
|
||||||
|
conf = config[section]
|
||||||
|
if "lib_deps" not in conf:
|
||||||
|
continue
|
||||||
|
for lib_dep in conf["lib_deps"].splitlines():
|
||||||
|
if not lib_dep:
|
||||||
|
# Empty line or comment
|
||||||
|
continue
|
||||||
|
if lib_dep.startswith("${"):
|
||||||
|
# Extending from another section
|
||||||
|
continue
|
||||||
|
if "@" not in lib_dep:
|
||||||
|
# No version pinned, this is an internal lib
|
||||||
|
continue
|
||||||
|
libs.append(lib_dep)
|
||||||
|
|
||||||
subprocess.check_call(['platformio', 'lib', '-g', 'install', *libs])
|
subprocess.check_call(['platformio', 'lib', '-g', 'install', *libs])
|
||||||
|
|
|
@ -50,6 +50,13 @@ void ESP8266GPIOPin::pin_mode(gpio::Flags flags) {
|
||||||
mode = OUTPUT;
|
mode = OUTPUT;
|
||||||
} else if (flags == (gpio::FLAG_INPUT | gpio::FLAG_PULLUP)) {
|
} else if (flags == (gpio::FLAG_INPUT | gpio::FLAG_PULLUP)) {
|
||||||
mode = INPUT_PULLUP;
|
mode = INPUT_PULLUP;
|
||||||
|
if (pin_ == 16) {
|
||||||
|
// GPIO16 doesn't have a pullup, so pinMode would fail.
|
||||||
|
// However, sometimes this method is called with pullup mode anyway
|
||||||
|
// for example from dallas one_wire. For those cases convert this
|
||||||
|
// to a INPUT mode.
|
||||||
|
mode = INPUT;
|
||||||
|
}
|
||||||
} else if (flags == (gpio::FLAG_INPUT | gpio::FLAG_PULLDOWN)) {
|
} else if (flags == (gpio::FLAG_INPUT | gpio::FLAG_PULLDOWN)) {
|
||||||
mode = INPUT_PULLDOWN_16;
|
mode = INPUT_PULLDOWN_16;
|
||||||
} else if (flags == (gpio::FLAG_OUTPUT | gpio::FLAG_OPEN_DRAIN)) {
|
} else if (flags == (gpio::FLAG_OUTPUT | gpio::FLAG_OPEN_DRAIN)) {
|
||||||
|
|
|
@ -107,9 +107,9 @@ def validate_supports(value):
|
||||||
raise cv.Invalid(
|
raise cv.Invalid(
|
||||||
"Open-drain only works with output mode", [CONF_MODE, CONF_OPEN_DRAIN]
|
"Open-drain only works with output mode", [CONF_MODE, CONF_OPEN_DRAIN]
|
||||||
)
|
)
|
||||||
if is_pullup and num == 0:
|
if is_pullup and num == 16:
|
||||||
raise cv.Invalid(
|
raise cv.Invalid(
|
||||||
"GPIO Pin 0 does not support pullup pin mode. "
|
"GPIO Pin 16 does not support pullup pin mode. "
|
||||||
"Please choose another pin.",
|
"Please choose another pin.",
|
||||||
[CONF_MODE, CONF_PULLUP],
|
[CONF_MODE, CONF_PULLUP],
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@ std::vector<MDNSService> MDNSComponent::compile_services_() {
|
||||||
#ifdef USE_API
|
#ifdef USE_API
|
||||||
if (api::global_api_server != nullptr) {
|
if (api::global_api_server != nullptr) {
|
||||||
MDNSService service{};
|
MDNSService service{};
|
||||||
service.service_type = "esphomelib";
|
service.service_type = "_esphomelib";
|
||||||
service.proto = "_tcp";
|
service.proto = "_tcp";
|
||||||
service.port = api::global_api_server->get_port();
|
service.port = api::global_api_server->get_port();
|
||||||
service.txt_records.push_back({"version", ESPHOME_VERSION});
|
service.txt_records.push_back({"version", ESPHOME_VERSION});
|
||||||
|
@ -57,7 +57,7 @@ std::vector<MDNSService> MDNSComponent::compile_services_() {
|
||||||
#ifdef USE_PROMETHEUS
|
#ifdef USE_PROMETHEUS
|
||||||
{
|
{
|
||||||
MDNSService service{};
|
MDNSService service{};
|
||||||
service.service_type = "prometheus-http";
|
service.service_type = "_prometheus-http";
|
||||||
service.proto = "_tcp";
|
service.proto = "_tcp";
|
||||||
service.port = WEBSERVER_PORT;
|
service.port = WEBSERVER_PORT;
|
||||||
res.push_back(service);
|
res.push_back(service);
|
||||||
|
@ -68,7 +68,7 @@ std::vector<MDNSService> MDNSComponent::compile_services_() {
|
||||||
// Publish "http" service if not using native API
|
// Publish "http" service if not using native API
|
||||||
// This is just to have *some* mDNS service so that .local resolution works
|
// This is just to have *some* mDNS service so that .local resolution works
|
||||||
MDNSService service{};
|
MDNSService service{};
|
||||||
service.service_type = "http";
|
service.service_type = "_http";
|
||||||
service.proto = "_tcp";
|
service.proto = "_tcp";
|
||||||
service.port = WEBSERVER_PORT;
|
service.port = WEBSERVER_PORT;
|
||||||
service.txt_records.push_back({"version", ESPHOME_VERSION});
|
service.txt_records.push_back({"version", ESPHOME_VERSION});
|
||||||
|
|
|
@ -13,7 +13,11 @@ struct MDNSTXTRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MDNSService {
|
struct MDNSService {
|
||||||
|
// service name _including_ underscore character prefix
|
||||||
|
// as defined in RFC6763 Section 7
|
||||||
std::string service_type;
|
std::string service_type;
|
||||||
|
// second label indicating protocol _including_ underscore character prefix
|
||||||
|
// as defined in RFC6763 Section 7, like "_tcp" or "_udp"
|
||||||
std::string proto;
|
std::string proto;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
std::vector<MDNSTXTRecord> txt_records;
|
std::vector<MDNSTXTRecord> txt_records;
|
||||||
|
|
|
@ -17,9 +17,21 @@ void MDNSComponent::setup() {
|
||||||
|
|
||||||
auto services = compile_services_();
|
auto services = compile_services_();
|
||||||
for (const auto &service : services) {
|
for (const auto &service : services) {
|
||||||
MDNS.addService(service.service_type.c_str(), service.proto.c_str(), service.port);
|
// Strip the leading underscore from the proto and service_type. While it is
|
||||||
|
// part of the wire protocol to have an underscore, and for example ESP-IDF
|
||||||
|
// expects the underscore to be there, the ESP8266 implementation always adds
|
||||||
|
// the underscore itself.
|
||||||
|
auto proto = service.proto.c_str();
|
||||||
|
while (*proto == '_') {
|
||||||
|
proto++;
|
||||||
|
}
|
||||||
|
auto service_type = service.service_type.c_str();
|
||||||
|
while (*service_type == '_') {
|
||||||
|
service_type++;
|
||||||
|
}
|
||||||
|
MDNS.addService(service_type, proto, service.port);
|
||||||
for (const auto &record : service.txt_records) {
|
for (const auto &record : service.txt_records) {
|
||||||
MDNS.addServiceTxt(service.service_type.c_str(), service.proto.c_str(), record.key.c_str(), record.value.c_str());
|
MDNS.addServiceTxt(service_type, proto, record.key.c_str(), record.value.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,9 +90,7 @@ async def to_code(config):
|
||||||
)
|
)
|
||||||
cg.add(RawExpression(f"if ({condition}) return"))
|
cg.add(RawExpression(f"if ({condition}) return"))
|
||||||
|
|
||||||
if CORE.is_esp8266:
|
if CORE.is_esp32 and CORE.using_arduino:
|
||||||
cg.add_library("Update", None)
|
|
||||||
elif CORE.is_esp32 and CORE.using_arduino:
|
|
||||||
cg.add_library("Update", None)
|
cg.add_library("Update", None)
|
||||||
|
|
||||||
use_state_callback = False
|
use_state_callback = False
|
||||||
|
|
|
@ -159,8 +159,15 @@ def final_validate_power_esp32_ble(value):
|
||||||
"esp32_ble_server",
|
"esp32_ble_server",
|
||||||
"esp32_ble_tracker",
|
"esp32_ble_tracker",
|
||||||
]:
|
]:
|
||||||
|
if conflicting not in fv.full_config.get():
|
||||||
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cv.require_framework_version(esp32_arduino=cv.Version(1, 0, 5))(None)
|
# Only arduino 1.0.5+ and esp-idf impacted
|
||||||
|
cv.require_framework_version(
|
||||||
|
esp32_arduino=cv.Version(1, 0, 5),
|
||||||
|
esp_idf=cv.Version(4, 0, 0),
|
||||||
|
)(None)
|
||||||
except cv.Invalid:
|
except cv.Invalid:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2021.10.0"
|
__version__ = "2021.10.1"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
|
|
||||||
|
|
|
@ -206,6 +206,31 @@ def include_file(path, basename):
|
||||||
cg.add_global(cg.RawStatement(f'#include "{basename}"'))
|
cg.add_global(cg.RawStatement(f'#include "{basename}"'))
|
||||||
|
|
||||||
|
|
||||||
|
ARDUINO_GLUE_CODE = """\
|
||||||
|
#define yield() esphome::yield()
|
||||||
|
#define millis() esphome::millis()
|
||||||
|
#define delay(x) esphome::delay(x)
|
||||||
|
#define delayMicroseconds(x) esphome::delayMicroseconds(x)
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@coroutine_with_priority(-999.0)
|
||||||
|
async def add_arduino_global_workaround():
|
||||||
|
# The Arduino framework defined these itself in the global
|
||||||
|
# namespace. For the esphome codebase that is not a problem,
|
||||||
|
# but when custom code
|
||||||
|
# 1. writes `millis()` for example AND
|
||||||
|
# 2. has `using namespace esphome;` like our guides suggest
|
||||||
|
# Then the compiler will complain that the call is ambiguous
|
||||||
|
# Define a hacky macro so that the call is never ambiguous
|
||||||
|
# and always uses the esphome namespace one.
|
||||||
|
# See also https://github.com/esphome/issues/issues/2510
|
||||||
|
# Priority -999 so that it runs before adding includes, as those
|
||||||
|
# also might reference these symbols
|
||||||
|
for line in ARDUINO_GLUE_CODE.splitlines():
|
||||||
|
cg.add_global(cg.RawStatement(line))
|
||||||
|
|
||||||
|
|
||||||
@coroutine_with_priority(-1000.0)
|
@coroutine_with_priority(-1000.0)
|
||||||
async def add_includes(includes):
|
async def add_includes(includes):
|
||||||
# Add includes at the very end, so that the included files can access global variables
|
# Add includes at the very end, so that the included files can access global variables
|
||||||
|
@ -287,6 +312,9 @@ async def to_code(config):
|
||||||
cg.add_build_flag("-Wno-unused-but-set-variable")
|
cg.add_build_flag("-Wno-unused-but-set-variable")
|
||||||
cg.add_build_flag("-Wno-sign-compare")
|
cg.add_build_flag("-Wno-sign-compare")
|
||||||
|
|
||||||
|
if CORE.using_arduino:
|
||||||
|
CORE.add_job(add_arduino_global_workaround)
|
||||||
|
|
||||||
if config[CONF_INCLUDES]:
|
if config[CONF_INCLUDES]:
|
||||||
CORE.add_job(add_includes, config[CONF_INCLUDES])
|
CORE.add_job(add_includes, config[CONF_INCLUDES])
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ tornado==6.1
|
||||||
tzlocal==3.0 # from time
|
tzlocal==3.0 # from time
|
||||||
tzdata>=2021.1 # from time
|
tzdata>=2021.1 # from time
|
||||||
pyserial==3.5
|
pyserial==3.5
|
||||||
platformio==5.2.1
|
platformio==5.2.1 # When updating platformio, also update Dockerfile
|
||||||
esptool==3.1
|
esptool==3.1
|
||||||
click==8.0.3
|
click==8.0.3
|
||||||
esphome-dashboard==20211021.0
|
esphome-dashboard==20211021.0
|
||||||
|
|
|
@ -1150,7 +1150,7 @@ servo:
|
||||||
ttp229_lsf:
|
ttp229_lsf:
|
||||||
|
|
||||||
ttp229_bsf:
|
ttp229_bsf:
|
||||||
sdo_pin: D0
|
sdo_pin: D2
|
||||||
scl_pin: D1
|
scl_pin: D1
|
||||||
|
|
||||||
sim800l:
|
sim800l:
|
||||||
|
|
Loading…
Reference in a new issue