mirror of
https://github.com/esphome/esphome.git
synced 2024-12-28 17:37:44 +01:00
commit
c7651dc40d
@ -121,7 +121,7 @@ async def to_code(config):
|
|||||||
decoded = base64.b64decode(conf[CONF_KEY])
|
decoded = base64.b64decode(conf[CONF_KEY])
|
||||||
cg.add(var.set_noise_psk(list(decoded)))
|
cg.add(var.set_noise_psk(list(decoded)))
|
||||||
cg.add_define("USE_API_NOISE")
|
cg.add_define("USE_API_NOISE")
|
||||||
cg.add_library("esphome/noise-c", "0.1.3")
|
cg.add_library("esphome/noise-c", "0.1.4")
|
||||||
else:
|
else:
|
||||||
cg.add_define("USE_API_PLAINTEXT")
|
cg.add_define("USE_API_PLAINTEXT")
|
||||||
|
|
||||||
|
@ -78,6 +78,8 @@ void APIConnection::loop() {
|
|||||||
on_fatal_error();
|
on_fatal_error();
|
||||||
if (err == APIError::SOCKET_READ_FAILED && errno == ECONNRESET) {
|
if (err == APIError::SOCKET_READ_FAILED && errno == ECONNRESET) {
|
||||||
ESP_LOGW(TAG, "%s: Connection reset", client_info_.c_str());
|
ESP_LOGW(TAG, "%s: Connection reset", client_info_.c_str());
|
||||||
|
} else if (err == APIError::CONNECTION_CLOSED) {
|
||||||
|
ESP_LOGW(TAG, "%s: Connection closed", client_info_.c_str());
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGW(TAG, "%s: Reading failed: %s errno=%d", client_info_.c_str(), api_error_to_str(err), errno);
|
ESP_LOGW(TAG, "%s: Reading failed: %s errno=%d", client_info_.c_str(), api_error_to_str(err), errno);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace api {
|
|||||||
|
|
||||||
static const char *const TAG = "api.socket";
|
static const char *const TAG = "api.socket";
|
||||||
|
|
||||||
/// Is the given return value (from read/write syscalls) a wouldblock error?
|
/// Is the given return value (from write syscalls) a wouldblock error?
|
||||||
bool is_would_block(ssize_t ret) {
|
bool is_would_block(ssize_t ret) {
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
return errno == EWOULDBLOCK || errno == EAGAIN;
|
return errno == EWOULDBLOCK || errno == EAGAIN;
|
||||||
@ -64,6 +64,8 @@ const char *api_error_to_str(APIError err) {
|
|||||||
return "HANDSHAKESTATE_SPLIT_FAILED";
|
return "HANDSHAKESTATE_SPLIT_FAILED";
|
||||||
} else if (err == APIError::BAD_HANDSHAKE_ERROR_BYTE) {
|
} else if (err == APIError::BAD_HANDSHAKE_ERROR_BYTE) {
|
||||||
return "BAD_HANDSHAKE_ERROR_BYTE";
|
return "BAD_HANDSHAKE_ERROR_BYTE";
|
||||||
|
} else if (err == APIError::CONNECTION_CLOSED) {
|
||||||
|
return "CONNECTION_CLOSED";
|
||||||
}
|
}
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
@ -185,12 +187,17 @@ APIError APINoiseFrameHelper::try_read_frame_(ParsedFrame *frame) {
|
|||||||
// no header information yet
|
// no header information yet
|
||||||
size_t to_read = 3 - rx_header_buf_len_;
|
size_t to_read = 3 - rx_header_buf_len_;
|
||||||
ssize_t received = socket_->read(&rx_header_buf_[rx_header_buf_len_], to_read);
|
ssize_t received = socket_->read(&rx_header_buf_[rx_header_buf_len_], to_read);
|
||||||
if (is_would_block(received)) {
|
if (received == -1) {
|
||||||
return APIError::WOULD_BLOCK;
|
if (errno == EWOULDBLOCK || errno == EAGAIN) {
|
||||||
} else if (received == -1) {
|
return APIError::WOULD_BLOCK;
|
||||||
|
}
|
||||||
state_ = State::FAILED;
|
state_ = State::FAILED;
|
||||||
HELPER_LOG("Socket read failed with errno %d", errno);
|
HELPER_LOG("Socket read failed with errno %d", errno);
|
||||||
return APIError::SOCKET_READ_FAILED;
|
return APIError::SOCKET_READ_FAILED;
|
||||||
|
} else if (received == 0) {
|
||||||
|
state_ = State::FAILED;
|
||||||
|
HELPER_LOG("Connection closed");
|
||||||
|
return APIError::CONNECTION_CLOSED;
|
||||||
}
|
}
|
||||||
rx_header_buf_len_ += received;
|
rx_header_buf_len_ += received;
|
||||||
if (received != to_read) {
|
if (received != to_read) {
|
||||||
@ -227,12 +234,17 @@ APIError APINoiseFrameHelper::try_read_frame_(ParsedFrame *frame) {
|
|||||||
// more data to read
|
// more data to read
|
||||||
size_t to_read = msg_size - rx_buf_len_;
|
size_t to_read = msg_size - rx_buf_len_;
|
||||||
ssize_t received = socket_->read(&rx_buf_[rx_buf_len_], to_read);
|
ssize_t received = socket_->read(&rx_buf_[rx_buf_len_], to_read);
|
||||||
if (is_would_block(received)) {
|
if (received == -1) {
|
||||||
return APIError::WOULD_BLOCK;
|
if (errno == EWOULDBLOCK || errno == EAGAIN) {
|
||||||
} else if (received == -1) {
|
return APIError::WOULD_BLOCK;
|
||||||
|
}
|
||||||
state_ = State::FAILED;
|
state_ = State::FAILED;
|
||||||
HELPER_LOG("Socket read failed with errno %d", errno);
|
HELPER_LOG("Socket read failed with errno %d", errno);
|
||||||
return APIError::SOCKET_READ_FAILED;
|
return APIError::SOCKET_READ_FAILED;
|
||||||
|
} else if (received == 0) {
|
||||||
|
state_ = State::FAILED;
|
||||||
|
HELPER_LOG("Connection closed");
|
||||||
|
return APIError::CONNECTION_CLOSED;
|
||||||
}
|
}
|
||||||
rx_buf_len_ += received;
|
rx_buf_len_ += received;
|
||||||
if (received != to_read) {
|
if (received != to_read) {
|
||||||
@ -778,12 +790,17 @@ APIError APIPlaintextFrameHelper::try_read_frame_(ParsedFrame *frame) {
|
|||||||
while (!rx_header_parsed_) {
|
while (!rx_header_parsed_) {
|
||||||
uint8_t data;
|
uint8_t data;
|
||||||
ssize_t received = socket_->read(&data, 1);
|
ssize_t received = socket_->read(&data, 1);
|
||||||
if (is_would_block(received)) {
|
if (received == -1) {
|
||||||
return APIError::WOULD_BLOCK;
|
if (errno == EWOULDBLOCK || errno == EAGAIN) {
|
||||||
} else if (received == -1) {
|
return APIError::WOULD_BLOCK;
|
||||||
|
}
|
||||||
state_ = State::FAILED;
|
state_ = State::FAILED;
|
||||||
HELPER_LOG("Socket read failed with errno %d", errno);
|
HELPER_LOG("Socket read failed with errno %d", errno);
|
||||||
return APIError::SOCKET_READ_FAILED;
|
return APIError::SOCKET_READ_FAILED;
|
||||||
|
} else if (received == 0) {
|
||||||
|
state_ = State::FAILED;
|
||||||
|
HELPER_LOG("Connection closed");
|
||||||
|
return APIError::CONNECTION_CLOSED;
|
||||||
}
|
}
|
||||||
rx_header_buf_.push_back(data);
|
rx_header_buf_.push_back(data);
|
||||||
|
|
||||||
@ -824,12 +841,17 @@ APIError APIPlaintextFrameHelper::try_read_frame_(ParsedFrame *frame) {
|
|||||||
// more data to read
|
// more data to read
|
||||||
size_t to_read = rx_header_parsed_len_ - rx_buf_len_;
|
size_t to_read = rx_header_parsed_len_ - rx_buf_len_;
|
||||||
ssize_t received = socket_->read(&rx_buf_[rx_buf_len_], to_read);
|
ssize_t received = socket_->read(&rx_buf_[rx_buf_len_], to_read);
|
||||||
if (is_would_block(received)) {
|
if (received == -1) {
|
||||||
return APIError::WOULD_BLOCK;
|
if (errno == EWOULDBLOCK || errno == EAGAIN) {
|
||||||
} else if (received == -1) {
|
return APIError::WOULD_BLOCK;
|
||||||
|
}
|
||||||
state_ = State::FAILED;
|
state_ = State::FAILED;
|
||||||
HELPER_LOG("Socket read failed with errno %d", errno);
|
HELPER_LOG("Socket read failed with errno %d", errno);
|
||||||
return APIError::SOCKET_READ_FAILED;
|
return APIError::SOCKET_READ_FAILED;
|
||||||
|
} else if (received == 0) {
|
||||||
|
state_ = State::FAILED;
|
||||||
|
HELPER_LOG("Connection closed");
|
||||||
|
return APIError::CONNECTION_CLOSED;
|
||||||
}
|
}
|
||||||
rx_buf_len_ += received;
|
rx_buf_len_ += received;
|
||||||
if (received != to_read) {
|
if (received != to_read) {
|
||||||
|
@ -53,6 +53,7 @@ enum class APIError : int {
|
|||||||
HANDSHAKESTATE_SETUP_FAILED = 1019,
|
HANDSHAKESTATE_SETUP_FAILED = 1019,
|
||||||
HANDSHAKESTATE_SPLIT_FAILED = 1020,
|
HANDSHAKESTATE_SPLIT_FAILED = 1020,
|
||||||
BAD_HANDSHAKE_ERROR_BYTE = 1021,
|
BAD_HANDSHAKE_ERROR_BYTE = 1021,
|
||||||
|
CONNECTION_CLOSED = 1022,
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *api_error_to_str(APIError err);
|
const char *api_error_to_str(APIError err);
|
||||||
|
@ -67,4 +67,4 @@ async def to_code(config):
|
|||||||
cg.add_library("SPI", None)
|
cg.add_library("SPI", None)
|
||||||
|
|
||||||
cg.add_define("USE_BSEC")
|
cg.add_define("USE_BSEC")
|
||||||
cg.add_library("BSEC Software Library", "1.6.1480")
|
cg.add_library("boschsensortec/BSEC Software Library", "1.6.1480")
|
||||||
|
@ -440,7 +440,11 @@ void Climate::set_visual_max_temperature_override(float visual_max_temperature_o
|
|||||||
void Climate::set_visual_temperature_step_override(float visual_temperature_step_override) {
|
void Climate::set_visual_temperature_step_override(float visual_temperature_step_override) {
|
||||||
this->visual_temperature_step_override_ = visual_temperature_step_override;
|
this->visual_temperature_step_override_ = visual_temperature_step_override;
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
Climate::Climate(const std::string &name) : EntityBase(name) {}
|
Climate::Climate(const std::string &name) : EntityBase(name) {}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
Climate::Climate() : Climate("") {}
|
Climate::Climate() : Climate("") {}
|
||||||
ClimateCall Climate::make_call() { return ClimateCall(this); }
|
ClimateCall Climate::make_call() { return ClimateCall(this); }
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ RECOMMENDED_ARDUINO_FRAMEWORK_VERSION = cv.Version(2, 7, 4)
|
|||||||
# - https://api.registry.platformio.org/v3/packages/platformio/platform/espressif8266
|
# - https://api.registry.platformio.org/v3/packages/platformio/platform/espressif8266
|
||||||
ARDUINO_2_PLATFORM_VERSION = cv.Version(2, 6, 2)
|
ARDUINO_2_PLATFORM_VERSION = cv.Version(2, 6, 2)
|
||||||
# for arduino 3 framework versions
|
# for arduino 3 framework versions
|
||||||
ARDUINO_3_PLATFORM_VERSION = cv.Version(3, 0, 2)
|
ARDUINO_3_PLATFORM_VERSION = cv.Version(3, 2, 0)
|
||||||
|
|
||||||
|
|
||||||
def _arduino_check_versions(value):
|
def _arduino_check_versions(value):
|
||||||
|
@ -22,6 +22,12 @@ using ESPColor ESPDEPRECATED("esphome::light::ESPColor is deprecated, use esphom
|
|||||||
/// Convert the color information from a `LightColorValues` object to a `Color` object (does not apply brightness).
|
/// Convert the color information from a `LightColorValues` object to a `Color` object (does not apply brightness).
|
||||||
Color color_from_light_color_values(LightColorValues val);
|
Color color_from_light_color_values(LightColorValues val);
|
||||||
|
|
||||||
|
/// Use a custom state class for addressable lights, to allow type system to discriminate between addressable and
|
||||||
|
/// non-addressable lights.
|
||||||
|
class AddressableLightState : public LightState {
|
||||||
|
using LightState::LightState;
|
||||||
|
};
|
||||||
|
|
||||||
class AddressableLight : public LightOutput, public Component {
|
class AddressableLight : public LightOutput, public Component {
|
||||||
public:
|
public:
|
||||||
virtual int32_t size() const = 0;
|
virtual int32_t size() const = 0;
|
||||||
|
@ -4,10 +4,9 @@ from esphome import automation
|
|||||||
# Base
|
# Base
|
||||||
light_ns = cg.esphome_ns.namespace("light")
|
light_ns = cg.esphome_ns.namespace("light")
|
||||||
LightState = light_ns.class_("LightState", cg.EntityBase, cg.Component)
|
LightState = light_ns.class_("LightState", cg.EntityBase, cg.Component)
|
||||||
# Fake class for addressable lights
|
AddressableLightState = light_ns.class_("AddressableLightState", LightState)
|
||||||
AddressableLightState = light_ns.class_("LightState", LightState)
|
|
||||||
LightOutput = light_ns.class_("LightOutput")
|
LightOutput = light_ns.class_("LightOutput")
|
||||||
AddressableLight = light_ns.class_("AddressableLight", cg.Component)
|
AddressableLight = light_ns.class_("AddressableLight", LightOutput, cg.Component)
|
||||||
AddressableLightRef = AddressableLight.operator("ref")
|
AddressableLightRef = AddressableLight.operator("ref")
|
||||||
|
|
||||||
Color = cg.esphome_ns.class_("Color")
|
Color = cg.esphome_ns.class_("Color")
|
||||||
|
@ -215,7 +215,7 @@ async def to_code(config):
|
|||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|
||||||
# https://github.com/OttoWinter/async-mqtt-client/blob/master/library.json
|
# https://github.com/OttoWinter/async-mqtt-client/blob/master/library.json
|
||||||
cg.add_library("ottowinter/AsyncMqttClient-esphome", "0.8.4")
|
cg.add_library("ottowinter/AsyncMqttClient-esphome", "0.8.6")
|
||||||
cg.add_define("USE_MQTT")
|
cg.add_define("USE_MQTT")
|
||||||
cg.add_global(mqtt_ns.using)
|
cg.add_global(mqtt_ns.using)
|
||||||
|
|
||||||
|
@ -88,9 +88,12 @@ void MQTTFanComponent::setup() {
|
|||||||
|
|
||||||
if (this->state_->get_traits().supports_speed()) {
|
if (this->state_->get_traits().supports_speed()) {
|
||||||
this->subscribe(this->get_speed_command_topic(), [this](const std::string &topic, const std::string &payload) {
|
this->subscribe(this->get_speed_command_topic(), [this](const std::string &topic, const std::string &payload) {
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
this->state_->make_call()
|
this->state_->make_call()
|
||||||
.set_speed(payload.c_str()) // NOLINT(clang-diagnostic-deprecated-declarations)
|
.set_speed(payload.c_str()) // NOLINT(clang-diagnostic-deprecated-declarations)
|
||||||
.perform();
|
.perform();
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,6 +148,8 @@ bool MQTTFanComponent::publish_state() {
|
|||||||
}
|
}
|
||||||
if (traits.supports_speed()) {
|
if (traits.supports_speed()) {
|
||||||
const char *payload;
|
const char *payload;
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
|
// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
|
||||||
switch (fan::speed_level_to_enum(this->state_->speed, traits.supported_speed_count())) {
|
switch (fan::speed_level_to_enum(this->state_->speed, traits.supported_speed_count())) {
|
||||||
case FAN_SPEED_LOW: { // NOLINT(clang-diagnostic-deprecated-declarations)
|
case FAN_SPEED_LOW: { // NOLINT(clang-diagnostic-deprecated-declarations)
|
||||||
@ -161,6 +166,7 @@ bool MQTTFanComponent::publish_state() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
bool success = this->publish(this->get_speed_state_topic(), payload);
|
bool success = this->publish(this->get_speed_state_topic(), payload);
|
||||||
failed = failed || !success;
|
failed = failed || !success;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ class OTABackend {
|
|||||||
virtual OTAResponseTypes write(uint8_t *data, size_t len) = 0;
|
virtual OTAResponseTypes write(uint8_t *data, size_t len) = 0;
|
||||||
virtual OTAResponseTypes end() = 0;
|
virtual OTAResponseTypes end() = 0;
|
||||||
virtual void abort() = 0;
|
virtual void abort() = 0;
|
||||||
|
virtual bool supports_compression() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ota
|
} // namespace ota
|
||||||
|
@ -15,6 +15,7 @@ class ArduinoESP32OTABackend : public OTABackend {
|
|||||||
OTAResponseTypes write(uint8_t *data, size_t len) override;
|
OTAResponseTypes write(uint8_t *data, size_t len) override;
|
||||||
OTAResponseTypes end() override;
|
OTAResponseTypes end() override;
|
||||||
void abort() override;
|
void abort() override;
|
||||||
|
bool supports_compression() override { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ota
|
} // namespace ota
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "ota_component.h"
|
#include "ota_component.h"
|
||||||
#include "ota_backend.h"
|
#include "ota_backend.h"
|
||||||
|
#include "esphome/core/macros.h"
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace ota {
|
namespace ota {
|
||||||
@ -16,6 +17,11 @@ class ArduinoESP8266OTABackend : public OTABackend {
|
|||||||
OTAResponseTypes write(uint8_t *data, size_t len) override;
|
OTAResponseTypes write(uint8_t *data, size_t len) override;
|
||||||
OTAResponseTypes end() override;
|
OTAResponseTypes end() override;
|
||||||
void abort() override;
|
void abort() override;
|
||||||
|
#if ARDUINO_VERSION_CODE >= VERSION_CODE(2, 7, 0)
|
||||||
|
bool supports_compression() override { return true; }
|
||||||
|
#else
|
||||||
|
bool supports_compression() override { return false; }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ota
|
} // namespace ota
|
||||||
|
@ -17,6 +17,7 @@ class IDFOTABackend : public OTABackend {
|
|||||||
OTAResponseTypes write(uint8_t *data, size_t len) override;
|
OTAResponseTypes write(uint8_t *data, size_t len) override;
|
||||||
OTAResponseTypes end() override;
|
OTAResponseTypes end() override;
|
||||||
void abort() override;
|
void abort() override;
|
||||||
|
bool supports_compression() override { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
esp_ota_handle_t update_handle_{0};
|
esp_ota_handle_t update_handle_{0};
|
||||||
|
@ -104,6 +104,8 @@ void OTAComponent::loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const uint8_t FEATURE_SUPPORTS_COMPRESSION = 0x01;
|
||||||
|
|
||||||
void OTAComponent::handle_() {
|
void OTAComponent::handle_() {
|
||||||
OTAResponseTypes error_code = OTA_RESPONSE_ERROR_UNKNOWN;
|
OTAResponseTypes error_code = OTA_RESPONSE_ERROR_UNKNOWN;
|
||||||
bool update_started = false;
|
bool update_started = false;
|
||||||
@ -154,6 +156,8 @@ void OTAComponent::handle_() {
|
|||||||
buf[1] = OTA_VERSION_1_0;
|
buf[1] = OTA_VERSION_1_0;
|
||||||
this->writeall_(buf, 2);
|
this->writeall_(buf, 2);
|
||||||
|
|
||||||
|
backend = make_ota_backend();
|
||||||
|
|
||||||
// Read features - 1 byte
|
// Read features - 1 byte
|
||||||
if (!this->readall_(buf, 1)) {
|
if (!this->readall_(buf, 1)) {
|
||||||
ESP_LOGW(TAG, "Reading features failed!");
|
ESP_LOGW(TAG, "Reading features failed!");
|
||||||
@ -164,6 +168,10 @@ void OTAComponent::handle_() {
|
|||||||
|
|
||||||
// Acknowledge header - 1 byte
|
// Acknowledge header - 1 byte
|
||||||
buf[0] = OTA_RESPONSE_HEADER_OK;
|
buf[0] = OTA_RESPONSE_HEADER_OK;
|
||||||
|
if ((ota_features & FEATURE_SUPPORTS_COMPRESSION) != 0 && backend->supports_compression()) {
|
||||||
|
buf[0] = OTA_RESPONSE_SUPPORTS_COMPRESSION;
|
||||||
|
}
|
||||||
|
|
||||||
this->writeall_(buf, 1);
|
this->writeall_(buf, 1);
|
||||||
|
|
||||||
#ifdef USE_OTA_PASSWORD
|
#ifdef USE_OTA_PASSWORD
|
||||||
@ -241,7 +249,6 @@ void OTAComponent::handle_() {
|
|||||||
}
|
}
|
||||||
ESP_LOGV(TAG, "OTA size is %u bytes", ota_size);
|
ESP_LOGV(TAG, "OTA size is %u bytes", ota_size);
|
||||||
|
|
||||||
backend = make_ota_backend();
|
|
||||||
error_code = backend->begin(ota_size);
|
error_code = backend->begin(ota_size);
|
||||||
if (error_code != OTA_RESPONSE_OK)
|
if (error_code != OTA_RESPONSE_OK)
|
||||||
goto error;
|
goto error;
|
||||||
@ -275,6 +282,12 @@ void OTAComponent::handle_() {
|
|||||||
}
|
}
|
||||||
ESP_LOGW(TAG, "Error receiving data for update, errno: %d", errno);
|
ESP_LOGW(TAG, "Error receiving data for update, errno: %d", errno);
|
||||||
goto error;
|
goto error;
|
||||||
|
} else if (read == 0) {
|
||||||
|
// $ man recv
|
||||||
|
// "When a stream socket peer has performed an orderly shutdown, the return value will
|
||||||
|
// be 0 (the traditional "end-of-file" return)."
|
||||||
|
ESP_LOGW(TAG, "Remote end closed connection");
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code = backend->write(buf, read);
|
error_code = backend->write(buf, read);
|
||||||
@ -362,6 +375,9 @@ bool OTAComponent::readall_(uint8_t *buf, size_t len) {
|
|||||||
}
|
}
|
||||||
ESP_LOGW(TAG, "Failed to read %d bytes of data, errno: %d", len, errno);
|
ESP_LOGW(TAG, "Failed to read %d bytes of data, errno: %d", len, errno);
|
||||||
return false;
|
return false;
|
||||||
|
} else if (read == 0) {
|
||||||
|
ESP_LOGW(TAG, "Remote closed connection");
|
||||||
|
return false;
|
||||||
} else {
|
} else {
|
||||||
at += read;
|
at += read;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ enum OTAResponseTypes {
|
|||||||
OTA_RESPONSE_BIN_MD5_OK = 67,
|
OTA_RESPONSE_BIN_MD5_OK = 67,
|
||||||
OTA_RESPONSE_RECEIVE_OK = 68,
|
OTA_RESPONSE_RECEIVE_OK = 68,
|
||||||
OTA_RESPONSE_UPDATE_END_OK = 69,
|
OTA_RESPONSE_UPDATE_END_OK = 69,
|
||||||
|
OTA_RESPONSE_SUPPORTS_COMPRESSION = 70,
|
||||||
|
|
||||||
OTA_RESPONSE_ERROR_MAGIC = 128,
|
OTA_RESPONSE_ERROR_MAGIC = 128,
|
||||||
OTA_RESPONSE_ERROR_UPDATE_PREPARE = 129,
|
OTA_RESPONSE_ERROR_UPDATE_PREPARE = 129,
|
||||||
|
@ -320,8 +320,7 @@ class LWIPRawImpl : public Socket {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (rx_closed_ && rx_buf_ == nullptr) {
|
if (rx_closed_ && rx_buf_ == nullptr) {
|
||||||
errno = ECONNRESET;
|
return 0;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
@ -366,6 +365,11 @@ class LWIPRawImpl : public Socket {
|
|||||||
read += copysize;
|
read += copysize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (read == 0) {
|
||||||
|
errno = EWOULDBLOCK;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return read;
|
return read;
|
||||||
}
|
}
|
||||||
ssize_t readv(const struct iovec *iov, int iovcnt) override {
|
ssize_t readv(const struct iovec *iov, int iovcnt) override {
|
||||||
|
@ -80,8 +80,8 @@ def validate_mode(value):
|
|||||||
CONF_SX1509 = "sx1509"
|
CONF_SX1509 = "sx1509"
|
||||||
SX1509_PIN_SCHEMA = cv.All(
|
SX1509_PIN_SCHEMA = cv.All(
|
||||||
{
|
{
|
||||||
cv.GenerateID(): cv.declare_id(SX1509Component),
|
cv.GenerateID(): cv.declare_id(SX1509GPIOPin),
|
||||||
cv.Required(CONF_SX1509): cv.use_id(SX1509GPIOPin),
|
cv.Required(CONF_SX1509): cv.use_id(SX1509Component),
|
||||||
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15),
|
cv.Required(CONF_NUMBER): cv.int_range(min=0, max=15),
|
||||||
cv.Optional(CONF_MODE, default={}): cv.All(
|
cv.Optional(CONF_MODE, default={}): cv.All(
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ i2c::ErrorCode TCA9548AChannel::writev(uint8_t address, i2c::WriteBuffer *buffer
|
|||||||
void TCA9548AComponent::setup() {
|
void TCA9548AComponent::setup() {
|
||||||
ESP_LOGCONFIG(TAG, "Setting up TCA9548A...");
|
ESP_LOGCONFIG(TAG, "Setting up TCA9548A...");
|
||||||
uint8_t status = 0;
|
uint8_t status = 0;
|
||||||
if (!this->read_register(0x00, &status, 1)) {
|
if (this->read_register(0x00, &status, 1) != i2c::ERROR_OK) {
|
||||||
ESP_LOGI(TAG, "TCA9548A failed");
|
ESP_LOGI(TAG, "TCA9548A failed");
|
||||||
this->mark_failed();
|
this->mark_failed();
|
||||||
return;
|
return;
|
||||||
|
@ -414,6 +414,8 @@ std::string WebServer::fan_json(fan::FanState *obj) {
|
|||||||
const auto traits = obj->get_traits();
|
const auto traits = obj->get_traits();
|
||||||
if (traits.supports_speed()) {
|
if (traits.supports_speed()) {
|
||||||
root["speed_level"] = obj->speed;
|
root["speed_level"] = obj->speed;
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
|
// NOLINTNEXTLINE(clang-diagnostic-deprecated-declarations)
|
||||||
switch (fan::speed_level_to_enum(obj->speed, traits.supported_speed_count())) {
|
switch (fan::speed_level_to_enum(obj->speed, traits.supported_speed_count())) {
|
||||||
case fan::FAN_SPEED_LOW: // NOLINT(clang-diagnostic-deprecated-declarations)
|
case fan::FAN_SPEED_LOW: // NOLINT(clang-diagnostic-deprecated-declarations)
|
||||||
@ -426,6 +428,7 @@ std::string WebServer::fan_json(fan::FanState *obj) {
|
|||||||
root["speed"] = "high";
|
root["speed"] = "high";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
if (obj->get_traits().supports_oscillation())
|
if (obj->get_traits().supports_oscillation())
|
||||||
root["oscillation"] = obj->oscillating;
|
root["oscillation"] = obj->oscillating;
|
||||||
@ -448,7 +451,10 @@ void WebServer::handle_fan_request(AsyncWebServerRequest *request, const UrlMatc
|
|||||||
auto call = obj->turn_on();
|
auto call = obj->turn_on();
|
||||||
if (request->hasParam("speed")) {
|
if (request->hasParam("speed")) {
|
||||||
String speed = request->getParam("speed")->value();
|
String speed = request->getParam("speed")->value();
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
call.set_speed(speed.c_str()); // NOLINT(clang-diagnostic-deprecated-declarations)
|
call.set_speed(speed.c_str()); // NOLINT(clang-diagnostic-deprecated-declarations)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
if (request->hasParam("speed_level")) {
|
if (request->hasParam("speed_level")) {
|
||||||
String speed_level = request->getParam("speed_level")->value();
|
String speed_level = request->getParam("speed_level")->value();
|
||||||
|
@ -28,4 +28,4 @@ async def to_code(config):
|
|||||||
cg.add_library("FS", None)
|
cg.add_library("FS", None)
|
||||||
cg.add_library("Update", None)
|
cg.add_library("Update", None)
|
||||||
# https://github.com/esphome/ESPAsyncWebServer/blob/master/library.json
|
# https://github.com/esphome/ESPAsyncWebServer/blob/master/library.json
|
||||||
cg.add_library("esphome/ESPAsyncWebServer-esphome", "1.3.0")
|
cg.add_library("esphome/ESPAsyncWebServer-esphome", "2.0.0")
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2021.10.1"
|
__version__ = "2021.10.2"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
|
|
||||||
TARGET_PLATFORMS = ["esp32", "esp8266"]
|
PLATFORM_ESP32 = "esp32"
|
||||||
|
PLATFORM_ESP8266 = "esp8266"
|
||||||
|
|
||||||
|
TARGET_PLATFORMS = [PLATFORM_ESP32, PLATFORM_ESP8266]
|
||||||
TARGET_FRAMEWORKS = ["arduino", "esp-idf"]
|
TARGET_FRAMEWORKS = ["arduino", "esp-idf"]
|
||||||
|
|
||||||
# See also https://github.com/platformio/platform-espressif8266/releases
|
# See also https://github.com/platformio/platform-espressif8266/releases
|
||||||
|
@ -29,6 +29,7 @@ from esphome.const import (
|
|||||||
CONF_VERSION,
|
CONF_VERSION,
|
||||||
KEY_CORE,
|
KEY_CORE,
|
||||||
TARGET_PLATFORMS,
|
TARGET_PLATFORMS,
|
||||||
|
PLATFORM_ESP8266,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
from esphome.helpers import copy_file_if_changed, walk_files
|
from esphome.helpers import copy_file_if_changed, walk_files
|
||||||
@ -182,9 +183,13 @@ def preload_core_config(config, result):
|
|||||||
if CONF_BOARD_FLASH_MODE in conf:
|
if CONF_BOARD_FLASH_MODE in conf:
|
||||||
plat_conf[CONF_BOARD_FLASH_MODE] = conf.pop(CONF_BOARD_FLASH_MODE)
|
plat_conf[CONF_BOARD_FLASH_MODE] = conf.pop(CONF_BOARD_FLASH_MODE)
|
||||||
if CONF_ARDUINO_VERSION in conf:
|
if CONF_ARDUINO_VERSION in conf:
|
||||||
plat_conf[CONF_FRAMEWORK] = {CONF_TYPE: "arduino"}
|
plat_conf[CONF_FRAMEWORK] = {}
|
||||||
|
if plat != PLATFORM_ESP8266:
|
||||||
|
plat_conf[CONF_FRAMEWORK][CONF_TYPE] = "arduino"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cv.Version.parse(conf[CONF_ARDUINO_VERSION])
|
if conf[CONF_ARDUINO_VERSION] not in ("recommended", "latest", "dev"):
|
||||||
|
cv.Version.parse(conf[CONF_ARDUINO_VERSION])
|
||||||
plat_conf[CONF_FRAMEWORK][CONF_VERSION] = conf.pop(CONF_ARDUINO_VERSION)
|
plat_conf[CONF_FRAMEWORK][CONF_VERSION] = conf.pop(CONF_ARDUINO_VERSION)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
plat_conf[CONF_FRAMEWORK][CONF_SOURCE] = conf.pop(CONF_ARDUINO_VERSION)
|
plat_conf[CONF_FRAMEWORK][CONF_SOURCE] = conf.pop(CONF_ARDUINO_VERSION)
|
||||||
|
@ -358,6 +358,7 @@ template<typename T> T clamp(const T val, const T min, const T max) {
|
|||||||
return max;
|
return max;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
template uint8_t clamp(uint8_t, uint8_t, uint8_t);
|
||||||
template float clamp(float, float, float);
|
template float clamp(float, float, float);
|
||||||
template int clamp(int, int, int);
|
template int clamp(int, int, int);
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import random
|
|||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import gzip
|
||||||
|
|
||||||
from esphome.core import EsphomeError
|
from esphome.core import EsphomeError
|
||||||
from esphome.helpers import is_ip_address, resolve_ip_address
|
from esphome.helpers import is_ip_address, resolve_ip_address
|
||||||
@ -17,6 +18,7 @@ RESPONSE_UPDATE_PREPARE_OK = 66
|
|||||||
RESPONSE_BIN_MD5_OK = 67
|
RESPONSE_BIN_MD5_OK = 67
|
||||||
RESPONSE_RECEIVE_OK = 68
|
RESPONSE_RECEIVE_OK = 68
|
||||||
RESPONSE_UPDATE_END_OK = 69
|
RESPONSE_UPDATE_END_OK = 69
|
||||||
|
RESPONSE_SUPPORTS_COMPRESSION = 70
|
||||||
|
|
||||||
RESPONSE_ERROR_MAGIC = 128
|
RESPONSE_ERROR_MAGIC = 128
|
||||||
RESPONSE_ERROR_UPDATE_PREPARE = 129
|
RESPONSE_ERROR_UPDATE_PREPARE = 129
|
||||||
@ -34,6 +36,8 @@ OTA_VERSION_1_0 = 1
|
|||||||
|
|
||||||
MAGIC_BYTES = [0x6C, 0x26, 0xF7, 0x5C, 0x45]
|
MAGIC_BYTES = [0x6C, 0x26, 0xF7, 0x5C, 0x45]
|
||||||
|
|
||||||
|
FEATURE_SUPPORTS_COMPRESSION = 0x01
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -170,11 +174,9 @@ def send_check(sock, data, msg):
|
|||||||
|
|
||||||
|
|
||||||
def perform_ota(sock, password, file_handle, filename):
|
def perform_ota(sock, password, file_handle, filename):
|
||||||
file_md5 = hashlib.md5(file_handle.read()).hexdigest()
|
file_contents = file_handle.read()
|
||||||
file_size = file_handle.tell()
|
file_size = len(file_contents)
|
||||||
_LOGGER.info("Uploading %s (%s bytes)", filename, file_size)
|
_LOGGER.info("Uploading %s (%s bytes)", filename, file_size)
|
||||||
file_handle.seek(0)
|
|
||||||
_LOGGER.debug("MD5 of binary is %s", file_md5)
|
|
||||||
|
|
||||||
# Enable nodelay, we need it for phase 1
|
# Enable nodelay, we need it for phase 1
|
||||||
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||||
@ -185,8 +187,16 @@ def perform_ota(sock, password, file_handle, filename):
|
|||||||
raise OTAError(f"Unsupported OTA version {version}")
|
raise OTAError(f"Unsupported OTA version {version}")
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
send_check(sock, 0x00, "features")
|
send_check(sock, FEATURE_SUPPORTS_COMPRESSION, "features")
|
||||||
receive_exactly(sock, 1, "features", RESPONSE_HEADER_OK)
|
features = receive_exactly(
|
||||||
|
sock, 1, "features", [RESPONSE_HEADER_OK, RESPONSE_SUPPORTS_COMPRESSION]
|
||||||
|
)[0]
|
||||||
|
|
||||||
|
if features == RESPONSE_SUPPORTS_COMPRESSION:
|
||||||
|
upload_contents = gzip.compress(file_contents, compresslevel=9)
|
||||||
|
_LOGGER.info("Compressed to %s bytes", len(upload_contents))
|
||||||
|
else:
|
||||||
|
upload_contents = file_contents
|
||||||
|
|
||||||
(auth,) = receive_exactly(
|
(auth,) = receive_exactly(
|
||||||
sock, 1, "auth", [RESPONSE_REQUEST_AUTH, RESPONSE_AUTH_OK]
|
sock, 1, "auth", [RESPONSE_REQUEST_AUTH, RESPONSE_AUTH_OK]
|
||||||
@ -213,16 +223,20 @@ def perform_ota(sock, password, file_handle, filename):
|
|||||||
send_check(sock, result, "auth result")
|
send_check(sock, result, "auth result")
|
||||||
receive_exactly(sock, 1, "auth result", RESPONSE_AUTH_OK)
|
receive_exactly(sock, 1, "auth result", RESPONSE_AUTH_OK)
|
||||||
|
|
||||||
file_size_encoded = [
|
upload_size = len(upload_contents)
|
||||||
(file_size >> 24) & 0xFF,
|
upload_size_encoded = [
|
||||||
(file_size >> 16) & 0xFF,
|
(upload_size >> 24) & 0xFF,
|
||||||
(file_size >> 8) & 0xFF,
|
(upload_size >> 16) & 0xFF,
|
||||||
(file_size >> 0) & 0xFF,
|
(upload_size >> 8) & 0xFF,
|
||||||
|
(upload_size >> 0) & 0xFF,
|
||||||
]
|
]
|
||||||
send_check(sock, file_size_encoded, "binary size")
|
send_check(sock, upload_size_encoded, "binary size")
|
||||||
receive_exactly(sock, 1, "binary size", RESPONSE_UPDATE_PREPARE_OK)
|
receive_exactly(sock, 1, "binary size", RESPONSE_UPDATE_PREPARE_OK)
|
||||||
|
|
||||||
send_check(sock, file_md5, "file checksum")
|
upload_md5 = hashlib.md5(upload_contents).hexdigest()
|
||||||
|
_LOGGER.debug("MD5 of upload is %s", upload_md5)
|
||||||
|
|
||||||
|
send_check(sock, upload_md5, "file checksum")
|
||||||
receive_exactly(sock, 1, "file checksum", RESPONSE_BIN_MD5_OK)
|
receive_exactly(sock, 1, "file checksum", RESPONSE_BIN_MD5_OK)
|
||||||
|
|
||||||
# Disable nodelay for transfer
|
# Disable nodelay for transfer
|
||||||
@ -236,7 +250,7 @@ def perform_ota(sock, password, file_handle, filename):
|
|||||||
offset = 0
|
offset = 0
|
||||||
progress = ProgressBar()
|
progress = ProgressBar()
|
||||||
while True:
|
while True:
|
||||||
chunk = file_handle.read(1024)
|
chunk = upload_contents[offset : offset + 1024]
|
||||||
if not chunk:
|
if not chunk:
|
||||||
break
|
break
|
||||||
offset += len(chunk)
|
offset += len(chunk)
|
||||||
@ -247,7 +261,7 @@ def perform_ota(sock, password, file_handle, filename):
|
|||||||
sys.stderr.write("\n")
|
sys.stderr.write("\n")
|
||||||
raise OTAError(f"Error sending data: {err}") from err
|
raise OTAError(f"Error sending data: {err}") from err
|
||||||
|
|
||||||
progress.update(offset / float(file_size))
|
progress.update(offset / upload_size)
|
||||||
progress.done()
|
progress.done()
|
||||||
|
|
||||||
# Enable nodelay for last checks
|
# Enable nodelay for last checks
|
||||||
|
@ -46,24 +46,31 @@ IGNORE_LIB_WARNINGS = f"(?:{'|'.join(['Hash', 'Update'])})"
|
|||||||
FILTER_PLATFORMIO_LINES = [
|
FILTER_PLATFORMIO_LINES = [
|
||||||
r"Verbose mode can be enabled via `-v, --verbose` option.*",
|
r"Verbose mode can be enabled via `-v, --verbose` option.*",
|
||||||
r"CONFIGURATION: https://docs.platformio.org/.*",
|
r"CONFIGURATION: https://docs.platformio.org/.*",
|
||||||
r"PLATFORM: .*",
|
|
||||||
r"DEBUG: Current.*",
|
r"DEBUG: Current.*",
|
||||||
r"PACKAGES: .*",
|
r"LDF Modes:.*",
|
||||||
r"LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf.*",
|
r"LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf.*",
|
||||||
r"LDF Modes: Finder ~ chain, Compatibility ~ soft.*",
|
|
||||||
f"Looking for {IGNORE_LIB_WARNINGS} library in registry",
|
f"Looking for {IGNORE_LIB_WARNINGS} library in registry",
|
||||||
f"Warning! Library `.*'{IGNORE_LIB_WARNINGS}.*` has not been found in PlatformIO Registry.",
|
f"Warning! Library `.*'{IGNORE_LIB_WARNINGS}.*` has not been found in PlatformIO Registry.",
|
||||||
f"You can ignore this message, if `.*{IGNORE_LIB_WARNINGS}.*` is a built-in library.*",
|
f"You can ignore this message, if `.*{IGNORE_LIB_WARNINGS}.*` is a built-in library.*",
|
||||||
r"Scanning dependencies...",
|
r"Scanning dependencies...",
|
||||||
r"Found \d+ compatible libraries",
|
r"Found \d+ compatible libraries",
|
||||||
r"Memory Usage -> http://bit.ly/pio-memory-usage",
|
r"Memory Usage -> http://bit.ly/pio-memory-usage",
|
||||||
r"esptool.py v.*",
|
|
||||||
r"Found: https://platformio.org/lib/show/.*",
|
r"Found: https://platformio.org/lib/show/.*",
|
||||||
r"Using cache: .*",
|
r"Using cache: .*",
|
||||||
r"Installing dependencies",
|
r"Installing dependencies",
|
||||||
r".* @ .* is already installed",
|
r"Library Manager: Already installed, built-in library",
|
||||||
r"Building in .* mode",
|
r"Building in .* mode",
|
||||||
r"Advanced Memory Usage is available via .*",
|
r"Advanced Memory Usage is available via .*",
|
||||||
|
r"Merged .* ELF section",
|
||||||
|
r"esptool.py v.*",
|
||||||
|
r"Checking size .*",
|
||||||
|
r"Retrieving maximum program size .*",
|
||||||
|
r"PLATFORM: .*",
|
||||||
|
r"PACKAGES:.*",
|
||||||
|
r" - framework-arduinoespressif.* \(.*\)",
|
||||||
|
r" - tool-esptool.* \(.*\)",
|
||||||
|
r" - toolchain-.* \(.*\)",
|
||||||
|
r"Creating BIN file .*",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,8 +192,8 @@ def run_external_command(
|
|||||||
sys.argv = list(cmd)
|
sys.argv = list(cmd)
|
||||||
sys.exit = mock_exit
|
sys.exit = mock_exit
|
||||||
return func() or 0
|
return func() or 0
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt: # pylint: disable=try-except-raise
|
||||||
return 1
|
raise
|
||||||
except SystemExit as err:
|
except SystemExit as err:
|
||||||
return err.args[0]
|
return err.args[0]
|
||||||
except Exception as err: # pylint: disable=broad-except
|
except Exception as err: # pylint: disable=broad-except
|
||||||
@ -227,6 +227,8 @@ def run_external_process(*cmd, **kwargs):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
return subprocess.call(cmd, stdout=sub_stdout, stderr=sub_stderr)
|
return subprocess.call(cmd, stdout=sub_stdout, stderr=sub_stderr)
|
||||||
|
except KeyboardInterrupt: # pylint: disable=try-except-raise
|
||||||
|
raise
|
||||||
except Exception as err: # pylint: disable=broad-except
|
except Exception as err: # pylint: disable=broad-except
|
||||||
_LOGGER.error("Running command failed: %s", err)
|
_LOGGER.error("Running command failed: %s", err)
|
||||||
_LOGGER.error("Please try running %s locally.", full_cmd)
|
_LOGGER.error("Please try running %s locally.", full_cmd)
|
||||||
|
@ -26,7 +26,7 @@ build_flags =
|
|||||||
|
|
||||||
[common]
|
[common]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
esphome/noise-c@0.1.3 ; api
|
esphome/noise-c@0.1.4 ; api
|
||||||
makuna/NeoPixelBus@2.6.7 ; neopixelbus
|
makuna/NeoPixelBus@2.6.7 ; neopixelbus
|
||||||
build_flags =
|
build_flags =
|
||||||
-DESPHOME_LOG_LEVEL=ESPHOME_LOG_LEVEL_VERY_VERBOSE
|
-DESPHOME_LOG_LEVEL=ESPHOME_LOG_LEVEL_VERY_VERBOSE
|
||||||
@ -39,9 +39,9 @@ src_filter =
|
|||||||
extends = common
|
extends = common
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${common.lib_deps}
|
${common.lib_deps}
|
||||||
ottowinter/AsyncMqttClient-esphome@0.8.4 ; mqtt
|
ottowinter/AsyncMqttClient-esphome@0.8.6 ; mqtt
|
||||||
ottowinter/ArduinoJson-esphomelib@5.13.3 ; json
|
ottowinter/ArduinoJson-esphomelib@5.13.3 ; json
|
||||||
esphome/ESPAsyncWebServer-esphome@1.3.0 ; web_server_base
|
esphome/ESPAsyncWebServer-esphome@2.0.0 ; web_server_base
|
||||||
fastled/FastLED@3.3.2 ; fastled_base
|
fastled/FastLED@3.3.2 ; fastled_base
|
||||||
mikalhart/TinyGPSPlus@1.0.2 ; gps
|
mikalhart/TinyGPSPlus@1.0.2 ; gps
|
||||||
freekode/TM1651@1.0.1 ; tm1651
|
freekode/TM1651@1.0.1 ; tm1651
|
||||||
@ -49,7 +49,7 @@ lib_deps =
|
|||||||
glmnet/Dsmr@0.5 ; dsmr
|
glmnet/Dsmr@0.5 ; dsmr
|
||||||
rweather/Crypto@0.2.0 ; dsmr
|
rweather/Crypto@0.2.0 ; dsmr
|
||||||
dudanov/MideaUART@1.1.8 ; midea
|
dudanov/MideaUART@1.1.8 ; midea
|
||||||
tonia/HeatpumpIR@^1.0.15 ; heatpumpir
|
tonia/HeatpumpIR@1.0.15 ; heatpumpir
|
||||||
build_flags =
|
build_flags =
|
||||||
${common.build_flags}
|
${common.build_flags}
|
||||||
-DUSE_ARDUINO
|
-DUSE_ARDUINO
|
||||||
|
@ -9,7 +9,7 @@ pyserial==3.5
|
|||||||
platformio==5.2.1 # When updating platformio, also update Dockerfile
|
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.1
|
||||||
aioesphomeapi==9.1.5
|
aioesphomeapi==9.1.5
|
||||||
|
|
||||||
# esp-idf requires this, but doesn't bundle it by default
|
# esp-idf requires this, but doesn't bundle it by default
|
||||||
|
@ -59,6 +59,10 @@ tuya:
|
|||||||
pipsolar:
|
pipsolar:
|
||||||
id: inverter0
|
id: inverter0
|
||||||
|
|
||||||
|
sx1509:
|
||||||
|
- id: sx1509_hub
|
||||||
|
address: 0x3E
|
||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: homeassistant
|
- platform: homeassistant
|
||||||
entity_id: sensor.hello_world
|
entity_id: sensor.hello_world
|
||||||
@ -209,6 +213,7 @@ sensor:
|
|||||||
- or:
|
- or:
|
||||||
- throttle: "20min"
|
- throttle: "20min"
|
||||||
- delta: 0.02
|
- delta: 0.02
|
||||||
|
|
||||||
#
|
#
|
||||||
# platform sensor.apds9960 requires component apds9960
|
# platform sensor.apds9960 requires component apds9960
|
||||||
#
|
#
|
||||||
@ -308,6 +313,11 @@ binary_sensor:
|
|||||||
y_max: 212
|
y_max: 212
|
||||||
on_state:
|
on_state:
|
||||||
- lambda: 'ESP_LOGI("main", "key0: %s", (x ? "touch" : "release"));'
|
- lambda: 'ESP_LOGI("main", "key0: %s", (x ? "touch" : "release"));'
|
||||||
|
- platform: gpio
|
||||||
|
name: GPIO SX1509 test
|
||||||
|
pin:
|
||||||
|
sx1509: sx1509_hub
|
||||||
|
number: 3
|
||||||
|
|
||||||
climate:
|
climate:
|
||||||
- platform: tuya
|
- platform: tuya
|
||||||
|
Loading…
Reference in New Issue
Block a user