8000 2021.12.0b4 by jesserockz · Pull Request #2890 · esphome/esphome · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

2021.12.0b4 #2890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions esphome/components/ota/ota_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ bool OTAComponent::readall_(uint8_t *buf, size_t len) {
ssize_t read = this->client_->read(buf + at, len - at);
if (read == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
App.feed_wdt();
delay(1);
continue;
}
Expand All @@ -383,6 +384,7 @@ bool OTAComponent::readall_(uint8_t *buf, size_t len) {
} else {
at += read;
}
App.feed_wdt();
delay(1);
}

Expand All @@ -401,6 +403,7 @@ bool OTAComponent::writeall_(const uint8_t *buf, size_t len) {
ssize_t written = this->client_->write(buf + at, len - at);
if (written == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
App.feed_wdt();
delay(1);
continue;
}
Expand All @@ -409,6 +412,7 @@ bool OTAComponent::writeall_(const uint8_t *buf, size_t len) {
} else {
at += written;
}
App.feed_wdt();
delay(1);
}
return true;
Expand Down
2 changes: 1 addition & 1 deletion esphome/const.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Constants used by esphome."""

__version__ = "2021.12.0b3"
__version__ = "2021.12.0b4"

ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"

Expand Down
24 changes: 22 additions & 2 deletions esphome/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,28 @@

BASE_CONFIG = """esphome:
name: {name}
platform: {platform}
board: {board}
"""

LOGGER_API_CONFIG = """
# Enable logging
logger:

# Enable Home Assistant API
api:
"""

ESP8266_CONFIG = """
esp8266:
board: {board}
"""

ESP32_CONFIG = """
esp32:
board: {board}
framework:
type: arduino
"""


def sanitize_double_quotes(value):
return value.replace("\\", "\\\\").replace('"', '\\"')
Expand All @@ -71,6 +83,14 @@ def wizard_file(**kwargs):

config = BASE_CONFIG.format(**kwargs)

config += (
ESP8266_CONFIG.format(**kwargs)
if kwargs["platform"] == "ESP8266"
else ESP32_CONFIG.format(**kwargs)
)

config += LOGGER_API_CONFIG

# Configure API
if "password" in kwargs:
config += f" password: \"{kwargs['password']}\"\n"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pyserial==3.5
platformio==5.2.2 # When updating platformio, also update Dockerfile
esptool==3.2
click==8.0.3
esphome-dashboard==20211207.0
esphome-dashboard==20211208.0
aioesphomeapi==10.6.0
zeroconf==0.36.13

Expand Down
9 changes: 5 additions & 4 deletions tests/unit_tests/test_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def default_config():
return {
"name": "test-name",
"platform": "test_platform",
"board": "test_board",
"board": "esp01_1m",
"ssid": "test_ssid",
"psk": "test_psk",
"password": "",
Expand Down Expand Up @@ -105,14 +105,15 @@ def test_wizard_write_sets_platform(default_config, tmp_path, monkeypatch):
If the platform is not explicitly set, use "ESP8266" if the board is one of the ESP8266 boards
"""
# Given
del default_config["platform"]
monkeypatch.setattr(wz, "write_file", MagicMock())

# When
wz.wizard_write(tmp_path, **default_config)

# Then
generated_config = wz.write_file.call_args.args[1]
assert f"platform: {default_config['platform']}" in generated_config
assert "esp8266:" in generated_config


def test_wizard_write_defaults_platform_from_board_esp8266(
Expand All @@ -132,7 +133,7 @@ def test_wizard_write_defaults_platform_from_board_esp8266(

# Then
generated_config = wz.write_file.call_args.args[1]
assert "platform: ESP8266" in generated_config
assert "esp8266:" in generated_config


def test_wizard_write_defaults_platform_from_board_esp32(
Expand All @@ -152,7 +153,7 @@ def test_wizard_write_defaults_platform_from_board_esp32(

# Then
generated_config = wz.write_file.call_args.args[1]
assert "platform: ESP32" in generated_config
assert "esp32:" in generated_config


def test_safe_print_step_prints_step_number_and_description(monkeypatch):
Expand Down
0