mirror of
https://github.com/esphome/esphome.git
synced 2025-11-08 19:11:49 +00:00
Compare commits
224 Commits
ble-server
...
2022.1.0b4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5dc776e55f | ||
|
|
72d60f30f7 | ||
|
|
869743a742 | ||
|
|
7b03e07908 | ||
|
|
348f880e15 | ||
|
|
ead597d0fb | ||
|
|
afbf989715 | ||
|
|
01b62a16c3 | ||
|
|
c5eba04517 | ||
|
|
282313ab52 | ||
|
|
d274545e77 | ||
|
|
d3fda37615 | ||
|
|
cbe3092404 | ||
|
|
6dfe3039d0 | ||
|
|
d6009453df | ||
|
|
c81323ef91 | ||
|
|
961c27f1c2 | ||
|
|
fe4a14e6cc | ||
|
|
50848c2f4d | ||
|
|
d32633b3c7 | ||
|
|
b37739eec2 | ||
|
|
28f87dc804 | ||
|
|
41879e41e6 | ||
|
|
fc0a6546a2 | ||
|
|
ffd4280d6c | ||
|
|
db3b955b0f | ||
|
|
5516f65971 | ||
|
|
9471df0a1b | ||
|
|
6d39f64be7 | ||
|
|
b89d0a9a73 | ||
|
|
4bb779d9a5 | ||
|
|
386a5b6362 | ||
|
|
e32a999cd0 | ||
|
|
bfbc6a4bad | ||
|
|
8c9e0e552d | ||
|
|
8aaf9fd83f | ||
|
|
08057720b8 | ||
|
|
bfaa648837 | ||
|
|
d504daef91 | ||
|
|
b8d3ef2f49 | ||
|
|
3bf6320030 | ||
|
|
708b928c73 | ||
|
|
649366ff44 | ||
|
|
e5c9e87fad | ||
|
|
f3d9d707b6 | ||
|
|
090e10730c | ||
|
|
fbc84861c7 | ||
|
|
e763469af8 | ||
|
|
3c0c514e44 | ||
|
|
ed5e2dd332 | ||
|
|
09b7c6f550 | ||
|
|
df315a1f51 | ||
|
|
7ee4bb621c | ||
|
|
24874f4c3c | ||
|
|
c128880033 | ||
|
|
a66e94a0b0 | ||
|
|
56870ed4a8 | ||
|
|
3ac720df47 | ||
|
|
1bc757ad06 | ||
|
|
f72abc6f3d | ||
|
|
5ac88de985 | ||
|
|
0826b367d6 | ||
|
|
329bf861d6 | ||
|
|
9dcd3d18a0 | ||
|
|
db66cd88b6 | ||
|
|
86c205fe43 | ||
|
|
c6414138c7 | ||
|
|
36b355eb82 | ||
|
|
7be9291b13 | ||
|
|
ea9e75039b | ||
|
|
a5fb036011 | ||
|
|
e55506f9db | ||
|
|
50ec1d0445 | ||
|
|
3d5e1d8d91 | ||
|
|
db2128a344 | ||
|
|
21db43db06 | ||
|
|
5009b3029f | ||
|
|
57a029189c | ||
|
|
0cb715bb76 | ||
|
|
7d03823afd | ||
|
|
8e1c9f5042 | ||
|
|
980b7cda8f | ||
|
|
3a72dd5cb6 | ||
|
|
3178243811 | ||
|
|
d30e2f2a4f | ||
|
|
6226dae05c | ||
|
|
9c6a475a6e | ||
|
|
8294d10d5b | ||
|
|
67558bec47 | ||
|
|
84873d4074 | ||
|
|
58a0b28a39 | ||
|
|
b37d3a66cc | ||
|
|
7e495a5e27 | ||
|
|
c41547fd4a | ||
|
|
0d47d41c85 | ||
|
|
41a3a17456 | ||
|
|
cbbafbcca2 | ||
|
|
c75566b374 | ||
|
|
7279f1fcc1 | ||
|
|
d7432f7c10 | ||
|
|
b0a0a153f3 | ||
|
|
024632dbd0 | ||
|
|
0a545a28b9 | ||
|
|
0f2df59998 | ||
|
|
29a7d32f77 | ||
|
|
687a7e9b2f | ||
|
|
09e8782318 | ||
|
|
f2aea02210 | ||
|
|
194f922312 | ||
|
|
fea3c48098 | ||
|
|
c2f57baec2 | ||
|
|
f4a140e126 | ||
|
|
ab506b09fe | ||
|
|
87e1cdeedb | ||
|
|
81a36146ef | ||
|
|
7fa4a68a27 | ||
|
|
f1c5e2ef81 | ||
|
|
b526155cce | ||
|
|
62c3f301e7 | ||
|
|
38cb988809 | ||
|
|
b976ac54c8 | ||
|
|
78026e766f | ||
|
|
b4cd8d21a5 | ||
|
|
7552893311 | ||
|
|
21c896d8f8 | ||
|
|
4b7fe202ec | ||
|
|
9f4519210f | ||
|
|
b0506afa5b | ||
|
|
8cbb379898 | ||
|
|
b226215593 | ||
|
|
19970729a9 | ||
|
|
d2ebfd2833 | ||
|
|
bd782fc828 | ||
|
|
23560e608c | ||
|
|
f1377b560e | ||
|
|
72108684ea | ||
|
|
c6adaaea97 | ||
|
|
91999a38ca | ||
|
|
b34eed125d | ||
|
|
2abe09529a | ||
|
|
9aaaf4dd4b | ||
|
|
cbfbcf7f1b | ||
|
|
c7651dc40d | ||
|
|
eda1c471ad | ||
|
|
c7ef18fbc4 | ||
|
|
901ec918b1 | ||
|
|
6bdae55ee1 | ||
|
|
dfb96e4b7f | ||
|
|
ff2c316b18 | ||
|
|
5be52f71f9 | ||
|
|
42873dd37c | ||
|
|
f93e7d4e3a | ||
|
|
bbcd523967 | ||
|
|
68cbe58d00 | ||
|
|
115bca98f1 | ||
|
|
ed0b34b2fe | ||
|
|
ab34401421 | ||
|
|
eed0c18d65 | ||
|
|
e5a38ce748 | ||
|
|
7d9d9fcf36 | ||
|
|
f0aba6ceb2 | ||
|
|
ab07ee57c6 | ||
|
|
eae3d72a4d | ||
|
|
7b8d826704 | ||
|
|
e7baa42e63 | ||
|
|
2f32833a22 | ||
|
|
f6935a4b4b | ||
|
|
332c9e891b | ||
|
|
b91ee4847f | ||
|
|
625463d871 | ||
|
|
6433a01e07 | ||
|
|
56cc31e8e7 | ||
|
|
3af297aa76 | ||
|
|
996ec59d28 | ||
|
|
95593eeeab | ||
|
|
dad244fb7a | ||
|
|
adb5d27d95 | ||
|
|
8456a8cecb | ||
|
|
b9f66373c1 | ||
|
|
9ac365feef | ||
|
|
43bbd58a44 | ||
|
|
7feffa64f3 | ||
|
|
ea0977abb4 | ||
|
|
4c83dc7c28 | ||
|
|
e10ab1da78 | ||
|
|
1b0e60374b | ||
|
|
3a760fbb44 | ||
|
|
6ef57a2973 | ||
|
|
3e9c7f2e9f | ||
|
|
430598b7a1 | ||
|
|
91611b09b4 | ||
|
|
ecd115851f | ||
|
|
4a1e50fed1 | ||
|
|
d6d037047b | ||
|
|
b5734c2b20 | ||
|
|
723fb7eaac | ||
|
|
63a9acaa19 | ||
|
|
0524f8c677 | ||
|
|
70b62f272e | ||
|
|
f0089b7940 | ||
|
|
4b44280d53 | ||
|
|
f045382d20 | ||
|
|
db3fa1ade7 | ||
|
|
f83950fd75 | ||
|
|
4dd1bf920d | ||
|
|
98755f3621 | ||
|
|
c3a8a044b9 | ||
|
|
15b5ea43a7 | ||
|
|
ec683fc227 | ||
|
|
d4e65eb82a | ||
|
|
10c6601b0a | ||
|
|
73940bc1bd | ||
|
|
9b7fb829f9 | ||
|
|
c51d8c9021 | ||
|
|
d8a6dfe5ce | ||
|
|
5f7cef0b06 | ||
|
|
48ff2ffc68 | ||
|
|
b3b9ccd314 | ||
|
|
e63c7b483b | ||
|
|
f57980b069 | ||
|
|
7006aa0d2a | ||
|
|
8051c1ca99 | ||
|
|
a779592414 | ||
|
|
112215848d |
@@ -76,6 +76,8 @@ async def to_code(config):
|
|||||||
pos = 0
|
pos = 0
|
||||||
for frameIndex in range(frames):
|
for frameIndex in range(frames):
|
||||||
image.seek(frameIndex)
|
image.seek(frameIndex)
|
||||||
|
if CONF_RESIZE in config:
|
||||||
|
image.thumbnail(config[CONF_RESIZE])
|
||||||
frame = image.convert("RGB")
|
frame = image.convert("RGB")
|
||||||
if CONF_RESIZE in config:
|
if CONF_RESIZE in config:
|
||||||
frame = frame.resize([width, height])
|
frame = frame.resize([width, height])
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "api_frame_helper.h"
|
#include "api_frame_helper.h"
|
||||||
|
|
||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
|
#include "esphome/core/hal.h"
|
||||||
#include "esphome/core/helpers.h"
|
#include "esphome/core/helpers.h"
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -721,7 +722,12 @@ APIError APINoiseFrameHelper::shutdown(int how) {
|
|||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
// declare how noise generates random bytes (here with a good HWRNG based on the RF system)
|
// declare how noise generates random bytes (here with a good HWRNG based on the RF system)
|
||||||
void noise_rand_bytes(void *output, size_t len) { esphome::random_bytes(reinterpret_cast<uint8_t *>(output), len); }
|
void noise_rand_bytes(void *output, size_t len) {
|
||||||
|
if (!esphome::random_bytes(reinterpret_cast<uint8_t *>(output), len)) {
|
||||||
|
ESP_LOGE(TAG, "Failed to acquire random bytes, rebooting!");
|
||||||
|
arch_restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // USE_API_NOISE
|
#endif // USE_API_NOISE
|
||||||
|
|
||||||
|
|||||||
@@ -74,8 +74,10 @@ class BinarySensor : public EntityBase {
|
|||||||
|
|
||||||
// ========== OVERRIDE METHODS ==========
|
// ========== OVERRIDE METHODS ==========
|
||||||
// (You'll only need this when creating your own custom binary sensor)
|
// (You'll only need this when creating your own custom binary sensor)
|
||||||
/// Get the default device class for this sensor, or empty string for no default.
|
/** Override this to set the default device class.
|
||||||
ESPDEPRECATED("device_class() is deprecated, set property during config validation instead.", "2022.01")
|
*
|
||||||
|
* @deprecated This method is deprecated, set the property during config validation instead. (2022.1)
|
||||||
|
*/
|
||||||
virtual std::string device_class();
|
virtual std::string device_class();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -169,7 +169,11 @@ class Cover : public EntityBase {
|
|||||||
friend CoverCall;
|
friend CoverCall;
|
||||||
|
|
||||||
virtual void control(const CoverCall &call) = 0;
|
virtual void control(const CoverCall &call) = 0;
|
||||||
ESPDEPRECATED("device_class() is deprecated, set property during config validation instead.", "2022.01")
|
|
||||||
|
/** Override this to set the default device class.
|
||||||
|
*
|
||||||
|
* @deprecated This method is deprecated, set the property during config validation instead. (2022.1)
|
||||||
|
*/
|
||||||
virtual std::string device_class();
|
virtual std::string device_class();
|
||||||
|
|
||||||
optional<CoverRestoreState> restore_state_();
|
optional<CoverRestoreState> restore_state_();
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ def copy_files():
|
|||||||
)
|
)
|
||||||
|
|
||||||
dir = os.path.dirname(__file__)
|
dir = os.path.dirname(__file__)
|
||||||
post_build_file = os.path.join(dir, "post_build.py")
|
post_build_file = os.path.join(dir, "post_build.py.script")
|
||||||
copy_file_if_changed(
|
copy_file_if_changed(
|
||||||
post_build_file,
|
post_build_file,
|
||||||
CORE.relative_build_path("post_build.py"),
|
CORE.relative_build_path("post_build.py"),
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ async def to_code(config):
|
|||||||
def copy_files():
|
def copy_files():
|
||||||
|
|
||||||
dir = os.path.dirname(__file__)
|
dir = os.path.dirname(__file__)
|
||||||
post_build_file = os.path.join(dir, "post_build.py")
|
post_build_file = os.path.join(dir, "post_build.py.script")
|
||||||
copy_file_if_changed(
|
copy_file_if_changed(
|
||||||
post_build_file,
|
post_build_file,
|
||||||
CORE.relative_build_path("post_build.py"),
|
CORE.relative_build_path("post_build.py"),
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ from ..const import (
|
|||||||
CONF_FORCE_NEW_RANGE,
|
CONF_FORCE_NEW_RANGE,
|
||||||
CONF_MODBUS_CONTROLLER_ID,
|
CONF_MODBUS_CONTROLLER_ID,
|
||||||
CONF_REGISTER_TYPE,
|
CONF_REGISTER_TYPE,
|
||||||
|
CONF_SKIP_UPDATES,
|
||||||
CONF_USE_WRITE_MULTIPLE,
|
CONF_USE_WRITE_MULTIPLE,
|
||||||
CONF_WRITE_LAMBDA,
|
CONF_WRITE_LAMBDA,
|
||||||
)
|
)
|
||||||
@@ -53,6 +54,7 @@ async def to_code(config):
|
|||||||
config[CONF_ADDRESS],
|
config[CONF_ADDRESS],
|
||||||
byte_offset,
|
byte_offset,
|
||||||
config[CONF_BITMASK],
|
config[CONF_BITMASK],
|
||||||
|
config[CONF_SKIP_UPDATES],
|
||||||
config[CONF_FORCE_NEW_RANGE],
|
config[CONF_FORCE_NEW_RANGE],
|
||||||
)
|
)
|
||||||
await cg.register_component(var, config)
|
await cg.register_component(var, config)
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ namespace modbus_controller {
|
|||||||
class ModbusSwitch : public Component, public switch_::Switch, public SensorItem {
|
class ModbusSwitch : public Component, public switch_::Switch, public SensorItem {
|
||||||
public:
|
public:
|
||||||
ModbusSwitch(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask,
|
ModbusSwitch(ModbusRegisterType register_type, uint16_t start_address, uint8_t offset, uint32_t bitmask,
|
||||||
bool force_new_range)
|
uint8_t skip_updates, bool force_new_range)
|
||||||
: Component(), switch_::Switch() {
|
: Component(), switch_::Switch() {
|
||||||
this->register_type = register_type;
|
this->register_type = register_type;
|
||||||
this->start_address = start_address;
|
this->start_address = start_address;
|
||||||
this->offset = offset;
|
this->offset = offset;
|
||||||
this->bitmask = bitmask;
|
this->bitmask = bitmask;
|
||||||
this->sensor_value_type = SensorValueType::BIT;
|
this->sensor_value_type = SensorValueType::BIT;
|
||||||
this->skip_updates = 0;
|
this->skip_updates = skip_updates;
|
||||||
this->register_count = 1;
|
this->register_count = 1;
|
||||||
if (register_type == ModbusRegisterType::HOLDING || register_type == ModbusRegisterType::COIL) {
|
if (register_type == ModbusRegisterType::HOLDING || register_type == ModbusRegisterType::COIL) {
|
||||||
this->start_address += offset;
|
this->start_address += offset;
|
||||||
|
|||||||
@@ -150,20 +150,28 @@ class Sensor : public EntityBase {
|
|||||||
void internal_send_state_to_frontend(float state);
|
void internal_send_state_to_frontend(float state);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Override this to set the default unit of measurement.
|
/** Override this to set the default unit of measurement.
|
||||||
ESPDEPRECATED("unit_of_measurement() is deprecated, set property during config validation instead.", "2022.01")
|
*
|
||||||
|
* @deprecated This method is deprecated, set the property during config validation instead. (2022.1)
|
||||||
|
*/
|
||||||
virtual std::string unit_of_measurement(); // NOLINT
|
virtual std::string unit_of_measurement(); // NOLINT
|
||||||
|
|
||||||
/// Override this to set the default accuracy in decimals.
|
/** Override this to set the default accuracy in decimals.
|
||||||
ESPDEPRECATED("accuracy_decimals() is deprecated, set property during config validation instead.", "2022.01")
|
*
|
||||||
|
* @deprecated This method is deprecated, set the property during config validation instead. (2022.1)
|
||||||
|
*/
|
||||||
virtual int8_t accuracy_decimals(); // NOLINT
|
virtual int8_t accuracy_decimals(); // NOLINT
|
||||||
|
|
||||||
/// Override this to set the default device class.
|
/** Override this to set the default device class.
|
||||||
ESPDEPRECATED("device_class() is deprecated, set property during config validation instead.", "2022.01")
|
*
|
||||||
|
* @deprecated This method is deprecated, set the property during config validation instead. (2022.1)
|
||||||
|
*/
|
||||||
virtual std::string device_class(); // NOLINT
|
virtual std::string device_class(); // NOLINT
|
||||||
|
|
||||||
/// Override this to set the default state class.
|
/** Override this to set the default state class.
|
||||||
ESPDEPRECATED("state_class() is deprecated, set property during config validation instead.", "2022.01")
|
*
|
||||||
|
* @deprecated This method is deprecated, set the property during config validation instead. (2022.1)
|
||||||
|
*/
|
||||||
virtual StateClass state_class(); // NOLINT
|
virtual StateClass state_class(); // NOLINT
|
||||||
|
|
||||||
uint32_t hash_base() override;
|
uint32_t hash_base() override;
|
||||||
|
|||||||
@@ -236,7 +236,18 @@ void WebServer::handle_index_request(AsyncWebServerRequest *request) {
|
|||||||
#ifdef USE_NUMBER
|
#ifdef USE_NUMBER
|
||||||
for (auto *obj : App.get_numbers())
|
for (auto *obj : App.get_numbers())
|
||||||
if (this->include_internal_ || !obj->is_internal())
|
if (this->include_internal_ || !obj->is_internal())
|
||||||
write_row(stream, obj, "number", "");
|
write_row(stream, obj, "number", "", [](AsyncResponseStream &stream, EntityBase *obj) {
|
||||||
|
number::Number *number = (number::Number *) obj;
|
||||||
|
stream.print(R"(<input type="number" min=")");
|
||||||
|
stream.print(number->traits.get_min_value());
|
||||||
|
stream.print(R"(" max=")");
|
||||||
|
stream.print(number->traits.get_max_value());
|
||||||
|
stream.print(R"(" step=")");
|
||||||
|
stream.print(number->traits.get_step());
|
||||||
|
stream.print(R"(" value=")");
|
||||||
|
stream.print(number->state);
|
||||||
|
stream.print(R"("/>)");
|
||||||
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SELECT
|
#ifdef USE_SELECT
|
||||||
@@ -652,18 +663,38 @@ void WebServer::handle_number_request(AsyncWebServerRequest *request, const UrlM
|
|||||||
for (auto *obj : App.get_numbers()) {
|
for (auto *obj : App.get_numbers()) {
|
||||||
if (obj->get_object_id() != match.id)
|
if (obj->get_object_id() != match.id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (request->method() == HTTP_GET) {
|
||||||
std::string data = this->number_json(obj, obj->state);
|
std::string data = this->number_json(obj, obj->state);
|
||||||
request->send(200, "text/json", data.c_str());
|
request->send(200, "text/json", data.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (match.method != "set") {
|
||||||
|
request->send(404);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto call = obj->make_call();
|
||||||
|
|
||||||
|
if (request->hasParam("value")) {
|
||||||
|
String value = request->getParam("value")->value();
|
||||||
|
optional<float> value_f = parse_number<float>(value.c_str());
|
||||||
|
if (value_f.has_value())
|
||||||
|
call.set_value(*value_f);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->defer([call]() mutable { call.perform(); });
|
||||||
|
request->send(200);
|
||||||
|
return;
|
||||||
|
}
|
||||||
request->send(404);
|
request->send(404);
|
||||||
}
|
}
|
||||||
std::string WebServer::number_json(number::Number *obj, float value) {
|
std::string WebServer::number_json(number::Number *obj, float value) {
|
||||||
return json::build_json([obj, value](JsonObject root) {
|
return json::build_json([obj, value](JsonObject root) {
|
||||||
root["id"] = "number-" + obj->get_object_id();
|
root["id"] = "number-" + obj->get_object_id();
|
||||||
char buffer[64];
|
std::string state = str_sprintf("%f", value);
|
||||||
snprintf(buffer, sizeof(buffer), "%f", value);
|
root["state"] = state;
|
||||||
root["state"] = buffer;
|
|
||||||
root["value"] = value;
|
root["value"] = value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -769,7 +800,7 @@ bool WebServer::canHandle(AsyncWebServerRequest *request) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_NUMBER
|
#ifdef USE_NUMBER
|
||||||
if (request->method() == HTTP_GET && match.domain == "number")
|
if ((request->method() == HTTP_POST || request->method() == HTTP_GET) && match.domain == "number")
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""Constants used by esphome."""
|
"""Constants used by esphome."""
|
||||||
|
|
||||||
__version__ = "2022.1.0-dev"
|
__version__ = "2022.1.0b4"
|
||||||
|
|
||||||
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||||
|
|
||||||
|
|||||||
@@ -287,13 +287,12 @@ uint32_t random_uint32() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
float random_float() { return static_cast<float>(random_uint32()) / static_cast<float>(UINT32_MAX); }
|
float random_float() { return static_cast<float>(random_uint32()) / static_cast<float>(UINT32_MAX); }
|
||||||
void random_bytes(uint8_t *data, size_t len) {
|
bool random_bytes(uint8_t *data, size_t len) {
|
||||||
#ifdef USE_ESP32
|
#ifdef USE_ESP32
|
||||||
esp_fill_random(data, len);
|
esp_fill_random(data, len);
|
||||||
|
return true;
|
||||||
#elif defined(USE_ESP8266)
|
#elif defined(USE_ESP8266)
|
||||||
if (os_get_random(data, len) != 0) {
|
return os_get_random(data, len) == 0;
|
||||||
ESP_LOGE(TAG, "Failed to generate random bytes!");
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#error "No random source available for this configuration."
|
#error "No random source available for this configuration."
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ uint32_t random_uint32();
|
|||||||
/// Return a random float between 0 and 1.
|
/// Return a random float between 0 and 1.
|
||||||
float random_float();
|
float random_float();
|
||||||
/// Generate \p len number of random bytes.
|
/// Generate \p len number of random bytes.
|
||||||
void random_bytes(uint8_t *data, size_t len);
|
bool random_bytes(uint8_t *data, size_t len);
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ class DownloadBinaryRequestHandler(BaseHandler):
|
|||||||
if storage_json is None:
|
if storage_json is None:
|
||||||
self.send_error(404)
|
self.send_error(404)
|
||||||
return
|
return
|
||||||
filename = f"{storage_json.name}.bin"
|
filename = f"{storage_json.name}-factory.bin"
|
||||||
path = storage_json.firmware_bin_path.replace(
|
path = storage_json.firmware_bin_path.replace(
|
||||||
"firmware.bin", "firmware-factory.bin"
|
"firmware.bin", "firmware-factory.bin"
|
||||||
)
|
)
|
||||||
@@ -445,6 +445,7 @@ class DownloadBinaryRequestHandler(BaseHandler):
|
|||||||
|
|
||||||
self.set_header("Content-Type", "application/octet-stream")
|
self.set_header("Content-Type", "application/octet-stream")
|
||||||
self.set_header("Content-Disposition", f'attachment; filename="{filename}"')
|
self.set_header("Content-Disposition", f'attachment; filename="{filename}"')
|
||||||
|
self.set_header("Cache-Control", "no-cache")
|
||||||
if not Path(path).is_file():
|
if not Path(path).is_file():
|
||||||
self.send_error(404)
|
self.send_error(404)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ pyserial==3.5
|
|||||||
platformio==5.2.4 # When updating platformio, also update Dockerfile
|
platformio==5.2.4 # When updating platformio, also update Dockerfile
|
||||||
esptool==3.2
|
esptool==3.2
|
||||||
click==8.0.3
|
click==8.0.3
|
||||||
esphome-dashboard==20220113.1
|
esphome-dashboard==20220116.0
|
||||||
aioesphomeapi==10.6.0
|
aioesphomeapi==10.6.0
|
||||||
zeroconf==0.37.0
|
zeroconf==0.37.0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user