Compare commits

...

38 Commits

Author SHA1 Message Date
Jesse Hills
40523e6823 Merge pull request #5465 from esphome/bump-2023.9.2
2023.9.2
2023-10-02 21:24:01 +13:00
Jesse Hills
5e1472185c Bump version to 2023.9.2 2023-10-02 17:01:22 +13:00
Jesse Hills
af005a6554 Ensure esphome directory exists on addon startup (#5464) 2023-10-02 17:01:22 +13:00
Angel Nunez Mencias
efd31be21c Fix SPI support for second bus on 2023.9.1 (#5456) 2023-10-02 17:01:22 +13:00
Avri Chen-Roth
e9bda2810f Fix an Issue with IR Remote Climate and Whirlpool protocol toggle (#5447)
Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2023-10-02 17:01:22 +13:00
Clyde Stubbs
ec4777b8d0 SPI fixes for buggy components (#5446) 2023-10-02 17:01:22 +13:00
Jesse Hills
9b75121337 Merge pull request #5442 from esphome/bump-2023.9.1
2023.9.1
2023-09-28 13:05:04 +13:00
Jesse Hills
d262548d2e Bump version to 2023.9.1 2023-09-28 11:52:35 +13:00
Jesse Hills
b5b654e054 Migrate dashboard json files to /data folder instead of wiping out (#5441) 2023-09-28 11:52:35 +13:00
Marc J
dae8ab563c Tuya Number Scaling by step value (#5108) 2023-09-28 11:52:35 +13:00
Jesse Hills
5751e9ec59 Merge pull request #5435 from esphome/bump-2023.9.0
2023.9.0
2023-09-27 17:19:58 +13:00
Jesse Hills
cc1b7a7a56 Bump version to 2023.9.0 2023-09-27 16:21:35 +13:00
Jesse Hills
29249cdc1b Merge pull request #5434 from esphome/bump-2023.9.0b4
2023.9.0b4
2023-09-27 13:34:33 +13:00
Jesse Hills
e5bae8187f Bump version to 2023.9.0b4 2023-09-27 12:28:12 +13:00
Clyde Stubbs
69adebfefa Fix #4896 and #4903 (#5433) 2023-09-27 12:28:12 +13:00
Guillermo Ruffino
7dabbb65d0 Wireguard keepalive remove uint16 type (#5430) 2023-09-27 12:28:11 +13:00
Kuba Szczodrzyński
b30bab8c1b LibreTiny: enable MQTT, bump to v1.4.1 (#5419) 2023-09-27 12:28:11 +13:00
Jesse Hills
0a1ed58454 Merge pull request #5426 from esphome/bump-2023.9.0b3
2023.9.0b3
2023-09-25 16:15:14 +13:00
Jesse Hills
5f5ee9c920 Bump version to 2023.9.0b3 2023-09-25 12:10:35 +13:00
dependabot[bot]
0aeebdd289 Bump zeroconf from 0.108.0 to 0.112.0 (#5392)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-25 12:10:35 +13:00
Odd Stråbø
33e2aa341e dallas: limit addresses to 64 bits (#5413) 2023-09-25 12:10:35 +13:00
Ilia Sotnikov
a42788812e [RP2040W] Fix WiFi bootloop upon LibreTiny support (#5414) 2023-09-25 12:10:35 +13:00
Clyde Stubbs
b07a038bc8 Fix SPI inverted clock on ESP8266 (#5416) 2023-09-25 12:10:34 +13:00
Jesse Hills
55e36ab982 Merge pull request #5412 from esphome/bump-2023.9.0b2
2023.9.0b2
2023-09-21 12:52:21 +12:00
Jesse Hills
90835ab917 Bump version to 2023.9.0b2 2023-09-21 10:35:38 +12:00
Samuel Sieb
5b46088ae4 support keypads with pulldowns (#5404)
Co-authored-by: Samuel Sieb <samuel@sieb.net>
2023-09-21 10:35:38 +12:00
Kuba Szczodrzyński
d7e267eca5 Wizard: fix colored text in input prompts (#5313) 2023-09-21 10:35:38 +12:00
Trent Houliston
807c47a076 Make the pulse meter timeout on startup when no pulses are received (#5388) 2023-09-21 10:35:38 +12:00
Kevin P. Fleming
7ebe6a5894 http_request: Cleanups and safety improvements (#5360) 2023-09-21 10:35:37 +12:00
Anthony
41c829fa32 Remove Wi-Fi dependency from Midea component (#5394) 2023-09-21 10:35:37 +12:00
Joris S
8f1ce8c7f7 Climate preset fix (#5407) 2023-09-21 10:35:37 +12:00
Samuel Sieb
e55636ed52 fix handling of web server version (#5405)
Co-authored-by: Samuel Sieb <samuel@sieb.net>
2023-09-21 10:35:37 +12:00
Samuel Sieb
e886262055 fix disabled wifi power on 8266 (#5409)
Co-authored-by: Samuel Sieb <samuel@sieb.net>
2023-09-21 10:35:37 +12:00
Philipp Helo Rehs
2fa7f8c511 Add E-Trailer Gaslevel support to Mopeka Std Check (#5397)
* Add E-Trailer Gaslevel support to Mopeka Std Check

Signed-off-by: Philipp Helo Rehs <Philipp.Rehs@hhu.de>

* fix format

---------

Signed-off-by: Philipp Helo Rehs <Philipp.Rehs@hhu.de>
Co-authored-by: Philipp Helo Rehs <Philipp.Rehs@hhu.de>
2023-09-21 10:35:37 +12:00
Trevor North
4622ef770d Add shelly-dimmer-stm32 51.7 to known versions (#5400)
This version removes support for no-neutral setups in favor of fixing flickering some users have experienced.
2023-09-21 10:35:37 +12:00
rmmacias
d76f18b4f2 Update radon_eye_listener.cpp (#5401)
New devices identifiers do not star by the hardcoded string. FR:RE222 is the 8-char length string of my devices bought in 2023. This proposal aims at solve the topic by making the detection track devices starting only by FR:R
2023-09-21 10:35:37 +12:00
phoenixswiss
ec20778d83 Fix Waveshare 7.5v2 epaper screens are always powered on (#5283) 2023-09-21 10:35:37 +12:00
Michael Hansen
b3ca71c6fb Add patch to apt install (#5389) 2023-09-21 10:35:37 +12:00
45 changed files with 331 additions and 99 deletions

View File

@@ -131,7 +131,7 @@ esphome/components/i2s_audio/* @jesserockz
esphome/components/i2s_audio/media_player/* @jesserockz
esphome/components/i2s_audio/microphone/* @jesserockz
esphome/components/i2s_audio/speaker/* @jesserockz
esphome/components/ili9xxx/* @nielsnl68
esphome/components/ili9xxx/* @clydebarrow @nielsnl68
esphome/components/improv_base/* @esphome/core
esphome/components/improv_serial/* @esphome/core
esphome/components/ina260/* @mreditor97
@@ -270,7 +270,7 @@ esphome/components/sn74hc165/* @jesserockz
esphome/components/socket/* @esphome/core
esphome/components/sonoff_d1/* @anatoly-savchenkov
esphome/components/speaker/* @jesserockz
esphome/components/spi/* @esphome/core
esphome/components/spi/* @clydebarrow @esphome/core
esphome/components/spi_device/* @clydebarrow
esphome/components/spi_led_strip/* @clydebarrow
esphome/components/sprinkler/* @kbx81

View File

@@ -29,7 +29,8 @@ RUN \
curl=7.74.0-1.3+deb11u7 \
openssh-client=1:8.4p1-5+deb11u1 \
python3-cffi=1.14.5-1 \
libcairo2=1.16.0-5; \
libcairo2=1.16.0-5 \
patch=2.7.6-7; \
if [ "$TARGETARCH$TARGETVARIANT" = "armv7" ]; then \
apt-get install -y --no-install-recommends \
build-essential=12.9 \

View File

@@ -41,8 +41,15 @@ fi
mkdir -p "${pio_cache_base}"
mkdir -p /config/esphome
if bashio::fs.directory_exists '/config/esphome/.esphome'; then
bashio::log.info "Removing old .esphome directory..."
bashio::log.info "Migrating old .esphome directory..."
if bashio::fs.file_exists '/config/esphome/.esphome/esphome.json'; then
mv /config/esphome/.esphome/esphome.json /data/esphome.json
fi
mkdir -p "/data/storage"
mv /config/esphome/.esphome/*.json /data/storage/ || true
rm -rf /config/esphome/.esphome
fi

View File

@@ -24,7 +24,7 @@ CONFIG_SCHEMA = cv.All(
).extend(
{
cv.GenerateID(CONF_DALLAS_ID): cv.use_id(DallasComponent),
cv.Optional(CONF_ADDRESS): cv.hex_int,
cv.Optional(CONF_ADDRESS): cv.hex_uint64_t,
cv.Optional(CONF_INDEX): cv.positive_int,
cv.Optional(CONF_RESOLUTION, default=12): cv.int_range(min=9, max=12),
}

View File

@@ -80,8 +80,6 @@ template<typename... Ts> class HttpRequestSendAction : public Action<Ts...> {
TEMPLATABLE_VALUE(std::string, url)
TEMPLATABLE_VALUE(const char *, method)
TEMPLATABLE_VALUE(std::string, body)
TEMPLATABLE_VALUE(const char *, useragent)
TEMPLATABLE_VALUE(uint16_t, timeout)
void add_header(const char *key, TemplatableValue<const char *, Ts...> value) { this->headers_.insert({key, value}); }
@@ -105,25 +103,18 @@ template<typename... Ts> class HttpRequestSendAction : public Action<Ts...> {
auto f = std::bind(&HttpRequestSendAction<Ts...>::encode_json_func_, this, x..., std::placeholders::_1);
this->parent_->set_body(json::build_json(f));
}
if (this->useragent_.has_value()) {
this->parent_->set_useragent(this->useragent_.value(x...));
}
if (this->timeout_.has_value()) {
this->parent_->set_timeout(this->timeout_.value(x...));
}
if (!this->headers_.empty()) {
std::list<Header> headers;
for (const auto &item : this->headers_) {
auto val = item.second;
Header header;
header.name = item.first;
header.value = val.value(x...);
headers.push_back(header);
}
this->parent_->set_headers(headers);
std::list<Header> headers;
for (const auto &item : this->headers_) {
auto val = item.second;
Header header;
header.name = item.first;
header.value = val.value(x...);
headers.push_back(header);
}
this->parent_->set_headers(headers);
this->parent_->send(this->response_triggers_);
this->parent_->close();
this->parent_->set_body("");
}
protected:

View File

@@ -25,7 +25,7 @@ def AUTO_LOAD():
return []
CODEOWNERS = ["@nielsnl68"]
CODEOWNERS = ["@nielsnl68", "@clydebarrow"]
ili9XXX_ns = cg.esphome_ns.namespace("ili9xxx")
ili9XXXSPI = ili9XXX_ns.class_(
@@ -42,6 +42,7 @@ MODELS = {
"ILI9341": ili9XXX_ns.class_("ILI9XXXILI9341", ili9XXXSPI),
"ILI9342": ili9XXX_ns.class_("ILI9XXXILI9342", ili9XXXSPI),
"ILI9481": ili9XXX_ns.class_("ILI9XXXILI9481", ili9XXXSPI),
"ILI9481-18": ili9XXX_ns.class_("ILI9XXXILI948118", ili9XXXSPI),
"ILI9486": ili9XXX_ns.class_("ILI9XXXILI9486", ili9XXXSPI),
"ILI9488": ili9XXX_ns.class_("ILI9XXXILI9488", ili9XXXSPI),
"ILI9488_A": ili9XXX_ns.class_("ILI9XXXILI9488A", ili9XXXSPI),
@@ -140,8 +141,6 @@ async def to_code(config):
rhs = []
for x in range(256):
rhs.extend([HexInt(x), HexInt(x), HexInt(x)])
prog_arr = cg.progmem_array(config[CONF_RAW_DATA_ID], rhs)
cg.add(var.set_palette(prog_arr))
elif config[CONF_COLOR_PALETTE] == "IMAGE_ADAPTIVE":
cg.add(var.set_buffer_color_mode(ILI9XXXColorMode.BITS_8_INDEXED))
from PIL import Image
@@ -178,6 +177,4 @@ async def to_code(config):
if rhs is not None:
prog_arr = cg.progmem_array(config[CONF_RAW_DATA_ID], rhs)
cg.add(var.set_palette(prog_arr))
spi_data_rate = str(spi.SPI_DATA_RATE_OPTIONS[config[CONF_DATA_RATE]])
cg.add_define("ILI9XXXDisplay_DATA_RATE", cg.RawExpression(spi_data_rate))
cg.add(var.set_data_rate(config[CONF_DATA_RATE]))

View File

@@ -59,6 +59,7 @@ void ILI9XXXDisplay::dump_config() {
if (this->is_18bitdisplay_) {
ESP_LOGCONFIG(TAG, " 18-Bit Mode: YES");
}
ESP_LOGCONFIG(TAG, " Data rate: %dMHz", (unsigned) (this->data_rate_ / 1000000));
LOG_PIN(" Reset Pin: ", this->reset_pin_);
LOG_PIN(" DC Pin: ", this->dc_pin_);
@@ -387,6 +388,17 @@ void ILI9XXXILI9481::initialize() {
}
}
void ILI9XXXILI948118::initialize() {
this->init_lcd_(INITCMD_ILI9481_18);
if (this->width_ == 0) {
this->width_ = 320;
}
if (this->height_ == 0) {
this->height_ = 480;
}
this->is_18bitdisplay_ = true;
}
// 35_TFT display
void ILI9XXXILI9486::initialize() {
this->init_lcd_(INITCMD_ILI9486);

View File

@@ -120,6 +120,12 @@ class ILI9XXXILI9481 : public ILI9XXXDisplay {
void initialize() override;
};
//----------- ILI9481 in 18 bit mode --------------
class ILI9XXXILI948118 : public ILI9XXXDisplay {
protected:
void initialize() override;
};
//----------- ILI9XXX_35_TFT rotated display --------------
class ILI9XXXILI9486 : public ILI9XXXDisplay {
protected:

View File

@@ -94,12 +94,36 @@ static const uint8_t PROGMEM INITCMD_ILI9481[] = {
ILI9XXX_IFCTR , 1, 0x83,
ILI9XXX_GMCTR ,12, 0x00, 0x26, 0x21, 0x00, 0x00, 0x1F, 0x65, 0x23, 0x77, 0x00, 0x0F, 0x00,
ILI9XXX_IFMODE , 1, 0x00, // CommandAccessProtect
ILI9XXX_PTLAR , 4, 0, 0, 1, 0xDF,
0xE4 , 1, 0xA0,
ILI9XXX_MADCTL , 1, MADCTL_MV | MADCTL_BGR, // Memory Access Control
ILI9XXX_CSCON , 1, 0x01,
ILI9XXX_PIXFMT, 1, 0x55, // 16 bit mode
ILI9XXX_INVON, 0,
ILI9XXX_DISPON, 0x80, // Set display on
0x00 // end
};
static const uint8_t PROGMEM INITCMD_ILI9481_18[] = {
ILI9XXX_SLPOUT , 0x80, // Exit sleep mode
ILI9XXX_PWSET , 3, 0x07, 0x41, 0x1D,
ILI9XXX_VMCTR , 3, 0x00, 0x1C, 0x1F,
ILI9XXX_PWSETN , 2, 0x01, 0x11,
ILI9XXX_PWCTR1 , 5, 0x10, 0x3B, 0x00, 0x02, 0x11,
ILI9XXX_VMCTR1 , 1, 0x03,
ILI9XXX_IFCTR , 1, 0x83,
ILI9XXX_GMCTR ,12, 0x00, 0x26, 0x21, 0x00, 0x00, 0x1F, 0x65, 0x23, 0x77, 0x00, 0x0F, 0x00,
ILI9XXX_IFMODE , 1, 0x00, // CommandAccessProtect
ILI9XXX_PTLAR , 4, 0, 0, 1, 0xDF,
0xE4 , 1, 0xA0,
ILI9XXX_MADCTL , 1, MADCTL_MX| MADCTL_BGR, // Memory Access Control
ILI9XXX_CSCON , 1, 0x01,
ILI9XXX_PIXFMT, 1, 0x66, // 18 bit mode
ILI9XXX_INVON, 0,
ILI9XXX_DISPON, 0x80, // Set display on
0x00 // end
};
static const uint8_t PROGMEM INITCMD_ILI9486[] = {
ILI9XXX_SLPOUT, 0x80,
ILI9XXX_PIXFMT, 1, 0x55,

View File

@@ -170,7 +170,7 @@ def _notify_old_style(config):
ARDUINO_VERSIONS = {
"dev": (cv.Version(0, 0, 0), "https://github.com/libretiny-eu/libretiny.git"),
"latest": (cv.Version(0, 0, 0), None),
"recommended": (cv.Version(1, 4, 0), None),
"recommended": (cv.Version(1, 4, 1), None),
}

View File

@@ -21,6 +21,7 @@ CONF_COLUMNS = "columns"
CONF_KEYS = "keys"
CONF_DEBOUNCE_TIME = "debounce_time"
CONF_HAS_DIODES = "has_diodes"
CONF_HAS_PULLDOWNS = "has_pulldowns"
def check_keys(obj):
@@ -45,6 +46,7 @@ CONFIG_SCHEMA = cv.All(
cv.Optional(CONF_KEYS): cv.string,
cv.Optional(CONF_DEBOUNCE_TIME, default=1): cv.int_range(min=1, max=100),
cv.Optional(CONF_HAS_DIODES): cv.boolean,
cv.Optional(CONF_HAS_PULLDOWNS): cv.boolean,
}
),
check_keys,
@@ -69,3 +71,5 @@ async def to_code(config):
cg.add(var.set_debounce_time(config[CONF_DEBOUNCE_TIME]))
if CONF_HAS_DIODES in config:
cg.add(var.set_has_diodes(config[CONF_HAS_DIODES]))
if CONF_HAS_PULLDOWNS in config:
cg.add(var.set_has_pulldowns(config[CONF_HAS_PULLDOWNS]))

View File

@@ -11,11 +11,16 @@ void MatrixKeypad::setup() {
if (!has_diodes_) {
pin->pin_mode(gpio::FLAG_INPUT);
} else {
pin->digital_write(true);
pin->digital_write(!has_pulldowns_);
}
}
for (auto *pin : this->columns_) {
if (has_pulldowns_) {
pin->pin_mode(gpio::FLAG_INPUT);
} else {
pin->pin_mode(gpio::FLAG_INPUT | gpio::FLAG_PULLUP);
}
}
for (auto *pin : this->columns_)
pin->pin_mode(gpio::FLAG_INPUT | gpio::FLAG_PULLUP);
}
void MatrixKeypad::loop() {
@@ -28,9 +33,9 @@ void MatrixKeypad::loop() {
for (auto *row : this->rows_) {
if (!has_diodes_)
row->pin_mode(gpio::FLAG_OUTPUT);
row->digital_write(false);
row->digital_write(has_pulldowns_);
for (auto *col : this->columns_) {
if (!col->digital_read()) {
if (col->digital_read() == has_pulldowns_) {
if (key != -1) {
error = true;
} else {
@@ -39,7 +44,7 @@ void MatrixKeypad::loop() {
}
pos++;
}
row->digital_write(true);
row->digital_write(!has_pulldowns_);
if (!has_diodes_)
row->pin_mode(gpio::FLAG_INPUT);
}

View File

@@ -28,6 +28,7 @@ class MatrixKeypad : public key_provider::KeyProvider, public Component {
void set_keys(std::string keys) { keys_ = std::move(keys); };
void set_debounce_time(int debounce_time) { debounce_time_ = debounce_time; };
void set_has_diodes(int has_diodes) { has_diodes_ = has_diodes; };
void set_has_pulldowns(int has_pulldowns) { has_pulldowns_ = has_pulldowns; };
void register_listener(MatrixKeypadListener *listener);
@@ -37,6 +38,7 @@ class MatrixKeypad : public key_provider::KeyProvider, public Component {
std::string keys_;
int debounce_time_ = 0;
bool has_diodes_{false};
bool has_pulldowns_{false};
int pressed_key_ = -1;
std::vector<MatrixKeypadListener *> listeners_{};

View File

@@ -217,10 +217,7 @@ uint8_t MAX7219Component::printf(const char *format, ...) {
return 0;
}
void MAX7219Component::set_writer(max7219_writer_t &&writer) { this->writer_ = writer; }
void MAX7219Component::set_intensity(uint8_t intensity) {
this->intensity_ = intensity;
this->send_to_all_(MAX7219_REGISTER_INTENSITY, this->intensity_);
}
void MAX7219Component::set_intensity(uint8_t intensity) { this->intensity_ = intensity; }
void MAX7219Component::set_num_chips(uint8_t num_chips) { this->num_chips_ = num_chips; }
uint8_t MAX7219Component::strftime(uint8_t pos, const char *format, ESPTime time) {

View File

@@ -35,7 +35,7 @@ from esphome.components.climate import (
)
CODEOWNERS = ["@dudanov"]
DEPENDENCIES = ["climate", "uart", "wifi"]
DEPENDENCIES = ["climate", "uart"]
AUTO_LOAD = ["sensor"]
CONF_OUTDOOR_TEMPERATURE = "outdoor_temperature"
CONF_POWER_USAGE = "power_usage"

View File

@@ -71,7 +71,8 @@ bool MopekaStdCheck::parse_device(const esp32_ble_tracker::ESPBTDevice &device)
const auto *mopeka_data = (const mopeka_std_package *) manu_data.data.data();
const u_int8_t hardware_id = mopeka_data->data_1 & 0xCF;
if (static_cast<SensorType>(hardware_id) != STANDARD && static_cast<SensorType>(hardware_id) != XL) {
if (static_cast<SensorType>(hardware_id) != STANDARD && static_cast<SensorType>(hardware_id) != XL &&
static_cast<SensorType>(hardware_id) != ETRAILER) {
ESP_LOGE(TAG, "[%s] Unsupported Sensor Type (0x%X)", device.address_str().c_str(), hardware_id);
return false;
}

View File

@@ -14,6 +14,7 @@ namespace mopeka_std_check {
enum SensorType {
STANDARD = 0x02,
XL = 0x03,
ETRAILER = 0x46,
};
// 4 values in one struct so it aligns to 8 byte. One `mopeka_std_values` is 40 bit long.

View File

@@ -250,7 +250,7 @@ CONFIG_SCHEMA = cv.All(
}
),
validate_config,
cv.only_on(["esp32", "esp8266"]),
cv.only_on(["esp32", "esp8266", "bk72xx"]),
)
@@ -271,10 +271,10 @@ def exp_mqtt_message(config):
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
# Add required libraries for ESP8266
if CORE.is_esp8266:
# Add required libraries for ESP8266 and LibreTiny
if CORE.is_esp8266 or CORE.is_libretiny:
# https://github.com/heman/async-mqtt-client/blob/master/library.json
cg.add_library("heman/AsyncMqttClient-esphome", "1.0.0")
cg.add_library("heman/AsyncMqttClient-esphome", "2.0.0")
cg.add_define("USE_MQTT")
cg.add_global(mqtt_ns.using)

View File

@@ -0,0 +1,74 @@
#pragma once
#ifdef USE_LIBRETINY
#include "mqtt_backend.h"
#include <AsyncMqttClient.h>
namespace esphome {
namespace mqtt {
class MQTTBackendLibreTiny final : public MQTTBackend {
public:
void set_keep_alive(uint16_t keep_alive) final { mqtt_client_.setKeepAlive(keep_alive); }
void set_client_id(const char *client_id) final { mqtt_client_.setClientId(client_id); }
void set_clean_session(bool clean_session) final { mqtt_client_.setCleanSession(clean_session); }
void set_credentials(const char *username, const char *password) final {
mqtt_client_.setCredentials(username, password);
}
void set_will(const char *topic, uint8_t qos, bool retain, const char *payload) final {
mqtt_client_.setWill(topic, qos, retain, payload);
}
void set_server(network::IPAddress ip, uint16_t port) final {
mqtt_client_.setServer(IPAddress(static_cast<uint32_t>(ip)), port);
}
void set_server(const char *host, uint16_t port) final { mqtt_client_.setServer(host, port); }
#if ASYNC_TCP_SSL_ENABLED
void set_secure(bool secure) { mqtt_client.setSecure(secure); }
void add_server_fingerprint(const uint8_t *fingerprint) { mqtt_client.addServerFingerprint(fingerprint); }
#endif
void set_on_connect(std::function<on_connect_callback_t> &&callback) final {
this->mqtt_client_.onConnect(std::move(callback));
}
void set_on_disconnect(std::function<on_disconnect_callback_t> &&callback) final {
auto async_callback = [callback](AsyncMqttClientDisconnectReason reason) {
// int based enum so casting isn't a problem
callback(static_cast<MQTTClientDisconnectReason>(reason));
};
this->mqtt_client_.onDisconnect(std::move(async_callback));
}
void set_on_subscribe(std::function<on_subscribe_callback_t> &&callback) final {
this->mqtt_client_.onSubscribe(std::move(callback));
}
void set_on_unsubscribe(std::function<on_unsubscribe_callback_t> &&callback) final {
this->mqtt_client_.onUnsubscribe(std::move(callback));
}
void set_on_message(std::function<on_message_callback_t> &&callback) final {
auto async_callback = [callback](const char *topic, const char *payload,
AsyncMqttClientMessageProperties async_properties, size_t len, size_t index,
size_t total) { callback(topic, payload, len, index, total); };
mqtt_client_.onMessage(std::move(async_callback));
}
void set_on_publish(std::function<on_publish_user_callback_t> &&callback) final {
this->mqtt_client_.onPublish(std::move(callback));
}
bool connected() const final { return mqtt_client_.connected(); }
void connect() final { mqtt_client_.connect(); }
void disconnect() final { mqtt_client_.disconnect(true); }
bool subscribe(const char *topic, uint8_t qos) final { return mqtt_client_.subscribe(topic, qos) != 0; }
bool unsubscribe(const char *topic) final { return mqtt_client_.unsubscribe(topic) != 0; }
bool publish(const char *topic, const char *payload, size_t length, uint8_t qos, bool retain) final {
return mqtt_client_.publish(topic, qos, retain, payload, length, false, 0) != 0;
}
using MQTTBackend::publish;
protected:
AsyncMqttClient mqtt_client_;
};
} // namespace mqtt
} // namespace esphome
#endif // defined(USE_LIBRETINY)

View File

@@ -106,6 +106,9 @@ void MQTTClientComponent::send_device_info_() {
#ifdef USE_ESP32
root["platform"] = "ESP32";
#endif
#ifdef USE_LIBRETINY
root["platform"] = lt_cpu_get_model_name();
#endif
root["board"] = ESPHOME_BOARD;
#if defined(USE_WIFI)
@@ -156,7 +159,7 @@ void MQTTClientComponent::start_dnslookup_() {
this->dns_resolve_error_ = false;
this->dns_resolved_ = false;
ip_addr_t addr;
#ifdef USE_ESP32
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
err_t err = dns_gethostbyname_addrtype(this->credentials_.address.c_str(), &addr,
MQTTClientComponent::dns_found_callback, this, LWIP_DNS_ADDRTYPE_IPV4);
#endif

View File

@@ -13,6 +13,8 @@
#include "mqtt_backend_esp32.h"
#elif defined(USE_ESP8266)
#include "mqtt_backend_esp8266.h"
#elif defined(USE_LIBRETINY)
#include "mqtt_backend_libretiny.h"
#endif
#include "lwip/ip_addr.h"
@@ -300,6 +302,8 @@ class MQTTClientComponent : public Component {
MQTTBackendESP32 mqtt_backend_;
#elif defined(USE_ESP8266)
MQTTBackendESP8266 mqtt_backend_;
#elif defined(USE_LIBRETINY)
MQTTBackendLibreTiny mqtt_backend_;
#endif
MQTTClientState state_{MQTT_CLIENT_DISCONNECTED};

View File

@@ -11,6 +11,9 @@ void PulseMeterSensor::setup() {
this->pin_->setup();
this->isr_pin_ = pin_->to_isr();
// Set the last processed edge to now for the first timeout
this->last_processed_edge_us_ = micros();
if (this->filter_mode_ == FILTER_EDGE) {
this->pin_->attach_interrupt(PulseMeterSensor::edge_intr, this, gpio::INTERRUPT_RISING_EDGE);
} else if (this->filter_mode_ == FILTER_PULSE) {
@@ -38,12 +41,16 @@ void PulseMeterSensor::loop() {
}
// We need to detect at least two edges to have a valid pulse width
if (!this->initialized_) {
this->initialized_ = true;
} else {
uint32_t delta_us = this->get_->last_detected_edge_us_ - this->last_processed_edge_us_;
float pulse_width_us = delta_us / float(this->get_->count_);
this->publish_state((60.0f * 1000000.0f) / pulse_width_us);
switch (this->meter_state_) {
case MeterState::INITIAL:
case MeterState::TIMED_OUT: {
this->meter_state_ = MeterState::RUNNING;
} break;
case MeterState::RUNNING: {
uint32_t delta_us = this->get_->last_detected_edge_us_ - this->last_processed_edge_us_;
float pulse_width_us = delta_us / float(this->get_->count_);
this->publish_state((60.0f * 1000000.0f) / pulse_width_us);
} break;
}
this->last_processed_edge_us_ = this->get_->last_detected_edge_us_;
@@ -53,10 +60,18 @@ void PulseMeterSensor::loop() {
const uint32_t now = micros();
const uint32_t time_since_valid_edge_us = now - this->last_processed_edge_us_;
if (this->initialized_ && time_since_valid_edge_us > this->timeout_us_) {
ESP_LOGD(TAG, "No pulse detected for %us, assuming 0 pulses/min", time_since_valid_edge_us / 1000000);
this->initialized_ = false;
this->publish_state(0.0f);
switch (this->meter_state_) {
// Running and initial states can timeout
case MeterState::INITIAL:
case MeterState::RUNNING: {
if (time_since_valid_edge_us > this->timeout_us_) {
this->meter_state_ = MeterState::TIMED_OUT;
ESP_LOGD(TAG, "No pulse detected for %us, assuming 0 pulses/min", time_since_valid_edge_us / 1000000);
this->publish_state(0.0f);
}
} break;
default:
break;
}
}
}

View File

@@ -38,7 +38,8 @@ class PulseMeterSensor : public sensor::Sensor, public Component {
InternalFilterMode filter_mode_{FILTER_EDGE};
// Variables used in the loop
bool initialized_ = false;
enum class MeterState { INITIAL, RUNNING, TIMED_OUT };
MeterState meter_state_ = MeterState::INITIAL;
uint32_t total_pulses_ = 0;
uint32_t last_processed_edge_us_ = 0;

View File

@@ -10,7 +10,7 @@ static const char *const TAG = "radon_eye_ble";
bool RadonEyeListener::parse_device(const esp32_ble_tracker::ESPBTDevice &device) {
if (not device.get_name().empty()) {
if (device.get_name().rfind("FR:R20:SN", 0) == 0) {
if (device.get_name().rfind("FR:R", 0) == 0) {
// This is an RD200, I think
ESP_LOGD(TAG, "Found Radon Eye RD200 device Name: %s (MAC: %s)", device.get_name().c_str(),
device.address_str().c_str());

View File

@@ -152,6 +152,9 @@ CONFIG_SCHEMA = cv.All(
async def to_code(config):
cg.add(rp2040_ns.setup_preferences())
# Allow LDF to properly discover dependency including those in preprocessor
# conditionals
cg.add_platformio_option("lib_ldf_mode", "chain+")
cg.add_platformio_option("board", config[CONF_BOARD])
cg.add_build_flag("-DUSE_RP2040")
cg.add_define("ESPHOME_BOARD", config[CONF_BOARD])

View File

@@ -57,6 +57,10 @@ KNOWN_FIRMWARE = {
"https://github.com/jamesturton/shelly-dimmer-stm32/releases/download/v51.6/shelly-dimmer-stm32_v51.6.bin",
"eda483e111c914723a33f5088f1397d5c0b19333db4a88dc965636b976c16c36",
),
"51.7": (
"https://github.com/jamesturton/shelly-dimmer-stm32/releases/download/v51.7/shelly-dimmer-stm32_v51.7.bin",
"7a20f1c967c469917368a79bc56498009045237080408cef7190743e08031889",
),
}

View File

@@ -28,7 +28,7 @@ from esphome.const import (
)
from esphome.core import coroutine_with_priority, CORE
CODEOWNERS = ["@esphome/core"]
CODEOWNERS = ["@esphome/core", "@clydebarrow"]
spi_ns = cg.esphome_ns.namespace("spi")
SPIComponent = spi_ns.class_("SPIComponent", cg.Component)
SPIDevice = spi_ns.class_("SPIDevice")
@@ -187,7 +187,7 @@ def get_spi_interface(index):
# Following code can't apply to C2, H2 or 8266 since they have only one SPI
if get_target_variant() in (VARIANT_ESP32S3, VARIANT_ESP32S2):
return "new SPIClass(FSPI)"
return "return new SPIClass(HSPI)"
return "new SPIClass(HSPI)"
SPI_SCHEMA = cv.All(

View File

@@ -248,6 +248,7 @@ class SPIDelegateDummy : public SPIDelegate {
SPIDelegateDummy() = default;
uint8_t transfer(uint8_t data) override { return 0; }
void end_transaction() override{};
void begin_transaction() override;
};
@@ -351,6 +352,7 @@ class SPIClient {
: bit_order_(bit_order), mode_(mode), data_rate_(data_rate) {}
virtual void spi_setup() {
esph_log_d("spi_device", "mode %u, data_rate %ukHz", (unsigned) this->mode_, (unsigned) (this->data_rate_ / 1000));
this->delegate_ = this->parent_->register_device(this, this->mode_, this->bit_order_, this->data_rate_, this->cs_);
}
@@ -398,10 +400,7 @@ class SPIDevice : public SPIClient {
void set_data_rate(uint32_t data_rate) { this->data_rate_ = data_rate; }
void set_bit_order(SPIBitOrder order) {
this->bit_order_ = order;
esph_log_d("spi.h", "bit order set to %d", order);
}
void set_bit_order(SPIBitOrder order) { this->bit_order_ = order; }
void set_mode(SPIMode mode) { this->mode_ = mode; }

View File

@@ -15,6 +15,11 @@ class SPIDelegateHw : public SPIDelegate {
void begin_transaction() override {
#ifdef USE_RP2040
SPISettings const settings(this->data_rate_, static_cast<BitOrder>(this->bit_order_), this->mode_);
#elif defined(ESP8266)
// Arduino ESP8266 library has mangled values for SPI modes :-(
auto mode = (this->mode_ & 0x01) + ((this->mode_ & 0x02) << 3);
ESP_LOGV(TAG, "8266 mangled SPI mode 0x%X", mode);
SPISettings const settings(this->data_rate_, this->bit_order_, mode);
#else
SPISettings const settings(this->data_rate_, this->bit_order_, this->mode_);
#endif

View File

@@ -986,6 +986,7 @@ void ThermostatClimate::change_preset_(climate::ClimatePreset preset) {
// Fire any preset changed trigger if defined
Trigger<> *trig = this->preset_change_trigger_;
assert(trig != nullptr);
this->preset = preset;
trig->trigger();
this->refresh();
@@ -1010,6 +1011,7 @@ void ThermostatClimate::change_custom_preset_(const std::string &custom_preset)
// Fire any preset changed trigger if defined
Trigger<> *trig = this->preset_change_trigger_;
assert(trig != nullptr);
this->custom_preset = custom_preset;
trig->trigger();
this->refresh();

View File

@@ -10,7 +10,7 @@ void TuyaNumber::setup() {
this->parent_->register_listener(this->number_id_, [this](const TuyaDatapoint &datapoint) {
if (datapoint.type == TuyaDatapointType::INTEGER) {
ESP_LOGV(TAG, "MCU reported number %u is: %d", datapoint.id, datapoint.value_int);
this->publish_state(datapoint.value_int);
this->publish_state(datapoint.value_int * this->traits.get_step());
} else if (datapoint.type == TuyaDatapointType::ENUM) {
ESP_LOGV(TAG, "MCU reported number %u is: %u", datapoint.id, datapoint.value_enum);
this->publish_state(datapoint.value_enum);
@@ -22,7 +22,8 @@ void TuyaNumber::setup() {
void TuyaNumber::control(float value) {
ESP_LOGV(TAG, "Setting number %u: %f", this->number_id_, value);
if (this->type_ == TuyaDatapointType::INTEGER) {
this->parent_->set_integer_datapoint_value(this->number_id_, value);
int integer_value = lround(value / this->traits.get_step());
this->parent_->set_integer_datapoint_value(this->number_id_, integer_value);
} else if (this->type_ == TuyaDatapointType::ENUM) {
this->parent_->set_enum_datapoint_value(this->number_id_, value);
}

View File

@@ -1561,6 +1561,23 @@ void WaveshareEPaper7P5In::dump_config() {
LOG_PIN(" Busy Pin: ", this->busy_pin_);
LOG_UPDATE_INTERVAL(this);
}
bool WaveshareEPaper7P5InV2::wait_until_idle_() {
if (this->busy_pin_ == nullptr) {
return true;
}
const uint32_t start = millis();
while (this->busy_pin_->digital_read()) {
this->command(0x71);
if (millis() - start > this->idle_timeout_()) {
ESP_LOGE(TAG, "Timeout while displaying image!");
return false;
}
App.feed_wdt();
delay(10);
}
return true;
}
void WaveshareEPaper7P5InV2::initialize() {
// COMMAND POWER SETTING
this->command(0x01);
@@ -1568,10 +1585,21 @@ void WaveshareEPaper7P5InV2::initialize() {
this->data(0x07);
this->data(0x3f);
this->data(0x3f);
this->command(0x04);
// We don't want the display to be powered at this point
delay(100); // NOLINT
this->wait_until_idle_();
// COMMAND VCOM AND DATA INTERVAL SETTING
this->command(0x50);
this->data(0x10);
this->data(0x07);
// COMMAND TCON SETTING
this->command(0x60);
this->data(0x22);
// COMMAND PANEL SETTING
this->command(0x00);
this->data(0x1F);
@@ -1582,19 +1610,30 @@ void WaveshareEPaper7P5InV2::initialize() {
this->data(0x20);
this->data(0x01);
this->data(0xE0);
// COMMAND ...?
// COMMAND DUAL SPI MM_EN, DUSPI_EN
this->command(0x15);
this->data(0x00);
// COMMAND VCOM AND DATA INTERVAL SETTING
this->command(0x50);
this->data(0x10);
this->data(0x07);
// COMMAND TCON SETTING
this->command(0x60);
this->data(0x22);
// COMMAND POWER DRIVER HAT DOWN
// This command will turn off booster, controller, source driver, gate driver, VCOM, and
// temperature sensor, but register data will be kept until VDD turned OFF or Deep Sleep Mode.
// Source/Gate/Border/VCOM will be released to floating.
this->command(0x02);
}
void HOT WaveshareEPaper7P5InV2::display() {
uint32_t buf_len = this->get_buffer_length_();
// COMMAND POWER ON
ESP_LOGI(TAG, "Power on the display and hat");
// This command will turn on booster, controller, regulators, and temperature sensor will be
// activated for one-time sensing before enabling booster. When all voltages are ready, the
// BUSY_N signal will return to high.
this->command(0x04);
delay(200); // NOLINT
this->wait_until_idle_();
// COMMAND DATA START TRANSMISSION NEW DATA
this->command(0x13);
delay(2);
@@ -1602,14 +1641,23 @@ void HOT WaveshareEPaper7P5InV2::display() {
this->data(~(this->buffer_[i]));
}
delay(100); // NOLINT
this->wait_until_idle_();
// COMMAND DISPLAY REFRESH
this->command(0x12);
delay(100); // NOLINT
this->wait_until_idle_();
ESP_LOGV(TAG, "Before command(0x02) (>> power off)");
this->command(0x02);
this->wait_until_idle_();
ESP_LOGV(TAG, "After command(0x02) (>> power off)");
}
int WaveshareEPaper7P5InV2::get_width_internal() { return 800; }
int WaveshareEPaper7P5InV2::get_height_internal() { return 480; }
uint32_t WaveshareEPaper7P5InV2::idle_timeout_() { return 10000; }
void WaveshareEPaper7P5InV2::dump_config() {
LOG_DISPLAY("", "Waveshare E-Paper", this);
ESP_LOGCONFIG(TAG, " Model: 7.5inV2rev2");

View File

@@ -472,6 +472,8 @@ class WaveshareEPaper7P5InBC : public WaveshareEPaper {
class WaveshareEPaper7P5InV2 : public WaveshareEPaper {
public:
bool wait_until_idle_();
void initialize() override;
void display() override;
@@ -491,6 +493,8 @@ class WaveshareEPaper7P5InV2 : public WaveshareEPaper {
int get_width_internal() override;
int get_height_internal() override;
uint32_t idle_timeout_() override;
};
class WaveshareEPaper7P5InV2alt : public WaveshareEPaper7P5InV2 {

View File

@@ -59,7 +59,7 @@ CONFIG_SCHEMA = cv.All(
{
cv.GenerateID(): cv.declare_id(WebServer),
cv.Optional(CONF_PORT, default=80): cv.port,
cv.Optional(CONF_VERSION, default=2): cv.one_of(1, 2),
cv.Optional(CONF_VERSION, default=2): cv.one_of(1, 2, int=True),
cv.Optional(CONF_CSS_URL): cv.string,
cv.Optional(CONF_CSS_INCLUDE): cv.file_,
cv.Optional(CONF_JS_URL): cv.string,

View File

@@ -33,6 +33,7 @@ const uint8_t WHIRLPOOL_SWING_MASK = 128;
const uint8_t WHIRLPOOL_POWER = 0x04;
void WhirlpoolClimate::transmit_state() {
this->last_transmit_time_ = millis(); // setting the time of the last transmission.
uint8_t remote_state[WHIRLPOOL_STATE_LENGTH] = {0};
remote_state[0] = 0x83;
remote_state[1] = 0x06;
@@ -149,6 +150,12 @@ void WhirlpoolClimate::transmit_state() {
}
bool WhirlpoolClimate::on_receive(remote_base::RemoteReceiveData data) {
// Check if the esp isn't currently transmitting.
if (millis() - this->last_transmit_time_ < 500) {
ESP_LOGV(TAG, "Blocked receive because of current trasmittion");
return false;
}
// Validate header
if (!data.expect_item(WHIRLPOOL_HEADER_MARK, WHIRLPOOL_HEADER_SPACE)) {
ESP_LOGV(TAG, "Header fail");

View File

@@ -47,6 +47,8 @@ class WhirlpoolClimate : public climate_ir::ClimateIR {
void transmit_state() override;
/// Handle received IR Buffer
bool on_receive(remote_base::RemoteReceiveData data) override;
/// Set the time of the last transmission.
int32_t last_transmit_time_{};
bool send_swing_cmd_{false};
Model model_;

View File

@@ -98,6 +98,7 @@ bool WiFiComponent::wifi_apply_power_save_() {
power_save = NONE_SLEEP_T;
break;
}
wifi_fpm_auto_sleep_set_in_null_mode(1);
return wifi_set_sleep_type(power_save);
}

View File

@@ -9,6 +9,7 @@ from esphome.const import (
CONF_REBOOT_TIMEOUT,
)
from esphome.components import time
from esphome.core import TimePeriod
CONF_NETMASK = "netmask"
CONF_PRIVATE_KEY = "private_key"
@@ -59,9 +60,9 @@ CONFIG_SCHEMA = cv.Schema(
cv.Optional(CONF_PEER_ALLOWED_IPS, default=["0.0.0.0/0"]): cv.ensure_list(
_cidr_network
),
cv.Optional(CONF_PEER_PERSISTENT_KEEPALIVE, default=0): cv.Any(
cv.Optional(CONF_PEER_PERSISTENT_KEEPALIVE, default="0s"): cv.All(
cv.positive_time_period_seconds,
cv.uint16_t,
cv.Range(max=TimePeriod(seconds=65535)),
),
cv.Optional(
CONF_REBOOT_TIMEOUT, default="15min"

View File

@@ -1,6 +1,6 @@
"""Constants used by esphome."""
__version__ = "2023.9.0b1"
__version__ = "2023.9.2"
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
VALID_SUBSTITUTIONS_CHARACTERS = (

View File

@@ -57,7 +57,7 @@ class SimpleRegistry(dict):
return decorator
def safe_print(message=""):
def safe_print(message="", end="\n"):
from esphome.core import CORE
if CORE.dashboard:
@@ -67,20 +67,26 @@ def safe_print(message=""):
pass
try:
print(message)
print(message, end=end)
return
except UnicodeEncodeError:
pass
try:
print(message.encode("utf-8", "backslashreplace"))
print(message.encode("utf-8", "backslashreplace"), end=end)
except UnicodeEncodeError:
try:
print(message.encode("ascii", "backslashreplace"))
print(message.encode("ascii", "backslashreplace"), end=end)
except UnicodeEncodeError:
print("Cannot print line because of invalid locale!")
def safe_input(prompt=""):
if prompt:
safe_print(prompt, end="")
return input()
def shlex_quote(s):
if not s:
return "''"

View File

@@ -11,7 +11,7 @@ from esphome.core import CORE
from esphome.helpers import get_bool_env, write_file
from esphome.log import Fore, color
from esphome.storage_json import StorageJSON, ext_storage_path
from esphome.util import safe_print
from esphome.util import safe_input, safe_print
CORE_BIG = r""" _____ ____ _____ ______
/ ____/ __ \| __ \| ____|
@@ -252,7 +252,7 @@ def safe_print_step(step, big):
def default_input(text, default):
safe_print()
safe_print(f"Press ENTER for default ({default})")
return input(text.format(default)) or default
return safe_input(text.format(default)) or default
# From https://stackoverflow.com/a/518232/8924614
@@ -306,7 +306,7 @@ def wizard(path):
)
safe_print()
sleep(1)
name = input(color(Fore.BOLD_WHITE, "(name): "))
name = safe_input(color(Fore.BOLD_WHITE, "(name): "))
while True:
try:
@@ -343,7 +343,9 @@ def wizard(path):
while True:
sleep(0.5)
safe_print()
platform = input(color(Fore.BOLD_WHITE, f"({'/'.join(wizard_platforms)}): "))
platform = safe_input(
color(Fore.BOLD_WHITE, f"({'/'.join(wizard_platforms)}): ")
)
try:
platform = vol.All(vol.Upper, vol.Any(*wizard_platforms))(platform.upper())
break
@@ -397,7 +399,7 @@ def wizard(path):
boards.append(board_id)
while True:
board = input(color(Fore.BOLD_WHITE, "(board): "))
board = safe_input(color(Fore.BOLD_WHITE, "(board): "))
try:
board = vol.All(vol.Lower, vol.Any(*boards))(board)
break
@@ -423,7 +425,7 @@ def wizard(path):
sleep(1.5)
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'Abraham Linksys')}\".")
while True:
ssid = input(color(Fore.BOLD_WHITE, "(ssid): "))
ssid = safe_input(color(Fore.BOLD_WHITE, "(ssid): "))
try:
ssid = cv.ssid(ssid)
break
@@ -449,7 +451,7 @@ def wizard(path):
safe_print()
safe_print(f"For example \"{color(Fore.BOLD_WHITE, 'PASSWORD42')}\"")
sleep(0.5)
psk = input(color(Fore.BOLD_WHITE, "(PSK): "))
psk = safe_input(color(Fore.BOLD_WHITE, "(PSK): "))
safe_print(
"Perfect! WiFi is now set up (you can create static IPs and so on later)."
)
@@ -466,7 +468,7 @@ def wizard(path):
safe_print()
sleep(0.25)
safe_print("Press ENTER for no password")
password = input(color(Fore.BOLD_WHITE, "(password): "))
password = safe_input(color(Fore.BOLD_WHITE, "(password): "))
if not wizard_write(
path=path,

View File

@@ -11,7 +11,7 @@ esptool==4.6.2
click==8.1.7
esphome-dashboard==20230904.0
aioesphomeapi==15.0.0
zeroconf==0.108.0
zeroconf==0.112.0
# esp-idf requires this, but doesn't bundle it by default
# https://github.com/espressif/esp-idf/blob/220590d599e134d7a5e7f1e683cc4550349ffbf8/requirements.txt#L24

View File

@@ -2972,6 +2972,7 @@ display:
model: TFT 2.4
cs_pin: GPIO5
dc_pin: GPIO4
color_palette: GRAYSCALE
reset_pin: GPIO22
lambda: |-
it.rectangle(0, 0, it.get_width(), it.get_height());

View File

@@ -667,6 +667,7 @@ matrix_keypad:
- pin: 17
- pin: 16
keys: "1234"
has_pulldowns: true
key_collector:
- id: reader

View File

@@ -319,7 +319,7 @@ def test_wizard_accepts_default_answers_esp8266(tmpdir, monkeypatch, wizard_answ
config_file = tmpdir.join("test.yaml")
input_mock = MagicMock(side_effect=wizard_answers)
monkeypatch.setattr("builtins.input", input_mock)
monkeypatch.setattr(wz, "safe_print", lambda t=None: 0)
monkeypatch.setattr(wz, "safe_print", lambda t=None, end=None: 0)
monkeypatch.setattr(wz, "sleep", lambda _: 0)
monkeypatch.setattr(wz, "wizard_write", MagicMock())
@@ -341,7 +341,7 @@ def test_wizard_accepts_default_answers_esp32(tmpdir, monkeypatch, wizard_answer
config_file = tmpdir.join("test.yaml")
input_mock = MagicMock(side_effect=wizard_answers)
monkeypatch.setattr("builtins.input", input_mock)
monkeypatch.setattr(wz, "safe_print", lambda t=None: 0)
monkeypatch.setattr(wz, "safe_print", lambda t=None, end=None: 0)
monkeypatch.setattr(wz, "sleep", lambda _: 0)
monkeypatch.setattr(wz, "wizard_write", MagicMock())
@@ -371,7 +371,7 @@ def test_wizard_offers_better_node_name(tmpdir, monkeypatch, wizard_answers):
config_file = tmpdir.join("test.yaml")
input_mock = MagicMock(side_effect=wizard_answers)
monkeypatch.setattr("builtins.input", input_mock)
monkeypatch.setattr(wz, "safe_print", lambda t=None: 0)
monkeypatch.setattr(wz, "safe_print", lambda t=None, end=None: 0)
monkeypatch.setattr(wz, "sleep", lambda _: 0)
monkeypatch.setattr(wz, "wizard_write", MagicMock())
@@ -394,7 +394,7 @@ def test_wizard_requires_correct_platform(tmpdir, monkeypatch, wizard_answers):
config_file = tmpdir.join("test.yaml")
input_mock = MagicMock(side_effect=wizard_answers)
monkeypatch.setattr("builtins.input", input_mock)
monkeypatch.setattr(wz, "safe_print", lambda t=None: 0)
monkeypatch.setattr(wz, "safe_print", lambda t=None, end=None: 0)
monkeypatch.setattr(wz, "sleep", lambda _: 0)
monkeypatch.setattr(wz, "wizard_write", MagicMock())
@@ -416,7 +416,7 @@ def test_wizard_requires_correct_board(tmpdir, monkeypatch, wizard_answers):
config_file = tmpdir.join("test.yaml")
input_mock = MagicMock(side_effect=wizard_answers)
monkeypatch.setattr("builtins.input", input_mock)
monkeypatch.setattr(wz, "safe_print", lambda t=None: 0)
monkeypatch.setattr(wz, "safe_print", lambda t=None, end=None: 0)
monkeypatch.setattr(wz, "sleep", lambda _: 0)
monkeypatch.setattr(wz, "wizard_write", MagicMock())
@@ -438,7 +438,7 @@ def test_wizard_requires_valid_ssid(tmpdir, monkeypatch, wizard_answers):
config_file = tmpdir.join("test.yaml")
input_mock = MagicMock(side_effect=wizard_answers)
monkeypatch.setattr("builtins.input", input_mock)
monkeypatch.setattr(wz, "safe_print", lambda t=None: 0)
monkeypatch.setattr(wz, "safe_print", lambda t=None, end=None: 0)
monkeypatch.setattr(wz, "sleep", lambda _: 0)
monkeypatch.setattr(wz, "wizard_write", MagicMock())