1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-01 15:41:52 +00:00

Compare commits

...

17 Commits

Author SHA1 Message Date
Otto Winter
49233e4734 Merge pull request #1225 from esphome/bump-1.15.0b3
1.15.0b3
2020-07-29 20:19:06 +02:00
Otto Winter
e2b5ecb78b Bump version to v1.15.0b3 2020-07-29 20:05:22 +02:00
Otto Winter
351ce67eae Bump base image to 2.4.1 (#1224) 2020-07-29 20:05:22 +02:00
dr-oblivium
44af5e439c wpa2 enterprise fixes: also copy eap parameters, don't require psk password to be set (#1215) 2020-07-29 20:05:22 +02:00
Otto Winter
dbc0d500d8 Bump ESPAsyncWebServer-esphome to v1.2.7 (#1221) 2020-07-29 20:05:21 +02:00
Emil Hesslow
86736aa480 Stop infinite loop in light on_turn_on (#1219)
Co-authored-by: Otto Winter <otto@otto-winter.com>
2020-07-29 20:05:21 +02:00
Otto Winter
57eb05c0e3 Add job to update HassIO addon repo (#1218) 2020-07-29 20:05:21 +02:00
Guillermo Ruffino
f6fe6e6bff renamed icon molecule co2 (#1217)
* renamed icon molecule co2

* sort of course
2020-07-29 20:05:20 +02:00
Otto Winter
18560f9430 Fix sdist missing requirements.txt (#1214)
Fixes https://github.com/esphome/issues/issues/1378
2020-07-29 20:05:20 +02:00
Otto Winter
352004221e Merge pull request #1213 from esphome/bump-1.15.0b2 2020-07-28 12:21:58 +02:00
Otto Winter
fc6a3e31c2 Bump version to v1.15.0b2 2020-07-28 12:15:41 +02:00
Otto Winter
a32b58fdf1 Downgrade FastLED to 3.3.2 (#1212)
Fixes https://github.com/esphome/issues/issues/1375
2020-07-28 12:15:41 +02:00
Otto Winter
2d50ecbecf Fix prometheus has wrong setup priority (#1211)
Fixes https://github.com/esphome/issues/issues/1377
2020-07-28 12:15:40 +02:00
Gediminas Šaltenis
87f1ffec05 Fix AS3935 sensor configuration issues (#1210)
* Fix AS3935 coniguration

* Increase verbosity
2020-07-28 12:15:40 +02:00
Otto Winter
f0dfde9fa1 Fix base config should override packages config (#1209) 2020-07-28 12:15:40 +02:00
Otto Winter
e36dc2d05e ESP8266 change recommended framework version to 2.7.2 (#1208) 2020-07-28 12:15:39 +02:00
Otto Winter
08c8fa2c90 Mitigate CVE-2020-12638 WiFi WPA Downgrade (#1207)
Co-authored-by: Lukas Bachschwell <lukas@lbsfilm.at>
2020-07-28 12:15:39 +02:00
30 changed files with 231 additions and 96 deletions

View File

@@ -25,7 +25,7 @@ jobs:
- uses: actions/checkout@v2
- name: Set up env variables
run: |
base_version="2.3.4"
base_version="2.4.1"
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"

View File

@@ -190,7 +190,7 @@ jobs:
echo "::set-env name=TAG::${TAG}"
- name: Set up env variables
run: |
base_version="2.3.4"
base_version="2.4.1"
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"

View File

@@ -210,7 +210,7 @@ jobs:
echo "::set-env name=TAG::${TAG}"
- name: Set up env variables
run: |
base_version="2.3.4"
base_version="2.4.1"
if [[ "${{ matrix.build_type }}" == "hassio" ]]; then
build_from="esphome/esphome-hassio-base-${{ matrix.arch }}:${base_version}"
@@ -222,13 +222,20 @@ jobs:
dockerfile="docker/Dockerfile"
fi
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
cache_tag="beta"
else
cache_tag="latest"
end
# Set env variables so these values don't need to be calculated again
echo "::set-env name=BUILD_FROM::${build_from}"
echo "::set-env name=BUILD_TO::${build_to}"
echo "::set-env name=DOCKERFILE::${dockerfile}"
echo "::set-env name=CACHE_TAG::${cache_tag}"
- name: Pull for cache
run: |
docker pull "${BUILD_TO}:latest" || true
docker pull "${BUILD_TO}:${CACHE_TAG}" || true
- name: Register QEMU binfmt
run: docker run --rm --privileged multiarch/qemu-user-static:5.0.0-2 --reset -p yes
- run: |
@@ -236,7 +243,7 @@ jobs:
--build-arg "BUILD_FROM=${BUILD_FROM}" \
--build-arg "BUILD_VERSION=${TAG}" \
--tag "${BUILD_TO}:${TAG}" \
--cache-from "${BUILD_TO}:latest" \
--cache-from "${BUILD_TO}:${CACHE_TAG}" \
--file "${DOCKERFILE}" \
.
- name: Log in to docker hub
@@ -300,3 +307,19 @@ jobs:
esphome/esphome-amd64:${TAG} \
esphome/esphome-armv7:${TAG}
docker manifest push esphome/esphome:latest
deploy-hassio-repo:
if: github.repository == 'esphome/esphome'
runs-on: ubuntu-latest
needs: [deploy-docker]
steps:
- env:
TOKEN: ${{ secrets.DEPLOY_HASSIO_TOKEN }}
run: |
TAG="${GITHUB_REF#refs/tags/v}"
curl \
-u ":$TOKEN" \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/esphome/hassio/actions/workflows/bump-version.yml/dispatches \
-d "{\"ref\":\"master\",\"inputs\":{\"version\":\"$TAG\"}}"

View File

@@ -1,5 +1,6 @@
include LICENSE
include README.md
include requirements.txt
include esphome/dashboard/templates/*.html
recursive-include esphome/dashboard/static *.ico *.js *.css *.woff* LICENSE
recursive-include esphome *.cpp *.h *.tcc

View File

@@ -1,4 +1,4 @@
ARG BUILD_FROM=esphome/esphome-base-amd64:2.3.4
ARG BUILD_FROM=esphome/esphome-base-amd64:2.4.1
FROM ${BUILD_FROM}
# First install requirements to leverage caching when requirements don't change

View File

@@ -1,4 +1,4 @@
FROM esphome/esphome-base-amd64:2.3.4
FROM esphome/esphome-base-amd64:2.4.1
COPY . .

View File

@@ -1,4 +1,4 @@
FROM esphome/esphome-lint-base:2.3.4
FROM esphome/esphome-lint-base:2.4.1
COPY requirements.txt requirements_test.txt /
RUN pip3 install --no-cache-dir -r /requirements.txt -r /requirements_test.txt

View File

@@ -25,7 +25,7 @@ AS3935_SCHEMA = cv.Schema({
cv.Optional(CONF_SPIKE_REJECTION, default=2): cv.int_range(min=1, max=11),
cv.Optional(CONF_LIGHTNING_THRESHOLD, default=1): cv.one_of(1, 5, 9, 16, int=True),
cv.Optional(CONF_MASK_DISTURBER, default=False): cv.boolean,
cv.Optional(CONF_DIV_RATIO, default=0): cv.one_of(0, 16, 22, 64, 128, int=True),
cv.Optional(CONF_DIV_RATIO, default=0): cv.one_of(0, 16, 32, 64, 128, int=True),
cv.Optional(CONF_CAPACITANCE, default=0): cv.int_range(min=0, max=15),
})

View File

@@ -26,6 +26,9 @@ void AS3935Component::setup() {
void AS3935Component::dump_config() {
ESP_LOGCONFIG(TAG, "AS3935:");
LOG_PIN(" Interrupt Pin: ", this->irq_pin_);
LOG_BINARY_SENSOR(" ", "Thunder alert", this->thunder_alert_binary_sensor_);
LOG_SENSOR(" ", "Distance", this->distance_sensor_);
LOG_SENSOR(" ", "Lightning energy", this->energy_sensor_);
}
float AS3935Component::get_setup_priority() const { return setup_priority::DATA; }

View File

@@ -27,4 +27,4 @@ def to_code(config):
if CONF_LIGHTNING_ENERGY in config:
conf = config[CONF_LIGHTNING_ENERGY]
lightning_energy_sensor = yield sensor.new_sensor(conf)
cg.add(hub.set_distance_sensor(lightning_energy_sensor))
cg.add(hub.set_energy_sensor(lightning_energy_sensor))

View File

@@ -2,7 +2,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, sensor
from esphome.const import CONF_ID, ICON_RADIATOR, UNIT_PARTS_PER_MILLION, \
UNIT_PARTS_PER_BILLION, CONF_TEMPERATURE, CONF_HUMIDITY, ICON_PERIODIC_TABLE_CO2
UNIT_PARTS_PER_BILLION, CONF_TEMPERATURE, CONF_HUMIDITY, ICON_MOLECULE_CO2
DEPENDENCIES = ['i2c']
@@ -15,7 +15,7 @@ CONF_BASELINE = 'baseline'
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(CCS811Component),
cv.Required(CONF_ECO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_PERIODIC_TABLE_CO2,
cv.Required(CONF_ECO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_MOLECULE_CO2,
0),
cv.Required(CONF_TVOC): sensor.sensor_schema(UNIT_PARTS_PER_BILLION, ICON_RADIATOR, 0),

View File

@@ -36,5 +36,7 @@ def new_fastled_light(config):
yield light.register_light(var, config)
# https://github.com/FastLED/FastLED/blob/master/library.json
cg.add_library('FastLED', '3.3.3')
# 3.3.3 has an issue on ESP32 with RMT and fastled_clockless:
# https://github.com/esphome/issues/issues/1375
cg.add_library('FastLED', '3.3.2')
yield var

View File

@@ -4,7 +4,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation
from esphome.const import CONF_ID, CONF_TIMEOUT, CONF_ESPHOME, CONF_METHOD, \
CONF_ARDUINO_VERSION, ARDUINO_VERSION_ESP8266_2_5_1, CONF_URL
CONF_ARDUINO_VERSION, ARDUINO_VERSION_ESP8266, CONF_URL
from esphome.core import CORE, Lambda
from esphome.core_config import PLATFORMIO_ESP8266_LUT
@@ -34,7 +34,7 @@ def validate_framework(config):
return config
framework = PLATFORMIO_ESP8266_LUT[version] if version in PLATFORMIO_ESP8266_LUT else version
if framework < ARDUINO_VERSION_ESP8266_2_5_1:
if framework < ARDUINO_VERSION_ESP8266['2.5.1']:
raise cv.Invalid('This component is not supported on arduino framework version below 2.5.1')
return config

View File

@@ -103,10 +103,14 @@ class LightTurnOnTrigger : public Trigger<> {
LightTurnOnTrigger(LightState *a_light) {
a_light->add_new_remote_values_callback([this, a_light]() {
auto is_on = a_light->current_values.is_on();
if (is_on && !last_on_) {
// only trigger when going from off to on
auto should_trigger = is_on && !last_on_;
// Set new state immediately so that trigger() doesn't devolve
// into infinite loop
last_on_ = is_on;
if (should_trigger) {
this->trigger();
}
last_on_ = is_on;
});
last_on_ = a_light->current_values.is_on();
}
@@ -120,10 +124,14 @@ class LightTurnOffTrigger : public Trigger<> {
LightTurnOffTrigger(LightState *a_light) {
a_light->add_new_remote_values_callback([this, a_light]() {
auto is_on = a_light->current_values.is_on();
if (!is_on && last_on_) {
// only trigger when going from on to off
auto should_trigger = !is_on && last_on_;
// Set new state immediately so that trigger() doesn't devolve
// into infinite loop
last_on_ = is_on;
if (should_trigger) {
this->trigger();
}
last_on_ = is_on;
});
last_on_ = a_light->current_values.is_on();
}

View File

@@ -3,7 +3,7 @@ import esphome.config_validation as cv
from esphome import automation
from esphome.automation import maybe_simple_id
from esphome.components import sensor, uart
from esphome.const import CONF_CO2, CONF_ID, CONF_TEMPERATURE, ICON_PERIODIC_TABLE_CO2, \
from esphome.const import CONF_CO2, CONF_ID, CONF_TEMPERATURE, ICON_MOLECULE_CO2, \
UNIT_PARTS_PER_MILLION, UNIT_CELSIUS, ICON_THERMOMETER
DEPENDENCIES = ['uart']
@@ -18,7 +18,7 @@ MHZ19ABCDisableAction = mhz19_ns.class_('MHZ19ABCDisableAction', automation.Acti
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(MHZ19Component),
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_PERIODIC_TABLE_CO2, 0),
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_MOLECULE_CO2, 0),
cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(UNIT_CELSIUS, ICON_THERMOMETER, 0),
cv.Optional(CONF_AUTOMATIC_BASELINE_CALIBRATION): cv.boolean,
}).extend(cv.polling_component_schema('60s')).extend(uart.UART_DEVICE_SCHEMA)

View File

@@ -38,7 +38,7 @@ def do_packages_pass(config: dict):
recursive_package = package_config
if isinstance(package_config, dict):
recursive_package = do_packages_pass(package_config)
config = _merge_package(config, recursive_package)
config = _merge_package(recursive_package, config)
del config[CONF_PACKAGES]
return config

View File

@@ -26,6 +26,10 @@ class PrometheusHandler : public AsyncWebHandler, public Component {
this->base_->init();
this->base_->add_handler(this);
}
float get_setup_priority() const override {
// After WiFi
return setup_priority::WIFI - 1.0f;
}
protected:
#ifdef USE_SENSOR

View File

@@ -3,7 +3,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, sensor
from esphome.const import CONF_ID, UNIT_PARTS_PER_MILLION, \
CONF_HUMIDITY, CONF_TEMPERATURE, ICON_PERIODIC_TABLE_CO2, \
CONF_HUMIDITY, CONF_TEMPERATURE, ICON_MOLECULE_CO2, \
UNIT_CELSIUS, ICON_THERMOMETER, ICON_WATER_PERCENT, UNIT_PERCENT, CONF_CO2
DEPENDENCIES = ['i2c']
@@ -22,7 +22,7 @@ def remove_altitude_suffix(value):
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(SCD30Component),
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION,
ICON_PERIODIC_TABLE_CO2, 0),
ICON_MOLECULE_CO2, 0),
cv.Required(CONF_TEMPERATURE): sensor.sensor_schema(UNIT_CELSIUS, ICON_THERMOMETER, 1),
cv.Required(CONF_HUMIDITY): sensor.sensor_schema(UNIT_PERCENT, ICON_WATER_PERCENT, 1),
cv.Optional(CONF_AUTOMATIC_SELF_CALIBRATION, default=True): cv.boolean,

View File

@@ -1,7 +1,7 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import sensor, uart
from esphome.const import CONF_CO2, CONF_ID, ICON_PERIODIC_TABLE_CO2, UNIT_PARTS_PER_MILLION
from esphome.const import CONF_CO2, CONF_ID, ICON_MOLECULE_CO2, UNIT_PARTS_PER_MILLION
DEPENDENCIES = ['uart']
@@ -10,7 +10,7 @@ SenseAirComponent = senseair_ns.class_('SenseAirComponent', cg.PollingComponent,
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(SenseAirComponent),
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_PERIODIC_TABLE_CO2, 0),
cv.Required(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_MOLECULE_CO2, 0),
}).extend(cv.polling_component_schema('60s')).extend(uart.UART_DEVICE_SCHEMA)

View File

@@ -2,7 +2,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, sensor
from esphome.const import CONF_ID, ICON_RADIATOR, UNIT_PARTS_PER_MILLION, \
UNIT_PARTS_PER_BILLION, ICON_PERIODIC_TABLE_CO2
UNIT_PARTS_PER_BILLION, ICON_MOLECULE_CO2
DEPENDENCIES = ['i2c']
@@ -22,7 +22,7 @@ CONF_TEMPERATURE_SOURCE = 'temperature_source'
CONFIG_SCHEMA = cv.Schema({
cv.GenerateID(): cv.declare_id(SGP30Component),
cv.Required(CONF_ECO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION,
ICON_PERIODIC_TABLE_CO2, 0),
ICON_MOLECULE_CO2, 0),
cv.Required(CONF_TVOC): sensor.sensor_schema(UNIT_PARTS_PER_BILLION, ICON_RADIATOR, 0),
cv.Optional(CONF_BASELINE): cv.Schema({
cv.Required(CONF_ECO2_BASELINE): cv.hex_uint16_t,

View File

@@ -1,6 +1,7 @@
from esphome.components import time as time_
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.core import CORE
from esphome.const import CONF_ID, CONF_SERVERS
@@ -27,3 +28,7 @@ def to_code(config):
yield cg.register_component(var, config)
yield time_.register_time(var, config)
if CORE.is_esp8266 and len(servers) > 1:
# We need LwIP features enabled to get 3 SNTP servers (not just one)
cg.add_build_flag('-DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY')

View File

@@ -24,4 +24,4 @@ def to_code(config):
if CORE.is_esp32:
cg.add_library('FS', None)
# https://github.com/OttoWinter/ESPAsyncWebServer/blob/master/library.json
cg.add_library('ESPAsyncWebServer-esphome', '1.2.6')
cg.add_library('ESPAsyncWebServer-esphome', '1.2.7')

View File

@@ -201,7 +201,26 @@ void WiFiComponent::start_connecting(const WiFiAP &ap, bool two) {
} else {
ESP_LOGV(TAG, " BSSID: Not Set");
}
ESP_LOGV(TAG, " Password: " LOG_SECRET("'%s'"), ap.get_password().c_str());
#ifdef ESPHOME_WIFI_WPA2_EAP
if (ap.get_eap().has_value()) {
ESP_LOGV(TAG, " WPA2 Enterprise authentication configured:");
EAPAuth eap_config = ap.get_eap().value();
ESP_LOGV(TAG, " Identity: " LOG_SECRET("'%s'"), eap_config.identity.c_str());
ESP_LOGV(TAG, " Username: " LOG_SECRET("'%s'"), eap_config.username.c_str());
ESP_LOGV(TAG, " Password: " LOG_SECRET("'%s'"), eap_config.password.c_str());
bool ca_cert_present = eap_config.ca_cert != nullptr && strlen(eap_config.ca_cert);
bool client_cert_present = eap_config.client_cert != nullptr && strlen(eap_config.client_cert);
bool client_key_present = eap_config.client_key != nullptr && strlen(eap_config.client_key);
ESP_LOGV(TAG, " CA Cert: %s", ca_cert_present ? "present" : "not present");
ESP_LOGV(TAG, " Client Cert: %s", client_cert_present ? "present" : "not present");
ESP_LOGV(TAG, " Client Key: %s", client_key_present ? "present" : "not present");
} else {
#endif
ESP_LOGV(TAG, " Password: " LOG_SECRET("'%s'"), ap.get_password().c_str());
#ifdef ESPHOME_WIFI_WPA2_EAP
}
#endif
if (ap.get_channel().has_value()) {
ESP_LOGV(TAG, " Channel: %u", *ap.get_channel());
} else {
@@ -400,9 +419,17 @@ void WiFiComponent::check_scanning_finished() {
connect_params.set_channel(scan_res.get_channel());
connect_params.set_bssid(scan_res.get_bssid());
}
// set manual IP+password (if any)
// copy manual IP (if set)
connect_params.set_manual_ip(config.get_manual_ip());
#ifdef ESPHOME_WIFI_WPA2_EAP
// copy EAP parameters (if set)
connect_params.set_eap(config.get_eap());
#endif
// copy password (if set)
connect_params.set_password(config.get_password());
break;
}
@@ -576,9 +603,21 @@ bool WiFiScanResult::matches(const WiFiAP &config) {
// If BSSID configured, only match for correct BSSIDs
if (config.get_bssid().has_value() && *config.get_bssid() != this->bssid_)
return false;
// If PW given, only match for networks with auth (and vice versa)
#ifdef ESPHOME_WIFI_WPA2_EAP
// BSSID requires auth but no PSK or EAP credentials given
if (this->with_auth_ && (config.get_password().empty() && !config.get_eap().has_value()))
return false;
// BSSID does not require auth, but PSK or EAP credentials given
if (!this->with_auth_ && (!config.get_password().empty() || config.get_eap().has_value()))
return false;
#else
// If PSK given, only match for networks with auth (and vice versa)
if (config.get_password().empty() == this->with_auth_)
return false;
#endif
// If channel configured, only match networks on that channel.
if (config.get_channel().has_value() && *config.get_channel() != this->channel_) {
return false;

View File

@@ -391,6 +391,18 @@ void WiFiComponent::wifi_event_callback_(system_event_id_t event, system_event_i
auto it = info.auth_change;
ESP_LOGV(TAG, "Event: Authmode Change old=%s new=%s", get_auth_mode_str(it.old_mode),
get_auth_mode_str(it.new_mode));
// Mitigate CVE-2020-12638
// https://lbsfilm.at/blog/wpa2-authenticationmode-downgrade-in-espressif-microprocessors
if (it.old_mode != WIFI_AUTH_OPEN && it.new_mode == WIFI_AUTH_OPEN) {
ESP_LOGW(TAG, "Potential Authmode downgrade detected, disconnecting...");
// we can't call retry_connect() from this context, so disconnect immediately
// and notify main thread with error_from_callback_
err_t err = esp_wifi_disconnect();
if (err != ESP_OK) {
ESP_LOGW(TAG, "Disconnect failed: %s", esp_err_to_name(err));
}
this->error_from_callback_ = true;
}
break;
}
case SYSTEM_EVENT_STA_GOT_IP: {

View File

@@ -220,6 +220,7 @@ bool WiFiComponent::wifi_sta_connect_(WiFiAP ap) {
if (ap.get_password().empty()) {
conf.threshold.authmode = AUTH_OPEN;
} else {
// Only allow auth modes with at least WPA
conf.threshold.authmode = AUTH_WPA_PSK;
}
conf.threshold.rssi = -127;
@@ -399,6 +400,15 @@ void WiFiComponent::wifi_event_callback(System_Event_t *event) {
auto it = event->event_info.auth_change;
ESP_LOGV(TAG, "Event: Changed AuthMode old=%s new=%s", get_auth_mode_str(it.old_mode),
get_auth_mode_str(it.new_mode));
// Mitigate CVE-2020-12638
// https://lbsfilm.at/blog/wpa2-authenticationmode-downgrade-in-espressif-microprocessors
if (it.old_mode != AUTH_OPEN && it.new_mode == AUTH_OPEN) {
ESP_LOGW(TAG, "Potential Authmode downgrade detected, disconnecting...");
// we can't call retry_connect() from this context, so disconnect immediately
// and notify main thread with error_from_callback_
wifi_station_disconnect();
global_wifi_component->error_from_callback_ = true;
}
break;
}
case EVENT_STAMODE_GOT_IP: {

View File

@@ -5,7 +5,7 @@ from esphome.components import sensor
from esphome.const import CONF_ID, CONF_CLOCK_PIN, CONF_DATA_PIN, \
CONF_CO2, CONF_TEMPERATURE, CONF_HUMIDITY, \
UNIT_PARTS_PER_MILLION, UNIT_CELSIUS, UNIT_PERCENT, \
ICON_PERIODIC_TABLE_CO2, ICON_THERMOMETER, ICON_WATER_PERCENT
ICON_MOLECULE_CO2, ICON_THERMOMETER, ICON_WATER_PERCENT
from esphome.cpp_helpers import gpio_pin_expression
zyaura_ns = cg.esphome_ns.namespace('zyaura')
@@ -17,7 +17,7 @@ CONFIG_SCHEMA = cv.Schema({
pins.validate_has_interrupt),
cv.Required(CONF_DATA_PIN): cv.All(pins.internal_gpio_input_pin_schema,
pins.validate_has_interrupt),
cv.Optional(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_PERIODIC_TABLE_CO2, 0),
cv.Optional(CONF_CO2): sensor.sensor_schema(UNIT_PARTS_PER_MILLION, ICON_MOLECULE_CO2, 0),
cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(UNIT_CELSIUS, ICON_THERMOMETER, 1),
cv.Optional(CONF_HUMIDITY): sensor.sensor_schema(UNIT_PERCENT, ICON_WATER_PERCENT, 1),
}).extend(cv.polling_component_schema('60s'))

View File

@@ -2,7 +2,7 @@
MAJOR_VERSION = 1
MINOR_VERSION = 15
PATCH_VERSION = '0b1'
PATCH_VERSION = '0b3'
__short_version__ = f'{MAJOR_VERSION}.{MINOR_VERSION}'
__version__ = f'{__short_version__}.{PATCH_VERSION}'
@@ -11,17 +11,34 @@ ESP_PLATFORM_ESP8266 = 'ESP8266'
ESP_PLATFORMS = [ESP_PLATFORM_ESP32, ESP_PLATFORM_ESP8266]
ALLOWED_NAME_CHARS = 'abcdefghijklmnopqrstuvwxyz0123456789_'
ARDUINO_VERSION_ESP32_DEV = 'https://github.com/platformio/platform-espressif32.git'
ARDUINO_VERSION_ESP32_1_0_0 = 'espressif32@1.5.0'
ARDUINO_VERSION_ESP32_1_0_1 = 'espressif32@1.6.0'
ARDUINO_VERSION_ESP32_1_0_2 = 'espressif32@1.9.0'
ARDUINO_VERSION_ESP32_1_0_3 = 'espressif32@1.10.0'
ARDUINO_VERSION_ESP32_1_0_4 = 'espressif32@1.11.0'
ARDUINO_VERSION_ESP8266_DEV = 'https://github.com/platformio/platform-espressif8266.git'
ARDUINO_VERSION_ESP8266_2_5_0 = 'espressif8266@2.0.1'
ARDUINO_VERSION_ESP8266_2_5_1 = 'espressif8266@2.1.0'
ARDUINO_VERSION_ESP8266_2_5_2 = 'espressif8266@2.2.3'
ARDUINO_VERSION_ESP8266_2_3_0 = 'espressif8266@1.5.0'
# Lookup table from ESP32 arduino framework version to latest platformio
# package with that version
# See also https://github.com/platformio/platform-espressif32/releases
ARDUINO_VERSION_ESP32 = {
'dev': 'https://github.com/platformio/platform-espressif32.git',
'1.0.4': 'espressif32@1.12.4',
'1.0.3': 'espressif32@1.10.0',
'1.0.2': 'espressif32@1.9.0',
'1.0.1': 'espressif32@1.7.0',
'1.0.0': 'espressif32@1.5.0',
}
# See also https://github.com/platformio/platform-espressif8266/releases
ARDUINO_VERSION_ESP8266 = {
'dev': 'https://github.com/platformio/platform-espressif8266.git',
'2.7.2': 'espressif8266@2.6.0',
'2.7.1': 'espressif8266@2.5.3',
'2.7.0': 'espressif8266@2.5.0',
'2.6.3': 'espressif8266@2.4.0',
'2.6.2': 'espressif8266@2.3.1',
'2.6.1': 'espressif8266@2.3.0',
'2.5.2': 'espressif8266@2.2.3',
'2.5.1': 'espressif8266@2.1.1',
'2.5.0': 'espressif8266@2.0.4',
'2.4.2': 'espressif8266@1.8.0',
'2.4.1': 'espressif8266@1.7.3',
'2.4.0': 'espressif8266@1.6.0',
'2.3.0': 'espressif8266@1.5.0',
}
SOURCE_FILE_EXTENSIONS = {'.cpp', '.hpp', '.h', '.c', '.tcc', '.ino'}
HEADER_FILE_EXTENSIONS = {'.h', '.hpp', '.tcc'}
@@ -570,10 +587,10 @@ ICON_GAS_CYLINDER = 'mdi:gas-cylinder'
ICON_GAUGE = 'mdi:gauge'
ICON_LIGHTBULB = 'mdi:lightbulb'
ICON_MAGNET = 'mdi:magnet'
ICON_MOLECULE_CO2 = 'mdi:molecule-co2'
ICON_MOTION_SENSOR = 'mdi:motion-sensor'
ICON_NEW_BOX = 'mdi:new-box'
ICON_PERCENT = 'mdi:percent'
ICON_PERIODIC_TABLE_CO2 = 'mdi:periodic-table-co2'
ICON_POWER = 'mdi:power'
ICON_PULSE = 'mdi:pulse'
ICON_RADIATOR = 'mdi:radiator'

View File

@@ -5,17 +5,14 @@ import re
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation, pins
from esphome.const import ARDUINO_VERSION_ESP32_DEV, ARDUINO_VERSION_ESP8266_DEV, \
CONF_ARDUINO_VERSION, CONF_BOARD, CONF_BOARD_FLASH_MODE, CONF_BUILD_PATH, \
CONF_COMMENT, CONF_ESPHOME, CONF_INCLUDES, CONF_LIBRARIES, \
from esphome.const import CONF_ARDUINO_VERSION, CONF_BOARD, CONF_BOARD_FLASH_MODE, \
CONF_BUILD_PATH, CONF_COMMENT, CONF_ESPHOME, CONF_INCLUDES, CONF_LIBRARIES, \
CONF_NAME, CONF_ON_BOOT, CONF_ON_LOOP, CONF_ON_SHUTDOWN, CONF_PLATFORM, \
CONF_PLATFORMIO_OPTIONS, CONF_PRIORITY, CONF_TRIGGER_ID, \
CONF_ESP8266_RESTORE_FROM_FLASH, ARDUINO_VERSION_ESP8266_2_3_0, \
ARDUINO_VERSION_ESP8266_2_5_0, ARDUINO_VERSION_ESP8266_2_5_1, ARDUINO_VERSION_ESP8266_2_5_2, \
ESP_PLATFORMS
CONF_ESP8266_RESTORE_FROM_FLASH, ARDUINO_VERSION_ESP8266, \
ARDUINO_VERSION_ESP32, ESP_PLATFORMS
from esphome.core import CORE, coroutine_with_priority
from esphome.helpers import copy_file_if_changed, walk_files
from esphome.pins import ESP8266_FLASH_SIZES, ESP8266_LD_SCRIPTS
_LOGGER = logging.getLogger(__name__)
@@ -46,33 +43,17 @@ def validate_board(value):
validate_platform = cv.one_of(*ESP_PLATFORMS, upper=True)
PLATFORMIO_ESP8266_LUT = {
'2.7.2': 'espressif8266@2.6.0',
'2.7.1': 'espressif8266@2.5.1',
'2.7.0': 'espressif8266@2.5.0',
'2.6.3': 'espressif8266@2.4.0',
'2.6.2': 'espressif8266@2.3.1',
'2.6.1': 'espressif8266@2.3.0',
'2.5.2': 'espressif8266@2.2.3',
'2.5.1': 'espressif8266@2.1.0',
'2.5.0': 'espressif8266@2.0.1',
'2.4.2': 'espressif8266@1.8.0',
'2.4.1': 'espressif8266@1.7.3',
'2.4.0': 'espressif8266@1.6.0',
'2.3.0': 'espressif8266@1.5.0',
'RECOMMENDED': 'espressif8266@2.2.3',
**ARDUINO_VERSION_ESP8266,
'RECOMMENDED': ARDUINO_VERSION_ESP8266['2.7.2'],
'LATEST': 'espressif8266',
'DEV': ARDUINO_VERSION_ESP8266_DEV,
'DEV': ARDUINO_VERSION_ESP8266['dev'],
}
PLATFORMIO_ESP32_LUT = {
'1.0.0': 'espressif32@1.4.0',
'1.0.1': 'espressif32@1.6.0',
'1.0.2': 'espressif32@1.9.0',
'1.0.3': 'espressif32@1.10.0',
'1.0.4': 'espressif32@1.12.4',
'RECOMMENDED': 'espressif32@1.12.1',
**ARDUINO_VERSION_ESP32,
'RECOMMENDED': ARDUINO_VERSION_ESP32['1.0.4'],
'LATEST': 'espressif32',
'DEV': ARDUINO_VERSION_ESP32_DEV,
'DEV': ARDUINO_VERSION_ESP32['dev'],
}
@@ -208,6 +189,26 @@ def add_includes(includes):
include_file(path, basename)
@coroutine_with_priority(-1000.0)
def _esp8266_add_lwip_type():
# If any component has already set this, do not change it
if any(flag.startswith('-DPIO_FRAMEWORK_ARDUINO_LWIP2_') for flag in CORE.build_flags):
return
# Default for platformio is LWIP2_LOW_MEMORY with:
# - MSS=536
# - LWIP_FEATURES enabled
# - this only adds some optional features like IP incoming packet reassembly and NAPT
# see also:
# https://github.com/esp8266/Arduino/blob/master/tools/sdk/lwip2/include/lwipopts.h
# Instead we use LWIP2_HIGHER_BANDWIDTH_LOW_FLASH with:
# - MSS=1460
# - LWIP_FEATURES disabled (because we don't need them)
# Other projects like Tasmota & ESPEasy also use this
cg.add_build_flag('-DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH')
@coroutine_with_priority(100.0)
def to_code(config):
cg.add_global(cg.global_ns.namespace('esphome').using)
@@ -228,22 +229,9 @@ def to_code(config):
yield cg.register_component(trigger, conf)
yield automation.build_automation(trigger, [], conf)
# Build flags
if CORE.is_esp8266 and CORE.board in ESP8266_FLASH_SIZES and \
CORE.arduino_version != ARDUINO_VERSION_ESP8266_2_3_0:
flash_size = ESP8266_FLASH_SIZES[CORE.board]
ld_scripts = ESP8266_LD_SCRIPTS[flash_size]
ld_script = None
if CORE.arduino_version in ('espressif8266@1.8.0', 'espressif8266@1.7.3',
'espressif8266@1.6.0'):
ld_script = ld_scripts[0]
elif CORE.arduino_version in (ARDUINO_VERSION_ESP8266_DEV, ARDUINO_VERSION_ESP8266_2_5_0,
ARDUINO_VERSION_ESP8266_2_5_1, ARDUINO_VERSION_ESP8266_2_5_2):
ld_script = ld_scripts[1]
if ld_script is not None:
cg.add_build_flag(f'-Wl,-T{ld_script}')
# Set LWIP build constants for ESP8266
if CORE.is_esp8266:
CORE.add_job(_esp8266_add_lwip_type)
cg.add_build_flag('-fno-exceptions')

View File

@@ -4,11 +4,12 @@ import re
from esphome.config import iter_components
from esphome.const import CONF_BOARD_FLASH_MODE, CONF_ESPHOME, CONF_PLATFORMIO_OPTIONS, \
HEADER_FILE_EXTENSIONS, SOURCE_FILE_EXTENSIONS, __version__
HEADER_FILE_EXTENSIONS, SOURCE_FILE_EXTENSIONS, __version__, ARDUINO_VERSION_ESP8266
from esphome.core import CORE, EsphomeError
from esphome.helpers import mkdir_p, read_file, write_file_if_changed, walk_files, \
copy_file_if_changed
from esphome.storage_json import StorageJSON, storage_path
from esphome.pins import ESP8266_FLASH_SIZES, ESP8266_LD_SCRIPTS
_LOGGER = logging.getLogger(__name__)
@@ -213,6 +214,28 @@ def get_ini_content():
flash_mode = CORE.config[CONF_ESPHOME][CONF_BOARD_FLASH_MODE]
data['board_build.flash_mode'] = flash_mode
# Build flags
if CORE.is_esp8266 and CORE.board in ESP8266_FLASH_SIZES:
flash_size = ESP8266_FLASH_SIZES[CORE.board]
ld_scripts = ESP8266_LD_SCRIPTS[flash_size]
versions_with_old_ldscripts = [
ARDUINO_VERSION_ESP8266['2.4.0'],
ARDUINO_VERSION_ESP8266['2.4.1'],
ARDUINO_VERSION_ESP8266['2.4.2'],
]
if CORE.arduino_version == ARDUINO_VERSION_ESP8266['2.3.0']:
# No ld script support
ld_script = None
if CORE.arduino_version in versions_with_old_ldscripts:
# Old ld script path
ld_script = ld_scripts[0]
else:
ld_script = ld_scripts[1]
if ld_script is not None:
data['board_build.ldscript'] = ld_script
# Ignore libraries that are not explicitly used, but may
# be added by LDF
# data['lib_ldf_mode'] = 'chain'

View File

@@ -13,8 +13,8 @@ lib_deps =
AsyncTCP-esphome@1.1.1
AsyncMqttClient-esphome@0.8.4
ArduinoJson-esphomelib@5.13.3
ESPAsyncWebServer-esphome@1.2.6
FastLED@3.3.3
ESPAsyncWebServer-esphome@1.2.7
FastLED@3.3.2
NeoPixelBus-esphome@2.5.7
ESPAsyncTCP-esphome@1.2.2
1655@1.0.2 ; TinyGPSPlus (has name conflict)
@@ -44,7 +44,7 @@ build_flags = ${common.build_flags}
src_filter = ${common.src_filter} +<tests/livingroom8266.cpp>
[env:livingroom32]
platform = espressif32@1.12.1
platform = espressif32@1.12.4
board = nodemcu-32s
framework = arduino
lib_deps = ${common.lib_deps}