Compare commits
3 Commits
551866b040
...
71ec165aca
Author | SHA1 | Date | |
---|---|---|---|
71ec165aca | |||
d1ddd9ecbb | |||
5d023b13c1 |
@ -3,7 +3,7 @@ platform = espressif8266
|
|||||||
board = esp12e
|
board = esp12e
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
board_build.ldscript = eagle.flash.4m2m.ld
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/aZholtikov/ZHNetwork
|
https://github.com/aZholtikov/ZHNetwork
|
||||||
https://github.com/aZholtikov/ZHConfig
|
https://github.com/aZholtikov/ZHConfig
|
||||||
@ -17,7 +17,7 @@ platform = espressif8266
|
|||||||
board = esp12e
|
board = esp12e
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
board_build.ldscript = eagle.flash.4m2m.ld
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
upload_port = 192.168.4.1
|
upload_port = 192.168.4.1
|
||||||
upload_protocol = espota
|
upload_protocol = espota
|
||||||
lib_deps =
|
lib_deps =
|
||||||
@ -33,7 +33,7 @@ platform = espressif8266
|
|||||||
board = esp8285
|
board = esp8285
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
board_build.ldscript = eagle.flash.2m256.ld
|
board_build.ldscript = eagle.flash.2m64.ld
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/aZholtikov/ZHNetwork
|
https://github.com/aZholtikov/ZHNetwork
|
||||||
https://github.com/aZholtikov/ZHConfig
|
https://github.com/aZholtikov/ZHConfig
|
||||||
@ -47,7 +47,7 @@ platform = espressif8266
|
|||||||
board = esp8285
|
board = esp8285
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board_build.filesystem = littlefs
|
board_build.filesystem = littlefs
|
||||||
board_build.ldscript = eagle.flash.2m256.ld
|
board_build.ldscript = eagle.flash.2m64.ld
|
||||||
upload_port = 192.168.4.1
|
upload_port = 192.168.4.1
|
||||||
upload_protocol = espota
|
upload_protocol = espota
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
26
src/main.cpp
26
src/main.cpp
@ -32,7 +32,7 @@ typedef struct
|
|||||||
|
|
||||||
std::vector<espnow_message_t> espnowMessage;
|
std::vector<espnow_message_t> espnowMessage;
|
||||||
|
|
||||||
const String firmware{"1.31"};
|
const String firmware{"1.32"};
|
||||||
|
|
||||||
String espnowNetName{"DEFAULT"};
|
String espnowNetName{"DEFAULT"};
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ void setupWebServer()
|
|||||||
void IRAM_ATTR buttonInterrupt()
|
void IRAM_ATTR buttonInterrupt()
|
||||||
{
|
{
|
||||||
ETS_GPIO_INTR_DISABLE();
|
ETS_GPIO_INTR_DISABLE();
|
||||||
buttonInterruptTimer.once_ms(100, switchingRelay); // For prevent contact chatter.
|
buttonInterruptTimer.once_ms(500, switchingRelay); // For prevent contact chatter.
|
||||||
}
|
}
|
||||||
|
|
||||||
void switchingRelay()
|
void switchingRelay()
|
||||||
@ -423,9 +423,9 @@ void sendConfigMessage(const uint8_t type)
|
|||||||
{
|
{
|
||||||
json["name"] = deviceName;
|
json["name"] = deviceName;
|
||||||
json["unit"] = 1;
|
json["unit"] = 1;
|
||||||
json["type"] = HACT_SWITCH;
|
json["type"] = HACT_SWITCH; // ha_component_type_t
|
||||||
json["class"] = HASWDC_SWITCH;
|
json["class"] = HASWDC_SWITCH; // ha_switch_device_class_t
|
||||||
json["template"] = "state";
|
json["template"] = "state"; // value_template
|
||||||
json["payload_on"] = payloadOn;
|
json["payload_on"] = payloadOn;
|
||||||
json["payload_off"] = payloadOff;
|
json["payload_off"] = payloadOff;
|
||||||
}
|
}
|
||||||
@ -434,9 +434,11 @@ void sendConfigMessage(const uint8_t type)
|
|||||||
outgoingData.deviceType = ENDT_SENSOR;
|
outgoingData.deviceType = ENDT_SENSOR;
|
||||||
json["name"] = deviceName + " temperature";
|
json["name"] = deviceName + " temperature";
|
||||||
json["unit"] = 2;
|
json["unit"] = 2;
|
||||||
json["type"] = HACT_SENSOR;
|
json["type"] = HACT_SENSOR; // ha_component_type_t
|
||||||
json["class"] = HASDC_TEMPERATURE;
|
json["class"] = HASDC_TEMPERATURE; // ha_sensor_device_class_t
|
||||||
json["template"] = "temperature";
|
json["template"] = "temperature"; // value_template
|
||||||
|
json["meas"] = "°C"; // unit_of_measurement
|
||||||
|
json["time"] = 180; // expire_after
|
||||||
}
|
}
|
||||||
serializeJsonPretty(json, outgoingData.message);
|
serializeJsonPretty(json, outgoingData.message);
|
||||||
memcpy(&message.message, &outgoingData, sizeof(esp_now_payload_data_t));
|
memcpy(&message.message, &outgoingData, sizeof(esp_now_payload_data_t));
|
||||||
@ -449,9 +451,11 @@ void sendConfigMessage(const uint8_t type)
|
|||||||
outgoingData.deviceType = ENDT_SENSOR;
|
outgoingData.deviceType = ENDT_SENSOR;
|
||||||
json["name"] = deviceName + " humidity";
|
json["name"] = deviceName + " humidity";
|
||||||
json["unit"] = 3;
|
json["unit"] = 3;
|
||||||
json["type"] = HACT_SENSOR;
|
json["type"] = HACT_SENSOR; // ha_component_type_t
|
||||||
json["class"] = HASDC_HUMIDITY;
|
json["class"] = HASDC_HUMIDITY; // ha_sensor_device_class_t
|
||||||
json["template"] = "humidity";
|
json["template"] = "humidity"; // value_template
|
||||||
|
json["meas"] = "%"; // unit_of_measurement
|
||||||
|
json["time"] = 180; // expire_after
|
||||||
|
|
||||||
serializeJsonPretty(json, outgoingData.message);
|
serializeJsonPretty(json, outgoingData.message);
|
||||||
memcpy(&message.message, &outgoingData, sizeof(esp_now_payload_data_t));
|
memcpy(&message.message, &outgoingData, sizeof(esp_now_payload_data_t));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user