Fixed one bug

This commit is contained in:
Alexey Zholtikov 2023-03-06 00:38:23 +03:00
parent 4f14de7763
commit e310ef6573
2 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# Tested on
1. Model D06 Type 1. Built on Tuya WiFi module TYWE3S (ESP8266 chip). Analogue of ESP-01. Does not require replacement. Total triggering time about 1.5 sec. [Photo](https://github.com/aZholtikov/ESP-NOW-Window-Door-Sensor/tree/main/hardware/Model_D06_Type_1).
2. Model D06 Type 2. Built on Tuya WiFi module CBU (BK7231N chip). Replacement required. No physical equivalent (as of this writing). Performed replacement with ESP-M2 (ESP8285 chip) because it was in stock. It can be replaced with any ESP8266 compatible. Total response time about 0.5 sec. [Photo](https://github.com/aZholtikov/ESP-NOW-Window-Door-Sensor/tree/main/hardware/Model_D06_Type_2).
1. MODEL D06 TYPE 1. Built on Tuya WiFi module TYWE3S (ESP8266 chip). Analogue of ESP-01. Does not require replacement. Total triggering time about 1.5 sec. [Photo](https://github.com/aZholtikov/ESP-NOW-Window-Door-Sensor/tree/main/hardware/Model_D06_Type_1).
2. MODEL D06 TYPE 2. Built on Tuya WiFi module CBU (BK7231N chip). Replacement required. No physical equivalent (as of this writing). Performed replacement with ESP-M2 (ESP8285 chip) because it was in stock. It can be replaced with any ESP8266 compatible. Total response time about 0.5 sec. [Photo](https://github.com/aZholtikov/ESP-NOW-Window-Door-Sensor/tree/main/hardware/Model_D06_Type_2).

View File

@ -20,12 +20,13 @@ void sendAttributesMessage(void);
struct deviceConfig
{
const String firmware{"1.3"};
String espnowNetName{"DEFAULT"};
String deviceName = "ESP-NOW window " + String(ESP.getChipId(), HEX);
uint8_t deviceClass{HABSDC_WINDOW};
} config;
const String firmware{"1.3"};
char receivedBytes[128]{0};
uint8_t counter{0};
uint8_t messageLenght{0};
@ -201,7 +202,7 @@ void setupWebServer()
{
String configJson;
DynamicJsonDocument json(256); // To calculate the buffer size uses https://arduinojson.org/v6/assistant.
json["firmware"] = config.firmware;
json["firmware"] = firmware;
json["espnowNetName"] = config.espnowNetName;
json["deviceName"] = config.deviceName;
json["deviceClass"] = config.deviceClass;
@ -258,7 +259,7 @@ void sendAttributesMessage()
json["Type"] = "ESP-NOW window sensor";
json["MCU"] = "ESP8266";
json["MAC"] = myNet.getNodeMac();
json["Firmware"] = config.firmware;
json["Firmware"] = firmware;
json["Library"] = myNet.getFirmwareVersion();
serializeJsonPretty(json, outgoingData.message);
char temp[sizeof(esp_now_payload_data_t)]{0};