Compare commits

...

29 Commits

Author SHA1 Message Date
Jesse Hills
041eb8f6cc Merge pull request #3783 from esphome/bump-2022.8.3
2022.8.3
2022-09-06 18:54:28 +12:00
Jesse Hills
733a84df75 Bump version to 2022.8.3 2022-09-06 16:50:17 +12:00
Jesse Hills
acd0b50b40 Fix HA addon auth using HA credentials (#3758) 2022-09-06 16:50:11 +12:00
Jesse Hills
60e46d485e Merge pull request #3781 from esphome/bump-2022.8.2
2022.8.2
2022-09-06 15:38:46 +12:00
Jesse Hills
5bf0c92318 Bump version to 2022.8.2 2022-09-06 13:12:00 +12:00
Avirsaam
39d493c278 Update modbus_controller.cpp (#3768) 2022-09-06 13:12:00 +12:00
anatoly-savchenkov
d2ce62aa13 Ignore NaN states in the integration component (#3767) 2022-09-06 13:12:00 +12:00
Jesse Hills
c8eb30ef27 Initial bluetooth_proxy support (#3736) 2022-09-06 13:11:54 +12:00
Jesse Hills
31ad75d01b Merge pull request #3757 from esphome/bump-2022.8.1
2022.8.1
2022-09-01 13:59:03 +12:00
Jesse Hills
aa2eb29274 Bump version to 2022.8.1 2022-09-01 11:26:52 +12:00
Keith Burzinski
22eb4f9cb9 Fix SPI HW selection for ESP32 variants (#3728) 2022-09-01 11:26:51 +12:00
Samuel Sieb
3acc8e7479 fix grow password setting (#3722)
Co-authored-by: Samuel Sieb <samuel@sieb.net>
2022-09-01 11:26:51 +12:00
Jesse Hills
adc8c1aa38 Merge pull request #3721 from esphome/bump-2022.8.0
2022.8.0
2022-08-17 13:31:24 +12:00
Jesse Hills
3a82f500d4 Bump version to 2022.8.0 2022-08-17 12:58:30 +12:00
Jesse Hills
7d1d4831a8 Merge branch 'beta' into bump-2022.8.0 2022-08-17 12:58:29 +12:00
Jesse Hills
ab86ddcf02 Merge pull request #3692 from esphome/bump-2022.6.3
2022.6.3
2022-08-08 11:48:35 +12:00
Jesse Hills
bf8eddb13b Bump version to 2022.6.3 2022-08-08 08:24:12 +12:00
Samuel Sieb
e5eaf7a3fe Use correct struct members. (#3672) 2022-08-08 08:24:12 +12:00
Samuel Sieb
50f32a3aa5 Use application/json instead of text/json (#3671) 2022-08-08 08:24:11 +12:00
Bryan Berg
eb878710c1 Add CO device class to binary_sensor (#3656) 2022-08-08 08:24:11 +12:00
Samuel Sieb
311980e0e4 Update inkbird_ibsth1_mini.cpp (#3664) 2022-08-08 08:24:11 +12:00
Javier Peletier
df73170e5a modbus: fix queue deduplicator erasing custom commands (#3650) 2022-08-08 08:24:11 +12:00
Jesse Hills
ccc13cc9e1 Merge pull request #3596 from esphome/bump-2022.6.2
2022.6.2
2022-06-23 11:30:31 +12:00
Jesse Hills
020b2c05c8 Bump version to 2022.6.2 2022-06-23 10:34:10 +12:00
Joe
4c37c17df1 Fix 2 small issues in BLEClient (#3544) 2022-06-23 10:34:09 +12:00
Sergey Dudanov
8f67acadd8 Media Player: added play_media action (#3579)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2022-06-23 10:34:09 +12:00
kahrendt
ca13c4c1a6 Fix wrong type for voc_state*_ in sgp4x component (#3581)
Co-authored-by: Martin <25747549+martgras@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2022-06-23 10:34:09 +12:00
ShellAddicted
d0c646c721 Fix: Make MQTT over TLS actually work (#3580) 2022-06-23 10:34:09 +12:00
lkomurcu
8a055675af Move gas mbus config option being a define to being a build flag since its used in external libraries. (#3575) 2022-06-23 10:34:09 +12:00
23 changed files with 413 additions and 11 deletions

View File

@@ -34,6 +34,7 @@ esphome/components/binary_sensor/* @esphome/core
esphome/components/bl0939/* @ziceva
esphome/components/bl0940/* @tobias-
esphome/components/ble_client/* @buxtronix
esphome/components/bluetooth_proxy/* @jesserockz
esphome/components/bme680_bsec/* @trvrnrth
esphome/components/bmp3xx/* @martgras
esphome/components/button/* @esphome/core

View File

@@ -27,6 +27,7 @@ service APIConnection {
rpc subscribe_logs (SubscribeLogsRequest) returns (void) {}
rpc subscribe_homeassistant_services (SubscribeHomeassistantServicesRequest) returns (void) {}
rpc subscribe_home_assistant_states (SubscribeHomeAssistantStatesRequest) returns (void) {}
rpc subscribe_bluetooth_le_advertisements (SubscribeBluetoothLEAdvertisementsRequest) returns (void) {}
rpc get_time (GetTimeRequest) returns (GetTimeResponse) {
option (needs_authentication) = false;
}
@@ -190,6 +191,8 @@ message DeviceInfoResponse {
string project_version = 9;
uint32 webserver_port = 10;
bool has_bluetooth_proxy = 11;
}
message ListEntitiesRequest {
@@ -1099,3 +1102,28 @@ message MediaPlayerCommandRequest {
bool has_media_url = 6;
string media_url = 7;
}
// ==================== BLUETOOTH ====================
message SubscribeBluetoothLEAdvertisementsRequest {
option (id) = 66;
option (source) = SOURCE_CLIENT;
}
message BluetoothServiceData {
string uuid = 1;
repeated uint32 data = 2 [packed=false];
}
message BluetoothLEAdvertisementResponse {
option (id) = 67;
option (source) = SOURCE_SERVER;
option (ifdef) = "USE_BLUETOOTH_PROXY";
option (no_delay) = true;
uint64 address = 1;
string name = 2;
sint32 rssi = 3;
repeated string service_uuids = 4;
repeated BluetoothServiceData service_data = 5;
repeated BluetoothServiceData manufacturer_data = 6;
}

View File

@@ -886,6 +886,9 @@ DeviceInfoResponse APIConnection::device_info(const DeviceInfoRequest &msg) {
#endif
#ifdef USE_WEBSERVER
resp.webserver_port = USE_WEBSERVER_PORT;
#endif
#ifdef USE_BLUETOOTH_PROXY
resp.has_bluetooth_proxy = true;
#endif
return resp;
}

View File

@@ -7,6 +7,10 @@
#include "api_server.h"
#include "api_frame_helper.h"
#ifdef USE_BLUETOOTH_PROXY
#include "esphome/components/bluetooth_proxy/bluetooth_proxy.h"
#endif
namespace esphome {
namespace api {
@@ -94,6 +98,13 @@ class APIConnection : public APIServerConnection {
return;
this->send_homeassistant_service_response(call);
}
#ifdef USE_BLUETOOTH_PROXY
bool send_bluetooth_le_advertisement(const BluetoothLEAdvertisementResponse &call) {
if (!this->bluetooth_le_advertisement_subscription_)
return false;
return this->send_bluetooth_le_advertisement_response(call);
}
#endif
#ifdef USE_HOMEASSISTANT_TIME
void send_time_request() {
GetTimeRequest req;
@@ -134,6 +145,9 @@ class APIConnection : public APIServerConnection {
return {};
}
void execute_service(const ExecuteServiceRequest &msg) override;
void subscribe_bluetooth_le_advertisements(const SubscribeBluetoothLEAdvertisementsRequest &msg) override {
this->bluetooth_le_advertisement_subscription_ = true;
}
bool is_authenticated() override { return this->connection_state_ == ConnectionState::AUTHENTICATED; }
bool is_connection_setup() override {
return this->connection_state_ == ConnectionState ::CONNECTED || this->is_authenticated();
@@ -176,6 +190,7 @@ class APIConnection : public APIServerConnection {
uint32_t last_traffic_;
bool sent_ping_{false};
bool service_call_subscription_{false};
bool bluetooth_le_advertisement_subscription_{true};
bool next_close_ = false;
APIServer *parent_;
InitialStateIterator initial_state_iterator_;

View File

@@ -495,6 +495,10 @@ bool DeviceInfoResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
this->webserver_port = value.as_uint32();
return true;
}
case 11: {
this->has_bluetooth_proxy = value.as_bool();
return true;
}
default:
return false;
}
@@ -544,6 +548,7 @@ void DeviceInfoResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_string(8, this->project_name);
buffer.encode_string(9, this->project_version);
buffer.encode_uint32(10, this->webserver_port);
buffer.encode_bool(11, this->has_bluetooth_proxy);
}
#ifdef HAS_PROTO_MESSAGE_DUMP
void DeviceInfoResponse::dump_to(std::string &out) const {
@@ -589,6 +594,10 @@ void DeviceInfoResponse::dump_to(std::string &out) const {
sprintf(buffer, "%u", this->webserver_port);
out.append(buffer);
out.append("\n");
out.append(" has_bluetooth_proxy: ");
out.append(YESNO(this->has_bluetooth_proxy));
out.append("\n");
out.append("}");
}
#endif
@@ -4854,6 +4863,143 @@ void MediaPlayerCommandRequest::dump_to(std::string &out) const {
out.append("}");
}
#endif
void SubscribeBluetoothLEAdvertisementsRequest::encode(ProtoWriteBuffer buffer) const {}
#ifdef HAS_PROTO_MESSAGE_DUMP
void SubscribeBluetoothLEAdvertisementsRequest::dump_to(std::string &out) const {
out.append("SubscribeBluetoothLEAdvertisementsRequest {}");
}
#endif
bool BluetoothServiceData::decode_varint(uint32_t field_id, ProtoVarInt value) {
switch (field_id) {
case 2: {
this->data.push_back(value.as_uint32());
return true;
}
default:
return false;
}
}
bool BluetoothServiceData::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
switch (field_id) {
case 1: {
this->uuid = value.as_string();
return true;
}
default:
return false;
}
}
void BluetoothServiceData::encode(ProtoWriteBuffer buffer) const {
buffer.encode_string(1, this->uuid);
for (auto &it : this->data) {
buffer.encode_uint32(2, it, true);
}
}
#ifdef HAS_PROTO_MESSAGE_DUMP
void BluetoothServiceData::dump_to(std::string &out) const {
__attribute__((unused)) char buffer[64];
out.append("BluetoothServiceData {\n");
out.append(" uuid: ");
out.append("'").append(this->uuid).append("'");
out.append("\n");
for (const auto &it : this->data) {
out.append(" data: ");
sprintf(buffer, "%u", it);
out.append(buffer);
out.append("\n");
}
out.append("}");
}
#endif
bool BluetoothLEAdvertisementResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
switch (field_id) {
case 1: {
this->address = value.as_uint64();
return true;
}
case 3: {
this->rssi = value.as_sint32();
return true;
}
default:
return false;
}
}
bool BluetoothLEAdvertisementResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
switch (field_id) {
case 2: {
this->name = value.as_string();
return true;
}
case 4: {
this->service_uuids.push_back(value.as_string());
return true;
}
case 5: {
this->service_data.push_back(value.as_message<BluetoothServiceData>());
return true;
}
case 6: {
this->manufacturer_data.push_back(value.as_message<BluetoothServiceData>());
return true;
}
default:
return false;
}
}
void BluetoothLEAdvertisementResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_uint64(1, this->address);
buffer.encode_string(2, this->name);
buffer.encode_sint32(3, this->rssi);
for (auto &it : this->service_uuids) {
buffer.encode_string(4, it, true);
}
for (auto &it : this->service_data) {
buffer.encode_message<BluetoothServiceData>(5, it, true);
}
for (auto &it : this->manufacturer_data) {
buffer.encode_message<BluetoothServiceData>(6, it, true);
}
}
#ifdef HAS_PROTO_MESSAGE_DUMP
void BluetoothLEAdvertisementResponse::dump_to(std::string &out) const {
__attribute__((unused)) char buffer[64];
out.append("BluetoothLEAdvertisementResponse {\n");
out.append(" address: ");
sprintf(buffer, "%llu", this->address);
out.append(buffer);
out.append("\n");
out.append(" name: ");
out.append("'").append(this->name).append("'");
out.append("\n");
out.append(" rssi: ");
sprintf(buffer, "%d", this->rssi);
out.append(buffer);
out.append("\n");
for (const auto &it : this->service_uuids) {
out.append(" service_uuids: ");
out.append("'").append(it).append("'");
out.append("\n");
}
for (const auto &it : this->service_data) {
out.append(" service_data: ");
it.dump_to(out);
out.append("\n");
}
for (const auto &it : this->manufacturer_data) {
out.append(" manufacturer_data: ");
it.dump_to(out);
out.append("\n");
}
out.append("}");
}
#endif
} // namespace api
} // namespace esphome

View File

@@ -263,6 +263,7 @@ class DeviceInfoResponse : public ProtoMessage {
std::string project_name{};
std::string project_version{};
uint32_t webserver_port{0};
bool has_bluetooth_proxy{false};
void encode(ProtoWriteBuffer buffer) const override;
#ifdef HAS_PROTO_MESSAGE_DUMP
void dump_to(std::string &out) const override;
@@ -1214,6 +1215,45 @@ class MediaPlayerCommandRequest : public ProtoMessage {
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
bool decode_varint(uint32_t field_id, ProtoVarInt value) override;
};
class SubscribeBluetoothLEAdvertisementsRequest : public ProtoMessage {
public:
void encode(ProtoWriteBuffer buffer) const override;
#ifdef HAS_PROTO_MESSAGE_DUMP
void dump_to(std::string &out) const override;
#endif
protected:
};
class BluetoothServiceData : public ProtoMessage {
public:
std::string uuid{};
std::vector<uint32_t> data{};
void encode(ProtoWriteBuffer buffer) const override;
#ifdef HAS_PROTO_MESSAGE_DUMP
void dump_to(std::string &out) const override;
#endif
protected:
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
bool decode_varint(uint32_t field_id, ProtoVarInt value) override;
};
class BluetoothLEAdvertisementResponse : public ProtoMessage {
public:
uint64_t address{0};
std::string name{};
int32_t rssi{0};
std::vector<std::string> service_uuids{};
std::vector<BluetoothServiceData> service_data{};
std::vector<BluetoothServiceData> manufacturer_data{};
void encode(ProtoWriteBuffer buffer) const override;
#ifdef HAS_PROTO_MESSAGE_DUMP
void dump_to(std::string &out) const override;
#endif
protected:
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
bool decode_varint(uint32_t field_id, ProtoVarInt value) override;
};
} // namespace api
} // namespace esphome

View File

@@ -328,6 +328,14 @@ bool APIServerConnectionBase::send_media_player_state_response(const MediaPlayer
#endif
#ifdef USE_MEDIA_PLAYER
#endif
#ifdef USE_BLUETOOTH_PROXY
bool APIServerConnectionBase::send_bluetooth_le_advertisement_response(const BluetoothLEAdvertisementResponse &msg) {
#ifdef HAS_PROTO_MESSAGE_DUMP
ESP_LOGVV(TAG, "send_bluetooth_le_advertisement_response: %s", msg.dump().c_str());
#endif
return this->send_message_<BluetoothLEAdvertisementResponse>(msg, 67);
}
#endif
bool APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type, uint8_t *msg_data) {
switch (msg_type) {
case 1: {
@@ -595,6 +603,15 @@ bool APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
#endif
break;
}
case 66: {
SubscribeBluetoothLEAdvertisementsRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
ESP_LOGVV(TAG, "on_subscribe_bluetooth_le_advertisements_request: %s", msg.dump().c_str());
#endif
this->on_subscribe_bluetooth_le_advertisements_request(msg);
break;
}
default:
return false;
}
@@ -691,6 +708,18 @@ void APIServerConnection::on_subscribe_home_assistant_states_request(const Subsc
}
this->subscribe_home_assistant_states(msg);
}
void APIServerConnection::on_subscribe_bluetooth_le_advertisements_request(
const SubscribeBluetoothLEAdvertisementsRequest &msg) {
if (!this->is_connection_setup()) {
this->on_no_setup_connection();
return;
}
if (!this->is_authenticated()) {
this->on_unauthenticated_access();
return;
}
this->subscribe_bluetooth_le_advertisements(msg);
}
void APIServerConnection::on_get_time_request(const GetTimeRequest &msg) {
if (!this->is_connection_setup()) {
this->on_no_setup_connection();

View File

@@ -153,6 +153,11 @@ class APIServerConnectionBase : public ProtoService {
#endif
#ifdef USE_MEDIA_PLAYER
virtual void on_media_player_command_request(const MediaPlayerCommandRequest &value){};
#endif
virtual void on_subscribe_bluetooth_le_advertisements_request(
const SubscribeBluetoothLEAdvertisementsRequest &value){};
#ifdef USE_BLUETOOTH_PROXY
bool send_bluetooth_le_advertisement_response(const BluetoothLEAdvertisementResponse &msg);
#endif
protected:
bool read_message(uint32_t msg_size, uint32_t msg_type, uint8_t *msg_data) override;
@@ -170,6 +175,7 @@ class APIServerConnection : public APIServerConnectionBase {
virtual void subscribe_logs(const SubscribeLogsRequest &msg) = 0;
virtual void subscribe_homeassistant_services(const SubscribeHomeassistantServicesRequest &msg) = 0;
virtual void subscribe_home_assistant_states(const SubscribeHomeAssistantStatesRequest &msg) = 0;
virtual void subscribe_bluetooth_le_advertisements(const SubscribeBluetoothLEAdvertisementsRequest &msg) = 0;
virtual GetTimeResponse get_time(const GetTimeRequest &msg) = 0;
virtual void execute_service(const ExecuteServiceRequest &msg) = 0;
#ifdef USE_COVER
@@ -216,6 +222,7 @@ class APIServerConnection : public APIServerConnectionBase {
void on_subscribe_logs_request(const SubscribeLogsRequest &msg) override;
void on_subscribe_homeassistant_services_request(const SubscribeHomeassistantServicesRequest &msg) override;
void on_subscribe_home_assistant_states_request(const SubscribeHomeAssistantStatesRequest &msg) override;
void on_subscribe_bluetooth_le_advertisements_request(const SubscribeBluetoothLEAdvertisementsRequest &msg) override;
void on_get_time_request(const GetTimeRequest &msg) override;
void on_execute_service_request(const ExecuteServiceRequest &msg) override;
#ifdef USE_COVER

View File

@@ -291,6 +291,13 @@ void APIServer::send_homeassistant_service_call(const HomeassistantServiceRespon
client->send_homeassistant_service_call(call);
}
}
#ifdef USE_BLUETOOTH_PROXY
void APIServer::send_bluetooth_le_advertisement(const BluetoothLEAdvertisementResponse &call) {
for (auto &client : this->clients_) {
client->send_bluetooth_le_advertisement(call);
}
}
#endif
APIServer::APIServer() { global_api_server = this; }
void APIServer::subscribe_home_assistant_state(std::string entity_id, optional<std::string> attribute,
std::function<void(std::string)> f) {

View File

@@ -73,6 +73,9 @@ class APIServer : public Component, public Controller {
void on_media_player_update(media_player::MediaPlayer *obj) override;
#endif
void send_homeassistant_service_call(const HomeassistantServiceResponse &call);
#ifdef USE_BLUETOOTH_PROXY
void send_bluetooth_le_advertisement(const BluetoothLEAdvertisementResponse &call);
#endif
void register_user_service(UserServiceDescriptor *descriptor) { this->user_services_.push_back(descriptor); }
#ifdef USE_HOMEASSISTANT_TIME
void request_time();

View File

@@ -70,7 +70,7 @@ class ProtoVarInt {
}
}
void encode(std::vector<uint8_t> &out) {
uint32_t val = this->value_;
uint64_t val = this->value_;
if (val <= 0x7F) {
out.push_back(val);
return;

View File

@@ -0,0 +1,27 @@
from esphome.components import esp32_ble_tracker
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.const import CONF_ID
DEPENDENCIES = ["esp32", "esp32_ble_tracker"]
CODEOWNERS = ["@jesserockz"]
bluetooth_proxy_ns = cg.esphome_ns.namespace("bluetooth_proxy")
BluetoothProxy = bluetooth_proxy_ns.class_("BluetoothProxy", cg.Component)
CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.declare_id(BluetoothProxy),
}
).extend(esp32_ble_tracker.ESP_BLE_DEVICE_SCHEMA)
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
await esp32_ble_tracker.register_ble_device(var, config)
cg.add_define("USE_BLUETOOTH_PROXY")

View File

@@ -0,0 +1,58 @@
#include "bluetooth_proxy.h"
#ifdef USE_API
#include "esphome/components/api/api_pb2.h"
#include "esphome/components/api/api_server.h"
#endif // USE_API
#include "esphome/core/log.h"
#ifdef USE_ESP32
namespace esphome {
namespace bluetooth_proxy {
static const char *const TAG = "bluetooth_proxy";
bool BluetoothProxy::parse_device(const esp32_ble_tracker::ESPBTDevice &device) {
ESP_LOGV(TAG, "Proxying packet from %s - %s. RSSI: %d dB", device.get_name().c_str(), device.address_str().c_str(),
device.get_rssi());
this->send_api_packet_(device);
return true;
}
void BluetoothProxy::send_api_packet_(const esp32_ble_tracker::ESPBTDevice &device) {
#ifndef USE_API
return;
#else
api::BluetoothLEAdvertisementResponse resp;
resp.address = device.address_uint64();
if (!device.get_name().empty())
resp.name = device.get_name();
resp.rssi = device.get_rssi();
for (auto uuid : device.get_service_uuids()) {
resp.service_uuids.push_back(uuid.to_string());
}
for (auto &data : device.get_service_datas()) {
api::BluetoothServiceData service_data;
service_data.uuid = data.uuid.to_string();
for (auto d : data.data)
service_data.data.push_back(d);
resp.service_data.push_back(service_data);
}
for (auto &data : device.get_manufacturer_datas()) {
api::BluetoothServiceData manufacturer_data;
manufacturer_data.uuid = data.uuid.to_string();
for (auto d : data.data)
manufacturer_data.data.push_back(d);
resp.manufacturer_data.push_back(manufacturer_data);
}
api::global_api_server->send_bluetooth_le_advertisement(resp);
#endif
}
void BluetoothProxy::dump_config() { ESP_LOGCONFIG(TAG, "Bluetooth Proxy:"); }
} // namespace bluetooth_proxy
} // namespace esphome
#endif // USE_ESP32

View File

@@ -0,0 +1,26 @@
#pragma once
#ifdef USE_ESP32
#include <map>
#include "esphome/components/esp32_ble_tracker/esp32_ble_tracker.h"
#include "esphome/core/automation.h"
#include "esphome/core/component.h"
namespace esphome {
namespace bluetooth_proxy {
class BluetoothProxy : public Component, public esp32_ble_tracker::ESPBTDeviceListener {
public:
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override;
void dump_config() override;
protected:
void send_api_packet_(const esp32_ble_tracker::ESPBTDevice &device);
};
} // namespace bluetooth_proxy
} // namespace esphome
#endif // USE_ESP32

View File

@@ -51,7 +51,7 @@ void FingerprintGrowComponent::update() {
void FingerprintGrowComponent::setup() {
ESP_LOGCONFIG(TAG, "Setting up Grow Fingerprint Reader...");
if (this->check_password_()) {
if (this->new_password_ != nullptr) {
if (this->new_password_ != -1) {
if (this->set_password_())
return;
} else {
@@ -202,9 +202,9 @@ bool FingerprintGrowComponent::check_password_() {
}
bool FingerprintGrowComponent::set_password_() {
ESP_LOGI(TAG, "Setting new password: %d", *this->new_password_);
this->data_ = {SET_PASSWORD, (uint8_t)(*this->new_password_ >> 24), (uint8_t)(*this->new_password_ >> 16),
(uint8_t)(*this->new_password_ >> 8), (uint8_t)(*this->new_password_ & 0xFF)};
ESP_LOGI(TAG, "Setting new password: %d", this->new_password_);
this->data_ = {SET_PASSWORD, (uint8_t)(this->new_password_ >> 24), (uint8_t)(this->new_password_ >> 16),
(uint8_t)(this->new_password_ >> 8), (uint8_t)(this->new_password_ & 0xFF)};
if (this->send_command_() == OK) {
ESP_LOGI(TAG, "New password successfully set");
ESP_LOGI(TAG, "Define the new password in your configuration and reflash now");

View File

@@ -96,7 +96,7 @@ class FingerprintGrowComponent : public PollingComponent, public uart::UARTDevic
}
void set_sensing_pin(GPIOPin *sensing_pin) { this->sensing_pin_ = sensing_pin; }
void set_password(uint32_t password) { this->password_ = password; }
void set_new_password(uint32_t new_password) { this->new_password_ = &new_password; }
void set_new_password(uint32_t new_password) { this->new_password_ = new_password; }
void set_fingerprint_count_sensor(sensor::Sensor *fingerprint_count_sensor) {
this->fingerprint_count_sensor_ = fingerprint_count_sensor;
}
@@ -153,7 +153,7 @@ class FingerprintGrowComponent : public PollingComponent, public uart::UARTDevic
uint8_t address_[4] = {0xFF, 0xFF, 0xFF, 0xFF};
uint16_t capacity_ = 64;
uint32_t password_ = 0x0;
uint32_t *new_password_{nullptr};
uint32_t new_password_ = -1;
GPIOPin *sensing_pin_{nullptr};
uint8_t enrollment_image_ = 0;
uint16_t enrollment_slot_ = 0;

View File

@@ -23,6 +23,8 @@ void IntegrationSensor::setup() {
}
void IntegrationSensor::dump_config() { LOG_SENSOR("", "Integration Sensor", this); }
void IntegrationSensor::process_sensor_value_(float value) {
if (std::isnan(value))
return;
const uint32_t now = millis();
const double old_value = this->last_value_;
const double new_value = value;

View File

@@ -236,7 +236,7 @@ size_t ModbusController::create_register_ranges_() {
}
}
if (curr->start_address == r.start_address) {
if (curr->start_address == r.start_address && curr->register_type == r.register_type) {
// use the lowest non zero value for the whole range
// Because zero is the default value for skip_updates it is excluded from getting the min value.
if (curr->skip_updates != 0) {

View File

@@ -76,7 +76,11 @@ void SPIComponent::setup() {
if (spi_bus_num == 0) {
this->hw_spi_ = &SPI;
} else {
#if defined(USE_ESP32_VARIANT_ESP32C3) || defined(USE_ESP32_VARIANT_ESP32S2) || defined(USE_ESP32_VARIANT_ESP32S3)
this->hw_spi_ = new SPIClass(FSPI); // NOLINT(cppcoreguidelines-owning-memory)
#else
this->hw_spi_ = new SPIClass(VSPI); // NOLINT(cppcoreguidelines-owning-memory)
#endif // USE_ESP32_VARIANT
}
spi_bus_num++;
this->hw_spi_->begin(clk_pin, miso_pin, mosi_pin);

View File

@@ -1,6 +1,6 @@
"""Constants used by esphome."""
__version__ = "2022.8.0b3"
__version__ = "2022.8.3"
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"

View File

@@ -70,6 +70,7 @@
#define USE_ESP32_IGNORE_EFUSE_MAC_CRC
#define USE_IMPROV
#define USE_SOCKET_IMPL_BSD_SOCKETS
#define USE_BLUETOOTH_PROXY
#ifdef USE_ARDUINO
#define USE_ARDUINO_VERSION_CODE VERSION_CODE(1, 0, 6)

View File

@@ -816,14 +816,17 @@ class LoginHandler(BaseHandler):
import requests
headers = {
"Authentication": f"Bearer {os.getenv('SUPERVISOR_TOKEN')}",
"X-Supervisor-Token": os.getenv("SUPERVISOR_TOKEN"),
}
data = {
"username": self.get_argument("username", ""),
"password": self.get_argument("password", ""),
}
try:
req = requests.post("http://supervisor/auth", headers=headers, data=data)
req = requests.post(
"http://supervisor/auth", headers=headers, json=data, timeout=30
)
if req.status_code == 200:
self.set_secure_cookie("authenticated", cookie_authenticated_yes)
self.redirect("/")

View File

@@ -288,6 +288,8 @@ adalight:
esp32_ble_tracker:
bluetooth_proxy:
ble_client:
- mac_address: AA:BB:CC:DD:EE:FF
id: ble_foo