mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-13 11:44:29 +05:00
Compare commits
15 Commits
async
...
c39eeee9cf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c39eeee9cf | ||
|
|
f2fe6036c2 | ||
|
|
6f8c8567a0 | ||
|
|
e573ce582f | ||
|
|
0b60734a3b | ||
|
|
40dc863530 | ||
|
|
d4603aa0de | ||
|
|
a40413aeac | ||
|
|
9a045bfc40 | ||
|
|
c78d2d0c0b | ||
|
|
b7825111bb | ||
|
|
d5691ef8f7 | ||
|
|
0213582464 | ||
|
|
396dc7f7e3 | ||
|
|
9d38525251 |
@@ -147,8 +147,19 @@ public:
|
|||||||
return topic;
|
return topic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class DT, class VT>
|
||||||
|
String getEntityIdWithPrefix(DT domain, VT value, char separator = '_') {
|
||||||
|
String topic = "";
|
||||||
|
topic.concat(domain);
|
||||||
|
topic.concat('.');
|
||||||
|
topic.concat(this->devicePrefix);
|
||||||
|
topic.concat(separator);
|
||||||
|
topic.concat(value);
|
||||||
|
return topic;
|
||||||
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
String getObjectIdWithPrefix(T value, char separator = '_') {
|
String getUniqueIdWithPrefix(T value, char separator = '_') {
|
||||||
String topic = "";
|
String topic = "";
|
||||||
topic.concat(this->devicePrefix);
|
topic.concat(this->devicePrefix);
|
||||||
topic.concat(separator);
|
topic.concat(separator);
|
||||||
|
|||||||
@@ -12,66 +12,67 @@ const char HA_ENTITY_SELECT[] PROGMEM = "select";
|
|||||||
const char HA_ENTITY_SENSOR[] PROGMEM = "sensor";
|
const char HA_ENTITY_SENSOR[] PROGMEM = "sensor";
|
||||||
const char HA_ENTITY_SWITCH[] PROGMEM = "switch";
|
const char HA_ENTITY_SWITCH[] PROGMEM = "switch";
|
||||||
|
|
||||||
const char HA_DEVICE[] PROGMEM = "device";
|
// https://www.home-assistant.io/integrations/mqtt/#supported-abbreviations-in-mqtt-discovery-messages
|
||||||
const char HA_IDENTIFIERS[] PROGMEM = "identifiers";
|
const char HA_DEFAULT_ENTITY_ID[] PROGMEM = "def_ent_id"; // "default_entity_id "
|
||||||
const char HA_SW_VERSION[] PROGMEM = "sw_version";
|
const char HA_DEVICE[] PROGMEM = "dev"; // "device"
|
||||||
const char HA_MANUFACTURER[] PROGMEM = "manufacturer";
|
const char HA_IDENTIFIERS[] PROGMEM = "ids"; // "identifiers"
|
||||||
const char HA_MODEL[] PROGMEM = "model";
|
const char HA_SW_VERSION[] PROGMEM = "sw"; // "sw_version"
|
||||||
|
const char HA_MANUFACTURER[] PROGMEM = "mf"; // "manufacturer"
|
||||||
|
const char HA_MODEL[] PROGMEM = "mdl"; // "model"
|
||||||
const char HA_NAME[] PROGMEM = "name";
|
const char HA_NAME[] PROGMEM = "name";
|
||||||
const char HA_CONF_URL[] PROGMEM = "configuration_url";
|
const char HA_CONF_URL[] PROGMEM = "cu"; // "configuration_url"
|
||||||
const char HA_COMMAND_TOPIC[] PROGMEM = "command_topic";
|
const char HA_COMMAND_TOPIC[] PROGMEM = "cmd_t"; // "command_topic"
|
||||||
const char HA_COMMAND_TEMPLATE[] PROGMEM = "command_template";
|
const char HA_COMMAND_TEMPLATE[] PROGMEM = "cmd_tpl"; // "command_template"
|
||||||
const char HA_ENABLED_BY_DEFAULT[] PROGMEM = "enabled_by_default";
|
const char HA_ENABLED_BY_DEFAULT[] PROGMEM = "en"; // "enabled_by_default"
|
||||||
const char HA_UNIQUE_ID[] PROGMEM = "unique_id";
|
const char HA_UNIQUE_ID[] PROGMEM = "uniq_id"; // "unique_id"
|
||||||
const char HA_OBJECT_ID[] PROGMEM = "object_id";
|
const char HA_ENTITY_CATEGORY[] PROGMEM = "ent_cat"; // "entity_category"
|
||||||
const char HA_ENTITY_CATEGORY[] PROGMEM = "entity_category";
|
|
||||||
const char HA_ENTITY_CATEGORY_DIAGNOSTIC[] PROGMEM = "diagnostic";
|
const char HA_ENTITY_CATEGORY_DIAGNOSTIC[] PROGMEM = "diagnostic";
|
||||||
const char HA_ENTITY_CATEGORY_CONFIG[] PROGMEM = "config";
|
const char HA_ENTITY_CATEGORY_CONFIG[] PROGMEM = "config";
|
||||||
const char HA_STATE_TOPIC[] PROGMEM = "state_topic";
|
const char HA_STATE_TOPIC[] PROGMEM = "stat_t"; // "state_topic"
|
||||||
const char HA_VALUE_TEMPLATE[] PROGMEM = "value_template";
|
const char HA_VALUE_TEMPLATE[] PROGMEM = "val_tpl"; // "value_template"
|
||||||
const char HA_OPTIONS[] PROGMEM = "options";
|
const char HA_OPTIONS[] PROGMEM = "ops"; // "options"
|
||||||
const char HA_AVAILABILITY[] PROGMEM = "availability";
|
const char HA_AVAILABILITY[] PROGMEM = "avty"; // "availability"
|
||||||
const char HA_AVAILABILITY_MODE[] PROGMEM = "availability_mode";
|
const char HA_AVAILABILITY_MODE[] PROGMEM = "avty_mode"; // "availability_mode"
|
||||||
const char HA_TOPIC[] PROGMEM = "topic";
|
const char HA_TOPIC[] PROGMEM = "t"; // "topic"
|
||||||
const char HA_DEVICE_CLASS[] PROGMEM = "device_class";
|
const char HA_DEVICE_CLASS[] PROGMEM = "dev_cla"; // "device_class"
|
||||||
const char HA_UNIT_OF_MEASUREMENT[] PROGMEM = "unit_of_measurement";
|
const char HA_UNIT_OF_MEASUREMENT[] PROGMEM = "unit_of_meas"; // "unit_of_measurement"
|
||||||
const char HA_UNIT_OF_MEASUREMENT_C[] PROGMEM = "°C";
|
const char HA_UNIT_OF_MEASUREMENT_C[] PROGMEM = "°C";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_F[] PROGMEM = "°F";
|
const char HA_UNIT_OF_MEASUREMENT_F[] PROGMEM = "°F";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_PERCENT[] PROGMEM = "%";
|
const char HA_UNIT_OF_MEASUREMENT_PERCENT[] PROGMEM = "%";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_L_MIN[] PROGMEM = "L/min";
|
const char HA_UNIT_OF_MEASUREMENT_L_MIN[] PROGMEM = "L/min";
|
||||||
const char HA_UNIT_OF_MEASUREMENT_GAL_MIN[] PROGMEM = "gal/min";
|
const char HA_UNIT_OF_MEASUREMENT_GAL_MIN[] PROGMEM = "gal/min";
|
||||||
const char HA_ICON[] PROGMEM = "icon";
|
const char HA_ICON[] PROGMEM = "ic"; // "icon"
|
||||||
const char HA_MIN[] PROGMEM = "min";
|
const char HA_MIN[] PROGMEM = "min";
|
||||||
const char HA_MAX[] PROGMEM = "max";
|
const char HA_MAX[] PROGMEM = "max";
|
||||||
const char HA_STEP[] PROGMEM = "step";
|
const char HA_STEP[] PROGMEM = "step";
|
||||||
const char HA_MODE[] PROGMEM = "mode";
|
const char HA_MODE[] PROGMEM = "mode";
|
||||||
const char HA_MODE_BOX[] PROGMEM = "box";
|
const char HA_MODE_BOX[] PROGMEM = "box";
|
||||||
const char HA_STATE_ON[] PROGMEM = "state_on";
|
const char HA_STATE_ON[] PROGMEM = "stat_on"; // "state_on"
|
||||||
const char HA_STATE_OFF[] PROGMEM = "state_off";
|
const char HA_STATE_OFF[] PROGMEM = "stat_off"; // "state_off"
|
||||||
const char HA_PAYLOAD_ON[] PROGMEM = "payload_on";
|
const char HA_PAYLOAD_ON[] PROGMEM = "pl_on"; // "payload_on"
|
||||||
const char HA_PAYLOAD_OFF[] PROGMEM = "payload_off";
|
const char HA_PAYLOAD_OFF[] PROGMEM = "pl_off"; // "payload_off"
|
||||||
const char HA_STATE_CLASS[] PROGMEM = "state_class";
|
const char HA_STATE_CLASS[] PROGMEM = "stat_cla"; // "state_class"
|
||||||
const char HA_STATE_CLASS_MEASUREMENT[] PROGMEM = "measurement";
|
const char HA_STATE_CLASS_MEASUREMENT[] PROGMEM = "measurement";
|
||||||
const char HA_EXPIRE_AFTER[] PROGMEM = "expire_after";
|
const char HA_EXPIRE_AFTER[] PROGMEM = "exp_aft"; // "expire_after"
|
||||||
const char HA_CURRENT_TEMPERATURE_TOPIC[] PROGMEM = "current_temperature_topic";
|
const char HA_CURRENT_TEMPERATURE_TOPIC[] PROGMEM = "curr_temp_t"; // "current_temperature_topic"
|
||||||
const char HA_CURRENT_TEMPERATURE_TEMPLATE[] PROGMEM = "current_temperature_template";
|
const char HA_CURRENT_TEMPERATURE_TEMPLATE[] PROGMEM = "curr_temp_tpl"; // "current_temperature_template"
|
||||||
const char HA_TEMPERATURE_COMMAND_TOPIC[] PROGMEM = "temperature_command_topic";
|
const char HA_TEMPERATURE_COMMAND_TOPIC[] PROGMEM = "temp_cmd_t"; // "temperature_command_topic"
|
||||||
const char HA_TEMPERATURE_COMMAND_TEMPLATE[] PROGMEM = "temperature_command_template";
|
const char HA_TEMPERATURE_COMMAND_TEMPLATE[] PROGMEM = "temp_cmd_tpl"; // "temperature_command_template"
|
||||||
const char HA_TEMPERATURE_STATE_TOPIC[] PROGMEM = "temperature_state_topic";
|
const char HA_TEMPERATURE_STATE_TOPIC[] PROGMEM = "temp_stat_t"; // "temperature_state_topic"
|
||||||
const char HA_TEMPERATURE_STATE_TEMPLATE[] PROGMEM = "temperature_state_template";
|
const char HA_TEMPERATURE_STATE_TEMPLATE[] PROGMEM = "temp_stat_tpl"; // "temperature_state_template"
|
||||||
const char HA_TEMPERATURE_UNIT[] PROGMEM = "temperature_unit";
|
const char HA_TEMPERATURE_UNIT[] PROGMEM = "temp_unit"; // "temperature_unit"
|
||||||
const char HA_MODE_COMMAND_TOPIC[] PROGMEM = "mode_command_topic";
|
const char HA_MODE_COMMAND_TOPIC[] PROGMEM = "mode_cmd_t"; // "mode_command_topic"
|
||||||
const char HA_MODE_COMMAND_TEMPLATE[] PROGMEM = "mode_command_template";
|
const char HA_MODE_COMMAND_TEMPLATE[] PROGMEM = "mode_cmd_tpl"; // "mode_command_template"
|
||||||
const char HA_MODE_STATE_TOPIC[] PROGMEM = "mode_state_topic";
|
const char HA_MODE_STATE_TOPIC[] PROGMEM = "mode_stat_t"; // "mode_state_topic"
|
||||||
const char HA_MODE_STATE_TEMPLATE[] PROGMEM = "mode_state_template";
|
const char HA_MODE_STATE_TEMPLATE[] PROGMEM = "mode_stat_tpl"; // "mode_state_template"
|
||||||
const char HA_MODES[] PROGMEM = "modes";
|
const char HA_MODES[] PROGMEM = "modes";
|
||||||
const char HA_ACTION_TOPIC[] PROGMEM = "action_topic";
|
const char HA_ACTION_TOPIC[] PROGMEM = "act_t"; // "action_topic"
|
||||||
const char HA_ACTION_TEMPLATE[] PROGMEM = "action_template";
|
const char HA_ACTION_TEMPLATE[] PROGMEM = "act_tpl"; // "action_template"
|
||||||
const char HA_MIN_TEMP[] PROGMEM = "min_temp";
|
const char HA_MIN_TEMP[] PROGMEM = "min_temp";
|
||||||
const char HA_MAX_TEMP[] PROGMEM = "max_temp";
|
const char HA_MAX_TEMP[] PROGMEM = "max_temp";
|
||||||
const char HA_TEMP_STEP[] PROGMEM = "temp_step";
|
const char HA_TEMP_STEP[] PROGMEM = "temp_step";
|
||||||
const char HA_PRESET_MODE_COMMAND_TOPIC[] PROGMEM = "preset_mode_command_topic";
|
const char HA_PRESET_MODE_COMMAND_TOPIC[] PROGMEM = "pr_mode_cmd_t"; // "preset_mode_command_topic"
|
||||||
const char HA_PRESET_MODE_COMMAND_TEMPLATE[] PROGMEM = "preset_mode_command_template";
|
const char HA_PRESET_MODE_COMMAND_TEMPLATE[] PROGMEM = "pr_mode_cmd_tpl"; // "preset_mode_command_template"
|
||||||
const char HA_PRESET_MODE_STATE_TOPIC[] PROGMEM = "preset_mode_state_topic";
|
const char HA_PRESET_MODE_STATE_TOPIC[] PROGMEM = "pr_mode_stat_t"; // "preset_mode_state_topic"
|
||||||
const char HA_PRESET_MODE_VALUE_TEMPLATE[] PROGMEM = "preset_mode_value_template";
|
const char HA_PRESET_MODE_VALUE_TEMPLATE[] PROGMEM = "pr_mode_val_tpl"; // "preset_mode_value_template"
|
||||||
const char HA_PRESET_MODES[] PROGMEM = "preset_modes";
|
const char HA_PRESET_MODES[] PROGMEM = "pr_modes"; // "preset_modes"
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ public:
|
|||||||
UpgradeType type;
|
UpgradeType type;
|
||||||
UpgradeStatus status;
|
UpgradeStatus status;
|
||||||
String error;
|
String error;
|
||||||
unsigned int written = 0;
|
size_t progress = 0;
|
||||||
|
size_t size = 0;
|
||||||
} UpgradeResult;
|
} UpgradeResult;
|
||||||
|
|
||||||
typedef std::function<bool(AsyncWebServerRequest *request, UpgradeType)> BeforeUpgradeCallback;
|
typedef std::function<bool(AsyncWebServerRequest *request, UpgradeType)> BeforeUpgradeCallback;
|
||||||
@@ -57,34 +58,47 @@ public:
|
|||||||
|
|
||||||
this->firmwareResult.status = UpgradeStatus::NONE;
|
this->firmwareResult.status = UpgradeStatus::NONE;
|
||||||
this->firmwareResult.error.clear();
|
this->firmwareResult.error.clear();
|
||||||
this->firmwareResult.written = 0;
|
|
||||||
|
|
||||||
this->filesystemResult.status = UpgradeStatus::NONE;
|
this->filesystemResult.status = UpgradeStatus::NONE;
|
||||||
this->filesystemResult.error.clear();
|
this->filesystemResult.error.clear();
|
||||||
this->filesystemResult.written = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleUpload(AsyncWebServerRequest *request, const String &fileName, size_t index, uint8_t *data, size_t dataLength, bool isFinal) override final {
|
void handleUpload(AsyncWebServerRequest *request, const String &fileName, size_t index, uint8_t *data, size_t dataLength, bool isFinal) override final {
|
||||||
UpgradeResult* result = nullptr;
|
UpgradeResult* result = nullptr;
|
||||||
unsigned int fileSize = 0;
|
|
||||||
|
|
||||||
const auto& fwName = request->hasParam("fw[name]", true) ? request->getParam("fw[name]", true)->value() : String();
|
if (!request->hasParam(asyncsrv::T_name, true, true)) {
|
||||||
const auto& fsName = request->hasParam("fs[name]", true) ? request->getParam("fs[name]", true)->value() : String();
|
// Missing content-disposition 'name' parameter
|
||||||
|
return;
|
||||||
if (fileName.equals(fwName)) {
|
|
||||||
result = &this->firmwareResult;
|
|
||||||
if (request->hasParam("fw[size]", true)) {
|
|
||||||
fileSize = request->getParam("fw[size]", true)->value().toInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (fileName.equals(fsName)) {
|
|
||||||
result = &this->filesystemResult;
|
|
||||||
if (request->hasParam("fs[size]", true)) {
|
|
||||||
fileSize = request->getParam("fs[size]", true)->value().toInt();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == nullptr || result->status != UpgradeStatus::NONE) {
|
const auto& pName = request->getParam(asyncsrv::T_name, true, true)->value();
|
||||||
|
if (pName.equals("fw")) {
|
||||||
|
result = &this->firmwareResult;
|
||||||
|
|
||||||
|
if (!index) {
|
||||||
|
result->progress = 0;
|
||||||
|
result->size = request->hasParam("fw_size", true)
|
||||||
|
? request->getParam("fw_size", true)->value().toInt()
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (pName.equals("fs")) {
|
||||||
|
result = &this->filesystemResult;
|
||||||
|
|
||||||
|
if (!index) {
|
||||||
|
result->progress = 0;
|
||||||
|
result->size = request->hasParam("fs_size", true)
|
||||||
|
? request->getParam("fs_size", true)->value().toInt()
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Unknown parameter name
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check result status
|
||||||
|
if (result->status != UpgradeStatus::NONE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,18 +107,19 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fileName.length() || !fileSize) {
|
if (!fileName.length()) {
|
||||||
result->status = UpgradeStatus::NO_FILE;
|
result->status = UpgradeStatus::NO_FILE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == 0) {
|
if (!index) {
|
||||||
// reset
|
// reset
|
||||||
if (Update.isRunning()) {
|
if (Update.isRunning()) {
|
||||||
Update.end(false);
|
Update.end(false);
|
||||||
Update.clearError();
|
Update.clearError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// try begin
|
||||||
bool begin = false;
|
bool begin = false;
|
||||||
if (result->type == UpgradeType::FIRMWARE) {
|
if (result->type == UpgradeType::FIRMWARE) {
|
||||||
begin = Update.begin(UPDATE_SIZE_UNKNOWN, U_FLASH);
|
begin = Update.begin(UPDATE_SIZE_UNKNOWN, U_FLASH);
|
||||||
@@ -117,54 +132,52 @@ public:
|
|||||||
result->status = UpgradeStatus::ERROR_ON_START;
|
result->status = UpgradeStatus::ERROR_ON_START;
|
||||||
result->error = Update.errorString();
|
result->error = Update.errorString();
|
||||||
|
|
||||||
Log.serrorln(FPSTR(L_PORTAL_OTA), F("File '%s', on start: %s"), fileName.c_str(), result->error.c_str());
|
Log.serrorln(FPSTR(L_PORTAL_OTA), "File '%s', on start: %s", fileName.c_str(), result->error.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_PORTAL_OTA), F("File '%s', started"), fileName.c_str());
|
Log.sinfoln(FPSTR(L_PORTAL_OTA), "File '%s', started", fileName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dataLength) {
|
if (dataLength) {
|
||||||
result->written += dataLength;
|
|
||||||
|
|
||||||
if (Update.write(data, dataLength) != dataLength) {
|
if (Update.write(data, dataLength) != dataLength) {
|
||||||
Update.end(false);
|
Update.end(false);
|
||||||
result->status = UpgradeStatus::ERROR_ON_WRITE;
|
result->status = UpgradeStatus::ERROR_ON_WRITE;
|
||||||
result->error = Update.errorString();
|
result->error = Update.errorString();
|
||||||
|
|
||||||
Log.serrorln(
|
Log.serrorln(
|
||||||
FPSTR(L_PORTAL_OTA),
|
FPSTR(L_PORTAL_OTA), "File '%s', on write %d bytes, %d of %d bytes",
|
||||||
F("File '%s', on write %d bytes, %d of %d bytes"),
|
|
||||||
fileName.c_str(),
|
fileName.c_str(),
|
||||||
dataLength,
|
dataLength,
|
||||||
result->written,
|
result->progress + dataLength,
|
||||||
fileSize
|
result->size
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result->progress += dataLength;
|
||||||
Log.sinfoln(
|
Log.sinfoln(
|
||||||
FPSTR(L_PORTAL_OTA),
|
FPSTR(L_PORTAL_OTA), "File '%s', write %d bytes, %d of %d bytes",
|
||||||
F("File '%s', write %d bytes, %d of %d bytes"),
|
|
||||||
fileName.c_str(),
|
fileName.c_str(),
|
||||||
dataLength,
|
dataLength,
|
||||||
result->written,
|
result->progress,
|
||||||
fileSize
|
result->size
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result->written > fileSize || (isFinal && result->written < fileSize)) {
|
if (result->size > 0) {
|
||||||
Update.end(false);
|
if (result->progress > result->size || (isFinal && result->progress < result->size)) {
|
||||||
result->status = UpgradeStatus::SIZE_MISMATCH;
|
Update.end(false);
|
||||||
|
result->status = UpgradeStatus::SIZE_MISMATCH;
|
||||||
|
|
||||||
Log.serrorln(
|
Log.serrorln(
|
||||||
FPSTR(L_PORTAL_OTA),
|
FPSTR(L_PORTAL_OTA), "File '%s', size mismatch: %d of %d bytes",
|
||||||
F("File '%s', size mismatch: %d of %d bytes"),
|
fileName.c_str(),
|
||||||
fileName.c_str(),
|
result->progress,
|
||||||
result->written,
|
result->size
|
||||||
fileSize
|
);
|
||||||
);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFinal) {
|
if (isFinal) {
|
||||||
@@ -172,12 +185,12 @@ public:
|
|||||||
result->status = UpgradeStatus::ERROR_ON_FINISH;
|
result->status = UpgradeStatus::ERROR_ON_FINISH;
|
||||||
result->error = Update.errorString();
|
result->error = Update.errorString();
|
||||||
|
|
||||||
Log.serrorln(FPSTR(L_PORTAL_OTA), F("File '%s', on finish: %s"), fileName.c_str(), result->error);
|
Log.serrorln(FPSTR(L_PORTAL_OTA), "File '%s', on finish: %s", fileName.c_str(), result->error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
result->status = UpgradeStatus::SUCCESS;
|
result->status = UpgradeStatus::SUCCESS;
|
||||||
Log.sinfoln(FPSTR(L_PORTAL_OTA), F("File '%s': finish"), fileName.c_str());
|
Log.sinfoln(FPSTR(L_PORTAL_OTA), "File '%s': finish", fileName.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
600
platformio.ini
600
platformio.ini
@@ -1,385 +1,275 @@
|
|||||||
; PlatformIO Project Configuration File
|
|
||||||
;
|
|
||||||
; Build options: build flags, source filter
|
|
||||||
; Upload options: custom upload port, speed and extra flags
|
|
||||||
; Library options: dependencies, extra library storages
|
|
||||||
; Advanced options: extra scripting
|
|
||||||
;
|
|
||||||
; Please visit documentation for the other options and examples
|
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
;extra_configs = secrets.ini
|
;extra_configs = secrets.ini
|
||||||
extra_configs = secrets.default.ini
|
extra_configs = secrets.default.ini
|
||||||
core_dir = .pio
|
core_dir = .pio
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
version = 1.5.6
|
version = 1.5.7-passiveble
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps = ESP32Async/AsyncTCP
|
||||||
ESP32Async/AsyncTCP
|
;ESP32Async/ESPAsyncWebServer
|
||||||
;ESP32Async/ESPAsyncWebServer
|
https://github.com/ESP32Async/ESPAsyncWebServer
|
||||||
https://github.com/ESP32Async/ESPAsyncWebServer#main
|
bblanchon/ArduinoJson@^7.4.2
|
||||||
bblanchon/ArduinoJson@^7.4.2
|
;ihormelnyk/OpenTherm Library@^1.1.5
|
||||||
;ihormelnyk/OpenTherm Library@^1.1.5
|
https://github.com/Laxilef/opentherm_library#esp32_timer
|
||||||
https://github.com/Laxilef/opentherm_library#esp32_timer
|
arduino-libraries/ArduinoMqttClient@^0.1.8
|
||||||
arduino-libraries/ArduinoMqttClient@^0.1.8
|
lennarthennigs/ESP Telnet@^2.2.3
|
||||||
lennarthennigs/ESP Telnet@^2.2.3
|
gyverlibs/FileData@^1.0.3
|
||||||
gyverlibs/FileData@^1.0.3
|
gyverlibs/GyverPID@^3.3.2
|
||||||
gyverlibs/GyverPID@^3.3.2
|
gyverlibs/GyverBlinker@^1.1.1
|
||||||
gyverlibs/GyverBlinker@^1.1.1
|
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg
|
||||||
https://github.com/pstolarz/Arduino-Temperature-Control-Library.git#OneWireNg
|
laxilef/TinyLogger@^1.1.1
|
||||||
laxilef/TinyLogger@^1.1.1
|
build_type = ${secrets.build_type}
|
||||||
build_type = ${secrets.build_type}
|
build_flags = -mtext-section-literals
|
||||||
build_flags =
|
-Wno-deprecated-declarations
|
||||||
-mtext-section-literals
|
-D MQTT_CLIENT_STD_FUNCTION_CALLBACK=1
|
||||||
-D MQTT_CLIENT_STD_FUNCTION_CALLBACK=1
|
;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial
|
||||||
;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial
|
-D BUILD_VERSION='"${this.version}"'
|
||||||
-D BUILD_VERSION='"${this.version}"'
|
-D BUILD_ENV='"$PIOENV"'
|
||||||
-D BUILD_ENV='"$PIOENV"'
|
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096
|
||||||
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096
|
-D ARDUINOJSON_USE_DOUBLE=0
|
||||||
-D ARDUINOJSON_USE_DOUBLE=0
|
-D ARDUINOJSON_USE_LONG_LONG=0
|
||||||
-D ARDUINOJSON_USE_LONG_LONG=0
|
-D DEFAULT_SERIAL_ENABLED=${secrets.serial_enabled}
|
||||||
-D DEFAULT_SERIAL_ENABLED=${secrets.serial_enabled}
|
-D DEFAULT_SERIAL_BAUD=${secrets.serial_baud}
|
||||||
-D DEFAULT_SERIAL_BAUD=${secrets.serial_baud}
|
-D DEFAULT_TELNET_ENABLED=${secrets.telnet_enabled}
|
||||||
-D DEFAULT_TELNET_ENABLED=${secrets.telnet_enabled}
|
-D DEFAULT_TELNET_PORT=${secrets.telnet_port}
|
||||||
-D DEFAULT_TELNET_PORT=${secrets.telnet_port}
|
-D DEFAULT_LOG_LEVEL=${secrets.log_level}
|
||||||
-D DEFAULT_LOG_LEVEL=${secrets.log_level}
|
-D DEFAULT_HOSTNAME='"${secrets.hostname}"'
|
||||||
-D DEFAULT_HOSTNAME='"${secrets.hostname}"'
|
-D DEFAULT_AP_SSID='"${secrets.ap_ssid}"'
|
||||||
-D DEFAULT_AP_SSID='"${secrets.ap_ssid}"'
|
-D DEFAULT_AP_PASSWORD='"${secrets.ap_password}"'
|
||||||
-D DEFAULT_AP_PASSWORD='"${secrets.ap_password}"'
|
-D DEFAULT_STA_SSID='"${secrets.sta_ssid}"'
|
||||||
-D DEFAULT_STA_SSID='"${secrets.sta_ssid}"'
|
-D DEFAULT_STA_PASSWORD='"${secrets.sta_password}"'
|
||||||
-D DEFAULT_STA_PASSWORD='"${secrets.sta_password}"'
|
-D DEFAULT_PORTAL_LOGIN='"${secrets.portal_login}"'
|
||||||
-D DEFAULT_PORTAL_LOGIN='"${secrets.portal_login}"'
|
-D DEFAULT_PORTAL_PASSWORD='"${secrets.portal_password}"'
|
||||||
-D DEFAULT_PORTAL_PASSWORD='"${secrets.portal_password}"'
|
-D DEFAULT_MQTT_ENABLED=${secrets.mqtt_enabled}
|
||||||
-D DEFAULT_MQTT_ENABLED=${secrets.mqtt_enabled}
|
-D DEFAULT_MQTT_SERVER='"${secrets.mqtt_server}"'
|
||||||
-D DEFAULT_MQTT_SERVER='"${secrets.mqtt_server}"'
|
-D DEFAULT_MQTT_PORT=${secrets.mqtt_port}
|
||||||
-D DEFAULT_MQTT_PORT=${secrets.mqtt_port}
|
-D DEFAULT_MQTT_USER='"${secrets.mqtt_user}"'
|
||||||
-D DEFAULT_MQTT_USER='"${secrets.mqtt_user}"'
|
-D DEFAULT_MQTT_PASSWORD='"${secrets.mqtt_password}"'
|
||||||
-D DEFAULT_MQTT_PASSWORD='"${secrets.mqtt_password}"'
|
-D DEFAULT_MQTT_PREFIX='"${secrets.mqtt_prefix}"'
|
||||||
-D DEFAULT_MQTT_PREFIX='"${secrets.mqtt_prefix}"'
|
upload_speed = 921600
|
||||||
upload_speed = 921600
|
monitor_speed = 115200
|
||||||
monitor_speed = 115200
|
;monitor_filters = direct
|
||||||
;monitor_filters = direct
|
monitor_filters = esp32_exception_decoder
|
||||||
monitor_filters =
|
esp8266_exception_decoder
|
||||||
esp32_exception_decoder
|
board_build.flash_mode = dio
|
||||||
esp8266_exception_decoder
|
board_build.filesystem = littlefs
|
||||||
board_build.flash_mode = dio
|
check_tool = ;pvs-studio
|
||||||
board_build.filesystem = littlefs
|
check_flags = ;pvs-studio: --analysis-mode=4 --exclude-path=./.pio/libdeps
|
||||||
check_tool = ; pvs-studio
|
|
||||||
check_flags =
|
|
||||||
; pvs-studio:
|
|
||||||
; --analysis-mode=4
|
|
||||||
; --exclude-path=./.pio/libdeps
|
|
||||||
|
|
||||||
; Defaults
|
; Defaults
|
||||||
[esp8266_defaults]
|
[esp8266_defaults]
|
||||||
platform = espressif8266@^4.2.1
|
platform = espressif8266@^4.2.1
|
||||||
platform_packages = ${env.platform_packages}
|
platform_packages = ${env.platform_packages}
|
||||||
lib_deps =
|
lib_deps = ${env.lib_deps}
|
||||||
${env.lib_deps}
|
nrwiersma/ESP8266Scheduler@^1.2
|
||||||
nrwiersma/ESP8266Scheduler@^1.2
|
lib_ignore =
|
||||||
lib_ignore =
|
extra_scripts = post:tools/build.py
|
||||||
extra_scripts =
|
build_type = ${env.build_type}
|
||||||
post:tools/build.py
|
build_flags = ${env.build_flags}
|
||||||
build_type = ${env.build_type}
|
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||||
build_flags =
|
;-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
|
||||||
${env.build_flags}
|
-D PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK305
|
||||||
-D PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
board_build.ldscript = eagle.flash.4m1m.ld
|
||||||
;-D PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
|
check_tool = ${env.check_tool}
|
||||||
-D PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK305
|
check_flags = ${env.check_flags}
|
||||||
board_build.ldscript = eagle.flash.4m1m.ld
|
|
||||||
check_tool = ${env.check_tool}
|
|
||||||
check_flags = ${env.check_flags}
|
|
||||||
|
|
||||||
[esp32_defaults]
|
[esp32_defaults]
|
||||||
;platform = espressif32@^6.7
|
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.34/platform-espressif32.zip
|
||||||
;platform = https://github.com/platformio/platform-espressif32.git
|
platform_packages = ${env.platform_packages}
|
||||||
;platform_packages =
|
board_build.partitions = esp32_partitions.csv
|
||||||
; framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.5
|
lib_deps = ${env.lib_deps}
|
||||||
; framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-lib-builder/releases/download/idf-release_v5.1/esp32-arduino-libs-idf-release_v5.1-33fbade6.zip
|
laxilef/ESP32Scheduler@^1.0.1
|
||||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.32/platform-espressif32.zip
|
nimble_lib = https://github.com/h2zero/NimBLE-Arduino
|
||||||
platform_packages = ${env.platform_packages}
|
lib_ignore = BluetoothSerial
|
||||||
board_build.partitions = esp32_partitions.csv
|
SimpleBLE
|
||||||
lib_deps =
|
ESP RainMaker
|
||||||
${env.lib_deps}
|
RainMaker
|
||||||
laxilef/ESP32Scheduler@^1.0.1
|
ESP Insights
|
||||||
nimble_lib = https://github.com/h2zero/NimBLE-Arduino
|
Insights
|
||||||
lib_ignore =
|
Zigbee
|
||||||
extra_scripts =
|
Matter
|
||||||
post:tools/esp32.py
|
OpenThread
|
||||||
post:tools/build.py
|
dsp
|
||||||
build_type = ${env.build_type}
|
custom_component_remove = espressif/esp_hosted
|
||||||
build_flags =
|
espressif/esp_wifi_remote
|
||||||
${env.build_flags}
|
espressif/esp-dsp
|
||||||
-D CORE_DEBUG_LEVEL=0
|
espressif/esp_modem
|
||||||
-Wl,--wrap=esp_panic_handler
|
espressif/esp_rainmaker
|
||||||
check_tool = ${env.check_tool}
|
espressif/rmaker_common
|
||||||
check_flags = ${env.check_flags}
|
espressif/esp_insights
|
||||||
|
espressif/esp_diag_data_store
|
||||||
|
espressif/esp_diagnostics
|
||||||
|
espressif/libsodium
|
||||||
|
espressif/esp-modbus
|
||||||
|
espressif/esp-cbor
|
||||||
|
espressif/esp-sr
|
||||||
|
espressif/esp32-camera
|
||||||
|
espressif/qrcode
|
||||||
|
espressif/esp-zboss-lib
|
||||||
|
espressif/esp-zigbee-lib
|
||||||
|
chmorgan/esp-libhelix-mp3
|
||||||
|
extra_scripts = post:tools/esp32.py
|
||||||
|
post:tools/build.py
|
||||||
|
build_type = ${env.build_type}
|
||||||
|
build_flags = ${env.build_flags}
|
||||||
|
-D CORE_DEBUG_LEVEL=0
|
||||||
|
-Wl,--wrap=esp_panic_handler
|
||||||
|
check_tool = ${env.check_tool}
|
||||||
|
check_flags = ${env.check_flags}
|
||||||
|
|
||||||
|
|
||||||
; Boards
|
; Boards
|
||||||
[env:d1_mini]
|
[env:d1_mini]
|
||||||
platform = ${esp8266_defaults.platform}
|
extends = esp8266_defaults
|
||||||
platform_packages = ${esp8266_defaults.platform_packages}
|
board = d1_mini
|
||||||
board = d1_mini
|
build_flags = ${esp8266_defaults.build_flags}
|
||||||
lib_deps = ${esp8266_defaults.lib_deps}
|
-D DEFAULT_OT_IN_GPIO=4
|
||||||
lib_ignore = ${esp8266_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=5
|
||||||
extra_scripts = ${esp8266_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
||||||
board_build.ldscript = ${esp8266_defaults.board_build.ldscript}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
||||||
build_type = ${esp8266_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=13
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=15
|
||||||
${esp8266_defaults.build_flags}
|
|
||||||
-D DEFAULT_OT_IN_GPIO=4
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=5
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=13
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=15
|
|
||||||
check_tool = ${esp8266_defaults.check_tool}
|
|
||||||
check_flags = ${esp8266_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:d1_mini_lite]
|
[env:d1_mini_lite]
|
||||||
platform = ${esp8266_defaults.platform}
|
extends = esp8266_defaults
|
||||||
platform_packages = ${esp8266_defaults.platform_packages}
|
board = d1_mini_lite
|
||||||
board = d1_mini_lite
|
build_flags = ${esp8266_defaults.build_flags}
|
||||||
lib_deps = ${esp8266_defaults.lib_deps}
|
-D DEFAULT_OT_IN_GPIO=4
|
||||||
lib_ignore = ${esp8266_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=5
|
||||||
extra_scripts = ${esp8266_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
||||||
board_build.ldscript = ${esp8266_defaults.board_build.ldscript}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
||||||
build_type = ${esp8266_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=13
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=15
|
||||||
${esp8266_defaults.build_flags}
|
|
||||||
-D DEFAULT_OT_IN_GPIO=4
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=5
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=13
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=15
|
|
||||||
check_tool = ${esp8266_defaults.check_tool}
|
|
||||||
check_flags = ${esp8266_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:d1_mini_pro]
|
[env:d1_mini_pro]
|
||||||
platform = ${esp8266_defaults.platform}
|
extends = esp8266_defaults
|
||||||
platform_packages = ${esp8266_defaults.platform_packages}
|
board = d1_mini_pro
|
||||||
board = d1_mini_pro
|
build_flags = ${esp8266_defaults.build_flags}
|
||||||
lib_deps = ${esp8266_defaults.lib_deps}
|
-D DEFAULT_OT_IN_GPIO=4
|
||||||
lib_ignore = ${esp8266_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=5
|
||||||
extra_scripts = ${esp8266_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
||||||
board_build.ldscript = ${esp8266_defaults.board_build.ldscript}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
||||||
build_type = ${esp8266_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=13
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=15
|
||||||
${esp8266_defaults.build_flags}
|
|
||||||
-D DEFAULT_OT_IN_GPIO=4
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=5
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=14
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=13
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=15
|
|
||||||
check_tool = ${esp8266_defaults.check_tool}
|
|
||||||
check_flags = ${esp8266_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:nodemcu_8266]
|
[env:nodemcu_8266]
|
||||||
platform = ${esp8266_defaults.platform}
|
extends = esp8266_defaults
|
||||||
platform_packages = ${esp8266_defaults.platform_packages}
|
board = nodemcuv2
|
||||||
board = nodemcuv2
|
build_flags = ${esp8266_defaults.build_flags}
|
||||||
lib_deps = ${esp8266_defaults.lib_deps}
|
-D DEFAULT_OT_IN_GPIO=13
|
||||||
lib_ignore = ${esp8266_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=15
|
||||||
extra_scripts = ${esp8266_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
||||||
board_build.ldscript = ${esp8266_defaults.board_build.ldscript}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=4
|
||||||
build_type = ${esp8266_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=2
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=16
|
||||||
${esp8266_defaults.build_flags}
|
|
||||||
-D DEFAULT_OT_IN_GPIO=13
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=15
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=4
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=2
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=16
|
|
||||||
check_tool = ${esp8266_defaults.check_tool}
|
|
||||||
check_flags = ${esp8266_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:s2_mini]
|
[env:s2_mini]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = lolin_s2_mini
|
||||||
board = lolin_s2_mini
|
build_unflags = -DARDUINO_USB_MODE=1
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
lib_deps = ${esp32_defaults.lib_deps}
|
-D ARDUINO_USB_MODE=0
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D DEFAULT_OT_IN_GPIO=33
|
||||||
build_unflags =
|
-D DEFAULT_OT_OUT_GPIO=35
|
||||||
-DARDUINO_USB_MODE=1
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=9
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=7
|
||||||
build_flags =
|
-D DEFAULT_STATUS_LED_GPIO=11
|
||||||
${esp32_defaults.build_flags}
|
-D DEFAULT_OT_RX_LED_GPIO=12
|
||||||
-D ARDUINO_USB_MODE=0
|
|
||||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=33
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=35
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=9
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=7
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=11
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=12
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:s3_mini]
|
[env:s3_mini]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = lolin_s3_mini
|
||||||
board = lolin_s3_mini
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
${esp32_defaults.nimble_lib}
|
||||||
lib_deps =
|
build_unflags = -DARDUINO_USB_MODE=1
|
||||||
${esp32_defaults.lib_deps}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
${esp32_defaults.nimble_lib}
|
-D ARDUINO_USB_MODE=0
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D ARDUINO_USB_CDC_ON_BOOT=1
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D USE_BLE=1
|
||||||
build_unflags =
|
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
||||||
-DARDUINO_USB_MODE=1
|
-D DEFAULT_OT_IN_GPIO=35
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_OT_OUT_GPIO=36
|
||||||
build_flags =
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=13
|
||||||
${esp32_defaults.build_flags}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=12
|
||||||
-D ARDUINO_USB_MODE=0
|
-D DEFAULT_STATUS_LED_GPIO=11
|
||||||
-D ARDUINO_USB_CDC_ON_BOOT=1
|
-D DEFAULT_OT_RX_LED_GPIO=10
|
||||||
;-D CONFIG_BT_NIMBLE_EXT_ADV=1
|
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=35
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=36
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=13
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=12
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=11
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=10
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:c3_mini]
|
[env:c3_mini]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = lolin_c3_mini
|
||||||
board = lolin_c3_mini
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
${esp32_defaults.nimble_lib}
|
||||||
lib_deps =
|
build_unflags = -mtext-section-literals
|
||||||
${esp32_defaults.lib_deps}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
${esp32_defaults.nimble_lib}
|
-D USE_BLE=1
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D DEFAULT_OT_IN_GPIO=8
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D DEFAULT_OT_OUT_GPIO=10
|
||||||
build_unflags =
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
||||||
-mtext-section-literals
|
-D DEFAULT_SENSOR_INDOOR_GPIO=1
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=4
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=5
|
||||||
${esp32_defaults.build_flags}
|
|
||||||
-D CONFIG_BT_NIMBLE_EXT_ADV=1
|
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=8
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=10
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=1
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=4
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=5
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:nodemcu_32]
|
[env:nodemcu_32]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = nodemcu-32s
|
||||||
board = nodemcu-32s
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
${esp32_defaults.nimble_lib}
|
||||||
lib_deps =
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
${esp32_defaults.lib_deps}
|
-D USE_BLE=1
|
||||||
${esp32_defaults.nimble_lib}
|
-D DEFAULT_OT_IN_GPIO=16
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=4
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=15
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=26
|
||||||
build_flags =
|
-D DEFAULT_STATUS_LED_GPIO=2
|
||||||
${esp32_defaults.build_flags}
|
-D DEFAULT_OT_RX_LED_GPIO=19
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=16
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=4
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=15
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=26
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=2
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=19
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:nodemcu_32_160mhz]
|
[env:nodemcu_32_160mhz]
|
||||||
extends = env:nodemcu_32
|
extends = env:nodemcu_32
|
||||||
board_build.f_cpu = 160000000L ; set frequency to 160MHz
|
board_build.f_cpu = 160000000L ; set frequency to 160MHz
|
||||||
|
|
||||||
[env:d1_mini32]
|
[env:d1_mini32]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = wemos_d1_mini32
|
||||||
board = wemos_d1_mini32
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
${esp32_defaults.nimble_lib}
|
||||||
lib_deps =
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
${esp32_defaults.lib_deps}
|
-D USE_BLE=1
|
||||||
${esp32_defaults.nimble_lib}
|
-D DEFAULT_OT_IN_GPIO=21
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D DEFAULT_OT_OUT_GPIO=22
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=18
|
||||||
build_flags =
|
-D DEFAULT_STATUS_LED_GPIO=2
|
||||||
${esp32_defaults.build_flags}
|
-D DEFAULT_OT_RX_LED_GPIO=19
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=21
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=22
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=12
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=18
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=2
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=19
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:esp32_c6]
|
[env:esp32_c6]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
framework = arduino, espidf
|
board = esp32-c6-devkitc-1
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board = esp32-c6-devkitm-1
|
${esp32_defaults.nimble_lib}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
build_unflags = -mtext-section-literals
|
||||||
board_build.embed_txtfiles =
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
managed_components/espressif__esp_insights/server_certs/https_server.crt
|
-D USE_BLE=1
|
||||||
managed_components/espressif__esp_rainmaker/server_certs/rmaker_mqtt_server.crt
|
-D DEFAULT_OT_IN_GPIO=15
|
||||||
managed_components/espressif__esp_rainmaker/server_certs/rmaker_claim_service_server.crt
|
-D DEFAULT_OT_OUT_GPIO=23
|
||||||
managed_components/espressif__esp_rainmaker/server_certs/rmaker_ota_server.crt
|
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
||||||
lib_deps = ${esp32_defaults.lib_deps}
|
-D DEFAULT_SENSOR_INDOOR_GPIO=0
|
||||||
lib_ignore =
|
-D DEFAULT_STATUS_LED_GPIO=11
|
||||||
${esp32_defaults.lib_ignore}
|
-D DEFAULT_OT_RX_LED_GPIO=10
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
|
||||||
build_unflags =
|
|
||||||
-mtext-section-literals
|
|
||||||
build_type = ${esp32_defaults.build_type}
|
|
||||||
build_flags =
|
|
||||||
${esp32_defaults.build_flags}
|
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=15
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=23
|
|
||||||
-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
|
||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=0
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=11
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=10
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|
||||||
[env:otthing]
|
[env:otthing]
|
||||||
platform = ${esp32_defaults.platform}
|
extends = esp32_defaults
|
||||||
platform_packages = ${esp32_defaults.platform_packages}
|
board = lolin_c3_mini
|
||||||
board = lolin_c3_mini
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
board_build.partitions = ${esp32_defaults.board_build.partitions}
|
${esp32_defaults.nimble_lib}
|
||||||
lib_deps =
|
build_unflags = -mtext-section-literals
|
||||||
${esp32_defaults.lib_deps}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
${esp32_defaults.nimble_lib}
|
-D USE_BLE=1
|
||||||
lib_ignore = ${esp32_defaults.lib_ignore}
|
-D DEFAULT_OT_IN_GPIO=3
|
||||||
extra_scripts = ${esp32_defaults.extra_scripts}
|
-D DEFAULT_OT_OUT_GPIO=1
|
||||||
build_unflags =
|
;-D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
||||||
-mtext-section-literals
|
;-D DEFAULT_SENSOR_INDOOR_GPIO=1
|
||||||
build_type = ${esp32_defaults.build_type}
|
-D DEFAULT_STATUS_LED_GPIO=8
|
||||||
build_flags =
|
-D DEFAULT_OT_RX_LED_GPIO=2
|
||||||
${esp32_defaults.build_flags}
|
-D OT_BYPASS_RELAY_GPIO=20
|
||||||
-D CONFIG_BT_NIMBLE_EXT_ADV=1
|
|
||||||
-D USE_BLE=1
|
|
||||||
-D DEFAULT_OT_IN_GPIO=3
|
|
||||||
-D DEFAULT_OT_OUT_GPIO=1
|
|
||||||
; -D DEFAULT_SENSOR_OUTDOOR_GPIO=0
|
|
||||||
; -D DEFAULT_SENSOR_INDOOR_GPIO=1
|
|
||||||
-D DEFAULT_STATUS_LED_GPIO=8
|
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=2
|
|
||||||
-D OT_BYPASS_RELAY_GPIO=20
|
|
||||||
check_tool = ${esp32_defaults.check_tool}
|
|
||||||
check_flags = ${esp32_defaults.check_flags}
|
|
||||||
|
|||||||
165
src/HaHelper.h
165
src/HaHelper.h
@@ -261,8 +261,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// object id's
|
// object id's
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(
|
||||||
|
sSensor.type == Sensors::Type::MANUAL
|
||||||
|
? FPSTR(HA_ENTITY_NUMBER)
|
||||||
|
: FPSTR(HA_ENTITY_SENSOR),
|
||||||
|
objId.c_str()
|
||||||
|
);
|
||||||
|
|
||||||
const String& configTopic = this->makeConfigTopic(
|
const String& configTopic = this->makeConfigTopic(
|
||||||
sSensor.type == Sensors::Type::MANUAL ? FPSTR(HA_ENTITY_NUMBER) : FPSTR(HA_ENTITY_SENSOR),
|
sSensor.type == Sensors::Type::MANUAL ? FPSTR(HA_ENTITY_NUMBER) : FPSTR(HA_ENTITY_SENSOR),
|
||||||
@@ -323,8 +328,8 @@ public:
|
|||||||
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("connected"));
|
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("connected"));
|
||||||
|
|
||||||
// object id's
|
// object id's
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), objId.c_str());
|
||||||
|
|
||||||
// state topic
|
// state topic
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
||||||
@@ -370,8 +375,8 @@ public:
|
|||||||
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality"));
|
String objId = Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality"));
|
||||||
|
|
||||||
// object id's
|
// object id's
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(objId.c_str());
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(objId.c_str());
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), objId.c_str());
|
||||||
|
|
||||||
// state topic
|
// state topic
|
||||||
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
doc[FPSTR(HA_STATE_TOPIC)] = this->getDeviceTopic(
|
||||||
@@ -407,7 +412,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool deleteSignalQualityDynamicSensor(Sensors::Settings& sSensor) {
|
bool deleteSignalQualityDynamicSensor(Sensors::Settings& sSensor) {
|
||||||
JsonDocument doc;
|
|
||||||
const String& configTopic = this->makeConfigTopic(
|
const String& configTopic = this->makeConfigTopic(
|
||||||
FPSTR(HA_ENTITY_SENSOR),
|
FPSTR(HA_ENTITY_SENSOR),
|
||||||
Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality")).c_str()
|
Sensors::makeObjectIdWithSuffix(sSensor.name, F("signal_quality")).c_str()
|
||||||
@@ -421,8 +425,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating_turbo"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_turbo"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("heating_turbo"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Turbo heating");
|
doc[FPSTR(HA_NAME)] = F("Turbo heating");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:rocket-launch-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:rocket-launch-outline");
|
||||||
@@ -443,8 +447,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating_hysteresis"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_hysteresis"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_hysteresis"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -475,8 +479,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating_turbo_factor"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_turbo_factor"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_turbo_factor"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("power_factor");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("power_factor");
|
||||||
doc[FPSTR(HA_NAME)] = F("Heating turbo factor");
|
doc[FPSTR(HA_NAME)] = F("Heating turbo factor");
|
||||||
@@ -499,8 +503,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating_min_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_min_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_min_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -533,8 +537,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating_max_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating_max_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("heating_max_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -568,8 +572,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("dhw_min_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw_min_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("dhw_min_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -602,8 +606,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("dhw_max_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw_max_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("dhw_max_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -637,8 +641,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("pid"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("PID");
|
doc[FPSTR(HA_NAME)] = F("PID");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:chart-bar-stacked");
|
doc[FPSTR(HA_ICON)] = F("mdi:chart-bar-stacked");
|
||||||
@@ -659,8 +663,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_p"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_p"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_p"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("PID factor P");
|
doc[FPSTR(HA_NAME)] = F("PID factor P");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-p-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-p-circle-outline");
|
||||||
@@ -682,8 +686,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_i"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_i"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_i"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("PID factor I");
|
doc[FPSTR(HA_NAME)] = F("PID factor I");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-i-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-i-circle-outline");
|
||||||
@@ -705,8 +709,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_d"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_d"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_d"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("PID factor D");
|
doc[FPSTR(HA_NAME)] = F("PID factor D");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-d-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-d-circle-outline");
|
||||||
@@ -728,8 +732,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_dt"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_dt"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_dt"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
||||||
doc[FPSTR(HA_UNIT_OF_MEASUREMENT)] = F("s");
|
doc[FPSTR(HA_UNIT_OF_MEASUREMENT)] = F("s");
|
||||||
@@ -753,8 +757,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_min_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_min_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_min_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -787,8 +791,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("pid_max_temp"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("pid_max_temp"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("pid_max_temp"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_TEMPERATURE);
|
||||||
|
|
||||||
@@ -822,8 +826,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("equitherm"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SWITCH), F("equitherm"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm");
|
doc[FPSTR(HA_NAME)] = F("Equitherm");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:sun-snowflake-variant");
|
doc[FPSTR(HA_ICON)] = F("mdi:sun-snowflake-variant");
|
||||||
@@ -844,8 +848,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("equitherm_n"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_n"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_n"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm factor N");
|
doc[FPSTR(HA_NAME)] = F("Equitherm factor N");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-n-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-n-circle-outline");
|
||||||
@@ -867,8 +871,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("equitherm_k"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_k"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_k"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm factor K");
|
doc[FPSTR(HA_NAME)] = F("Equitherm factor K");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-k-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-k-circle-outline");
|
||||||
@@ -893,8 +897,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.pid.enabled, 'offline', 'online') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.pid.enabled, 'offline', 'online') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("equitherm_t"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("equitherm_t"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_NUMBER), F("equitherm_t"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_NAME)] = F("Equitherm factor T");
|
doc[FPSTR(HA_NAME)] = F("Equitherm factor T");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:alpha-t-circle-outline");
|
doc[FPSTR(HA_ICON)] = F("mdi:alpha-t-circle-outline");
|
||||||
@@ -916,8 +920,8 @@ public:
|
|||||||
bool publishStatusState(bool enabledByDefault = true) {
|
bool publishStatusState(bool enabledByDefault = true) {
|
||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("status"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("status"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("status"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Status");
|
doc[FPSTR(HA_NAME)] = F("Status");
|
||||||
@@ -934,8 +938,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("emergency"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("emergency"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("emergency"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Emergency");
|
doc[FPSTR(HA_NAME)] = F("Emergency");
|
||||||
@@ -952,8 +956,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("ot_status"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("ot_status"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("ot_status"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("connectivity");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("connectivity");
|
||||||
doc[FPSTR(HA_NAME)] = F("Opentherm status");
|
doc[FPSTR(HA_NAME)] = F("Opentherm status");
|
||||||
@@ -973,9 +977,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("heating"));
|
||||||
//doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("Heating");
|
doc[FPSTR(HA_NAME)] = F("Heating");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
||||||
@@ -994,9 +997,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("dhw"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("dhw"));
|
||||||
//doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("DHW");
|
doc[FPSTR(HA_NAME)] = F("DHW");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
||||||
@@ -1015,9 +1017,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("flame"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("flame"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("flame"));
|
||||||
//doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("Flame");
|
doc[FPSTR(HA_NAME)] = F("Flame");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:gas-burner");
|
doc[FPSTR(HA_ICON)] = F("mdi:gas-burner");
|
||||||
@@ -1036,8 +1037,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("fault"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("fault"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("fault"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Fault");
|
doc[FPSTR(HA_NAME)] = F("Fault");
|
||||||
@@ -1057,8 +1058,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_OT_CONN, true);
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("problem");
|
||||||
doc[FPSTR(HA_NAME)] = F("Diagnostic");
|
doc[FPSTR(HA_NAME)] = F("Diagnostic");
|
||||||
@@ -1075,8 +1076,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("ext_pump"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("ext_pump"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BINARY_SENSOR), F("ext_pump"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("running");
|
||||||
doc[FPSTR(HA_NAME)] = F("External pump");
|
doc[FPSTR(HA_NAME)] = F("External pump");
|
||||||
@@ -1096,8 +1097,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active, 'online', 'offline') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("fault_code"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("fault_code"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("fault_code"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_NAME)] = F("Fault code");
|
doc[FPSTR(HA_NAME)] = F("Fault code");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:cog-box");
|
doc[FPSTR(HA_ICON)] = F("mdi:cog-box");
|
||||||
@@ -1116,8 +1117,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active or value_json.slave.diag.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.connected and value_json.slave.fault.active or value_json.slave.diag.active, 'online', 'offline') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("diagnostic_code"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("diagnostic_code"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("diagnostic_code"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_NAME)] = F("Diagnostic code");
|
doc[FPSTR(HA_NAME)] = F("Diagnostic code");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:information-box");
|
doc[FPSTR(HA_ICON)] = F("mdi:information-box");
|
||||||
@@ -1133,8 +1134,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(FPSTR(S_RSSI));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(FPSTR(S_RSSI));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), FPSTR(S_RSSI));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("signal_strength");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("signal_strength");
|
||||||
doc[FPSTR(HA_STATE_CLASS)] = FPSTR(HA_STATE_CLASS_MEASUREMENT);
|
doc[FPSTR(HA_STATE_CLASS)] = FPSTR(HA_STATE_CLASS_MEASUREMENT);
|
||||||
@@ -1153,8 +1154,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("uptime"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("uptime"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_SENSOR), F("uptime"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_DIAGNOSTIC);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
doc[FPSTR(HA_DEVICE_CLASS)] = F("duration");
|
||||||
doc[FPSTR(HA_STATE_CLASS)] = F("total_increasing");
|
doc[FPSTR(HA_STATE_CLASS)] = F("total_increasing");
|
||||||
@@ -1174,8 +1175,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("heating"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("heating"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_CLIMATE), F("heating"));
|
||||||
doc[FPSTR(HA_NAME)] = F("Heating");
|
doc[FPSTR(HA_NAME)] = F("Heating");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
doc[FPSTR(HA_ICON)] = F("mdi:radiator");
|
||||||
|
|
||||||
@@ -1226,8 +1227,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("dhw"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("dhw"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_CLIMATE), F("dhw"));
|
||||||
doc[FPSTR(HA_NAME)] = F("DHW");
|
doc[FPSTR(HA_NAME)] = F("DHW");
|
||||||
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
doc[FPSTR(HA_ICON)] = F("mdi:faucet");
|
||||||
|
|
||||||
@@ -1271,8 +1272,8 @@ public:
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
doc[FPSTR(HA_AVAILABILITY)][FPSTR(HA_TOPIC)] = this->statusTopic.c_str();
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(FPSTR(S_RESTART));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(FPSTR(S_RESTART));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), FPSTR(S_RESTART));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||||
doc[FPSTR(HA_NAME)] = F("Restart");
|
doc[FPSTR(HA_NAME)] = F("Restart");
|
||||||
@@ -1291,8 +1292,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.fault.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.fault.active, 'online', 'offline') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("reset_fault"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("reset_fault"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), F("reset_fault"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||||
doc[FPSTR(HA_NAME)] = F("Reset fault");
|
doc[FPSTR(HA_NAME)] = F("Reset fault");
|
||||||
@@ -1311,8 +1312,8 @@ public:
|
|||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.diag.active, 'online', 'offline') }}");
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = F("{{ iif(value_json.slave.diag.active, 'online', 'offline') }}");
|
||||||
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
doc[FPSTR(HA_AVAILABILITY_MODE)] = F("all");
|
||||||
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
doc[FPSTR(HA_ENABLED_BY_DEFAULT)] = enabledByDefault;
|
||||||
doc[FPSTR(HA_UNIQUE_ID)] = this->getObjectIdWithPrefix(F("reset_diagnostic"));
|
doc[FPSTR(HA_UNIQUE_ID)] = this->getUniqueIdWithPrefix(F("reset_diagnostic"));
|
||||||
doc[FPSTR(HA_OBJECT_ID)] = doc[FPSTR(HA_UNIQUE_ID)];
|
doc[FPSTR(HA_DEFAULT_ENTITY_ID)] = this->getEntityIdWithPrefix(FPSTR(HA_ENTITY_BUTTON), F("reset_diagnostic"));
|
||||||
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
doc[FPSTR(HA_ENTITY_CATEGORY)] = FPSTR(HA_ENTITY_CATEGORY_CONFIG);
|
||||||
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
doc[FPSTR(HA_DEVICE_CLASS)] = FPSTR(S_RESTART);
|
||||||
doc[FPSTR(HA_NAME)] = F("Reset diagnostic");
|
doc[FPSTR(HA_NAME)] = F("Reset diagnostic");
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ protected:
|
|||||||
return "Main";
|
return "Main";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getTaskStackSize() override {
|
||||||
|
return 6000;
|
||||||
|
}
|
||||||
|
|
||||||
/*BaseType_t getTaskCore() override {
|
/*BaseType_t getTaskCore() override {
|
||||||
return 1;
|
return 1;
|
||||||
}*/
|
}*/
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ protected:
|
|||||||
const char* getTaskName() override {
|
const char* getTaskName() override {
|
||||||
return "OpenTherm";
|
return "OpenTherm";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getTaskStackSize() override {
|
||||||
|
return 7500;
|
||||||
|
}
|
||||||
|
|
||||||
BaseType_t getTaskCore() override {
|
BaseType_t getTaskCore() override {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ protected:
|
|||||||
const char* getTaskName() override {
|
const char* getTaskName() override {
|
||||||
return "Regulator";
|
return "Regulator";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getTaskStackSize() override {
|
||||||
|
return 5000;
|
||||||
|
}
|
||||||
|
|
||||||
/*BaseType_t getTaskCore() override {
|
/*BaseType_t getTaskCore() override {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public:
|
|||||||
|
|
||||||
static int16_t getIdByName(const char* name) {
|
static int16_t getIdByName(const char* name) {
|
||||||
if (settings == nullptr) {
|
if (settings == nullptr) {
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
for (uint8_t id = 0; id <= getMaxSensorId(); id++) {
|
||||||
@@ -163,7 +163,7 @@ public:
|
|||||||
|
|
||||||
static int16_t getIdByObjectId(const char* objectId) {
|
static int16_t getIdByObjectId(const char* objectId) {
|
||||||
if (settings == nullptr) {
|
if (settings == nullptr) {
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
String refObjectId;
|
String refObjectId;
|
||||||
|
|||||||
@@ -9,41 +9,136 @@
|
|||||||
extern FileData fsSensorsSettings;
|
extern FileData fsSensorsSettings;
|
||||||
|
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
class BluetoothClientCallbacks : public NimBLEClientCallbacks {
|
class BluetoothScanCallbacks : public NimBLEScanCallbacks {
|
||||||
public:
|
public:
|
||||||
BluetoothClientCallbacks(uint8_t sensorId) : sensorId(sensorId) {}
|
void onDiscovered(const NimBLEAdvertisedDevice* device) override {
|
||||||
|
auto& deviceAddress = device->getAddress();
|
||||||
|
|
||||||
void onConnect(NimBLEClient* pClient) {
|
bool found = false;
|
||||||
auto& sSensor = Sensors::settings[this->sensorId];
|
uint8_t sensorId;
|
||||||
|
for (sensorId = 0; sensorId <= Sensors::getMaxSensorId(); sensorId++) {
|
||||||
|
auto& sSensor = Sensors::settings[sensorId];
|
||||||
|
if (!sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Log.sinfoln(
|
const auto sensorAddress = NimBLEAddress(sSensor.address, deviceAddress.getType());
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': connected to %s"),
|
if (sensorAddress.isNull() || sensorAddress != deviceAddress) {
|
||||||
sensorId, sSensor.name, pClient->getPeerAddress().toString().c_str()
|
continue;
|
||||||
);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void onDisconnect(NimBLEClient* pClient, int reason) {
|
found = true;
|
||||||
auto& sSensor = Sensors::settings[this->sensorId];
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Log.sinfoln(
|
if (!found) {
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': disconnected, reason %i"),
|
return;
|
||||||
sensorId, sSensor.name, reason
|
}
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void onConnectFail(NimBLEClient* pClient, int reason) {
|
auto& sSensor = Sensors::settings[sensorId];
|
||||||
auto& sSensor = Sensors::settings[this->sensorId];
|
auto& rSensor = Sensors::results[sensorId];
|
||||||
|
auto deviceName = device->getName();
|
||||||
|
auto deviceRssi = device->getRSSI();
|
||||||
|
|
||||||
Log.sinfoln(
|
Log.straceln(
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to connect, reason %i"),
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': discovered device %s, name: %s, RSSI: %hhd"),
|
||||||
sensorId, sSensor.name, reason
|
sensorId, sSensor.name,
|
||||||
|
deviceAddress.toString().c_str(), deviceName.c_str(), deviceRssi
|
||||||
);
|
);
|
||||||
|
|
||||||
pClient->cancelConnect();
|
if (!device->haveServiceData()) {
|
||||||
}
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found service data"),
|
||||||
|
sensorId, sSensor.name
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
auto serviceDataCount = device->getServiceDataCount();
|
||||||
uint8_t sensorId;
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found %hhu service data"),
|
||||||
|
sensorId, sSensor.name, serviceDataCount
|
||||||
|
);
|
||||||
|
|
||||||
|
NimBLEUUID serviceUuid((uint16_t) 0x181A);
|
||||||
|
auto serviceData = device->getServiceData(serviceUuid);
|
||||||
|
if (!serviceData.size()) {
|
||||||
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': NOT found %s env service data"),
|
||||||
|
sensorId, sSensor.name, serviceUuid.toString().c_str()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found %s env service data"),
|
||||||
|
sensorId, sSensor.name, serviceUuid.toString().c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
float temperature, humidity;
|
||||||
|
uint16_t batteryMv;
|
||||||
|
uint8_t batteryLevel;
|
||||||
|
|
||||||
|
if (serviceData.size() == 13) {
|
||||||
|
// atc1441 format
|
||||||
|
|
||||||
|
// Temperature (2 bytes, big-endian)
|
||||||
|
temperature = (
|
||||||
|
(static_cast<uint8_t>(serviceData[6]) << 8) | static_cast<uint8_t>(serviceData[7])
|
||||||
|
) * 0.1f;
|
||||||
|
|
||||||
|
// Humidity (1 byte)
|
||||||
|
humidity = static_cast<uint8_t>(serviceData[8]);
|
||||||
|
|
||||||
|
// Battery mV (2 bytes, big-endian)
|
||||||
|
batteryMv = (static_cast<uint8_t>(serviceData[10]) << 8) | static_cast<uint8_t>(serviceData[11]);
|
||||||
|
|
||||||
|
// Battery level (1 byte)
|
||||||
|
batteryLevel = static_cast<uint8_t>(serviceData[9]);
|
||||||
|
|
||||||
|
} else if (serviceData.size() == 15) {
|
||||||
|
// custom pvvx format
|
||||||
|
|
||||||
|
// Temperature (2 bytes, little-endian)
|
||||||
|
temperature = (
|
||||||
|
(static_cast<uint8_t>(serviceData[7]) << 8) | static_cast<uint8_t>(serviceData[6])
|
||||||
|
) * 0.01f;
|
||||||
|
|
||||||
|
// Humidity (2 bytes, little-endian)
|
||||||
|
humidity = (
|
||||||
|
(static_cast<uint8_t>(serviceData[9]) << 8) | static_cast<uint8_t>(serviceData[8])
|
||||||
|
) * 0.01f;
|
||||||
|
|
||||||
|
// Battery mV (2 bytes, little-endian)
|
||||||
|
batteryMv = (static_cast<uint8_t>(serviceData[11]) << 8) | static_cast<uint8_t>(serviceData[10]);
|
||||||
|
|
||||||
|
// Battery level (1 byte)
|
||||||
|
batteryLevel = static_cast<uint8_t>(serviceData[12]);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// unknown format
|
||||||
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': unknown data format (size: %i)"),
|
||||||
|
sensorId, sSensor.name, serviceData.size()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.straceln(
|
||||||
|
FPSTR(L_SENSORS_BLE),
|
||||||
|
F("Sensor #%hhu '%s', received temp: %.2f; humidity: %.2f, battery voltage: %hu, battery level: %hhu"),
|
||||||
|
sensorId, sSensor.name,
|
||||||
|
temperature, humidity, batteryMv, batteryLevel
|
||||||
|
);
|
||||||
|
|
||||||
|
// update data
|
||||||
|
Sensors::setValueById(sensorId, temperature, Sensors::ValueType::TEMPERATURE, true, true);
|
||||||
|
Sensors::setValueById(sensorId, humidity, Sensors::ValueType::HUMIDITY, true, true);
|
||||||
|
Sensors::setValueById(sensorId, batteryLevel, Sensors::ValueType::BATTERY, true, true);
|
||||||
|
|
||||||
|
// update rssi
|
||||||
|
Sensors::setValueById(sensorId, deviceRssi, Sensors::ValueType::RSSI, false, false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -55,6 +150,10 @@ public:
|
|||||||
this->dallasSearchTime.reserve(2);
|
this->dallasSearchTime.reserve(2);
|
||||||
this->dallasPolling.reserve(2);
|
this->dallasPolling.reserve(2);
|
||||||
this->dallasLastPollingTime.reserve(2);
|
this->dallasLastPollingTime.reserve(2);
|
||||||
|
|
||||||
|
#if USE_BLE
|
||||||
|
this->pBLEScanCallbacks = new BluetoothScanCallbacks();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~SensorsTask() {
|
~SensorsTask() {
|
||||||
@@ -63,16 +162,17 @@ public:
|
|||||||
this->dallasSearchTime.clear();
|
this->dallasSearchTime.clear();
|
||||||
this->dallasPolling.clear();
|
this->dallasPolling.clear();
|
||||||
this->dallasLastPollingTime.clear();
|
this->dallasLastPollingTime.clear();
|
||||||
|
|
||||||
|
#if USE_BLE
|
||||||
|
delete this->pBLEScanCallbacks;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const unsigned int disconnectedTimeout = 120000;
|
const unsigned int disconnectedTimeout = 180000u;
|
||||||
const unsigned short dallasSearchInterval = 60000;
|
const unsigned short dallasSearchInterval = 60000u;
|
||||||
const unsigned short dallasPollingInterval = 10000;
|
const unsigned short dallasPollingInterval = 10000u;
|
||||||
const unsigned short globalPollingInterval = 15000;
|
const unsigned short globalPollingInterval = 15000u;
|
||||||
#if USE_BLE
|
|
||||||
const unsigned int bleSetDtInterval = 7200000;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::unordered_map<uint8_t, OneWire> owInstances;
|
std::unordered_map<uint8_t, OneWire> owInstances;
|
||||||
std::unordered_map<uint8_t, DallasTemperature> dallasInstances;
|
std::unordered_map<uint8_t, DallasTemperature> dallasInstances;
|
||||||
@@ -80,9 +180,9 @@ protected:
|
|||||||
std::unordered_map<uint8_t, bool> dallasPolling;
|
std::unordered_map<uint8_t, bool> dallasPolling;
|
||||||
std::unordered_map<uint8_t, unsigned long> dallasLastPollingTime;
|
std::unordered_map<uint8_t, unsigned long> dallasLastPollingTime;
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
std::unordered_map<uint8_t, NimBLEClient*> bleClients;
|
NimBLEScan* pBLEScan = nullptr;
|
||||||
std::unordered_map<uint8_t, bool> bleSubscribed;
|
BluetoothScanCallbacks* pBLEScanCallbacks = nullptr;
|
||||||
std::unordered_map<uint8_t, unsigned long> bleLastSetDtTime;
|
bool activeScanBle = false;
|
||||||
#endif
|
#endif
|
||||||
unsigned long globalLastPollingTime = 0;
|
unsigned long globalLastPollingTime = 0;
|
||||||
|
|
||||||
@@ -91,6 +191,10 @@ protected:
|
|||||||
return "Sensors";
|
return "Sensors";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t getTaskStackSize() override {
|
||||||
|
return 7500;
|
||||||
|
}
|
||||||
|
|
||||||
BaseType_t getTaskCore() override {
|
BaseType_t getTaskCore() override {
|
||||||
// https://github.com/h2zero/NimBLE-Arduino/issues/676
|
// https://github.com/h2zero/NimBLE-Arduino/issues/676
|
||||||
#if USE_BLE && defined(CONFIG_BT_NIMBLE_PINNED_TO_CORE)
|
#if USE_BLE && defined(CONFIG_BT_NIMBLE_PINNED_TO_CORE)
|
||||||
@@ -131,8 +235,7 @@ protected:
|
|||||||
this->yield();
|
this->yield();
|
||||||
|
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
cleanBleInstances();
|
scanBleSensors();
|
||||||
pollingBleSensors();
|
|
||||||
this->yield();
|
this->yield();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -444,549 +547,71 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
void cleanBleInstances() {
|
void scanBleSensors() {
|
||||||
if (!NimBLEDevice::isInitialized()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto& [sensorId, pClient]: this->bleClients) {
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
const auto sAddress = NimBLEAddress(sSensor.address, 0);
|
|
||||||
|
|
||||||
if (sAddress.isNull() || !sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', deleted unused client"),
|
|
||||||
sensorId, sSensor.name
|
|
||||||
);
|
|
||||||
|
|
||||||
NimBLEDevice::deleteClient(pClient);
|
|
||||||
pClient = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void pollingBleSensors() {
|
|
||||||
if (!Sensors::getAmountByType(Sensors::Type::BLUETOOTH, true)) {
|
if (!Sensors::getAmountByType(Sensors::Type::BLUETOOTH, true)) {
|
||||||
|
if (NimBLEDevice::isInitialized()) {
|
||||||
|
if (this->pBLEScan != nullptr) {
|
||||||
|
if (this->pBLEScan->isScanning()) {
|
||||||
|
this->pBLEScan->stop();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this->pBLEScan = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->pBLEScan == nullptr) {
|
||||||
|
if (NimBLEDevice::deinit(true)) {
|
||||||
|
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Deinitialized"));
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.swarningln(FPSTR(L_SENSORS_BLE), F("Unable to deinitialize!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NimBLEDevice::isInitialized() && millis() > 5000) {
|
if (!NimBLEDevice::isInitialized() && millis() > 5000) {
|
||||||
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized"));
|
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Initialized"));
|
||||||
BLEDevice::init("");
|
NimBLEDevice::init("");
|
||||||
NimBLEDevice::setPower(9);
|
|
||||||
|
#ifdef ESP_PWR_LVL_P20
|
||||||
|
NimBLEDevice::setPower(ESP_PWR_LVL_P20);
|
||||||
|
#elifdef ESP_PWR_LVL_P9
|
||||||
|
NimBLEDevice::setPower(ESP_PWR_LVL_P9);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t sensorId = 0; sensorId <= Sensors::getMaxSensorId(); sensorId++) {
|
if (this->pBLEScan == nullptr) {
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
this->pBLEScan = NimBLEDevice::getScan();
|
||||||
auto& rSensor = Sensors::results[sensorId];
|
this->pBLEScan->setScanCallbacks(this->pBLEScanCallbacks);
|
||||||
|
#if MYNEWT_VAL(BLE_EXT_ADV)
|
||||||
if (!sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
this->pBLEScan->setPhy(NimBLEScan::Phy::SCAN_ALL);
|
||||||
continue;
|
#endif
|
||||||
}
|
this->pBLEScan->setDuplicateFilter(false);
|
||||||
|
this->pBLEScan->setMaxResults(0);
|
||||||
|
this->pBLEScan->setInterval(10000);
|
||||||
|
this->pBLEScan->setWindow(10000);
|
||||||
|
|
||||||
const auto address = NimBLEAddress(sSensor.address, 0);
|
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Scanning initialized"));
|
||||||
if (address.isNull()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto pClient = this->getBleClient(sensorId);
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pClient->getPeerAddress() != address) {
|
|
||||||
if (pClient->isConnected()) {
|
|
||||||
if (!pClient->disconnect()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pClient->setPeerAddress(address);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pClient->isConnected()) {
|
|
||||||
this->bleSubscribed[sensorId] = false;
|
|
||||||
this->bleLastSetDtTime[sensorId] = 0;
|
|
||||||
|
|
||||||
if (pClient->connect(false, true, true)) {
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': trying connecting to %s..."),
|
|
||||||
sensorId, sSensor.name, pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this->bleSubscribed[sensorId]) {
|
|
||||||
if (this->subscribeToBleDevice(sensorId, pClient)) {
|
|
||||||
this->bleSubscribed[sensorId] = true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
this->bleSubscribed[sensorId] = false;
|
|
||||||
pClient->disconnect();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark connected
|
|
||||||
Sensors::setConnectionStatusById(sensorId, true, true);
|
|
||||||
|
|
||||||
if (!this->bleLastSetDtTime[sensorId] || millis() - this->bleLastSetDtTime[sensorId] > this->bleSetDtInterval) {
|
|
||||||
struct tm ti;
|
|
||||||
|
|
||||||
if (getLocalTime(&ti)) {
|
|
||||||
if (this->setDateOnBleSensor(pClient, &ti)) {
|
|
||||||
Log.sinfoln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', successfully set date: %02d.%02d.%04d %02d:%02d:%02d"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
ti.tm_mday, ti.tm_mon + 1, ti.tm_year + 1900, ti.tm_hour, ti.tm_min, ti.tm_sec
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s', failed set date: %02d.%02d.%04d %02d:%02d:%02d"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
ti.tm_mday, ti.tm_mon + 1, ti.tm_year + 1900, ti.tm_hour, ti.tm_min, ti.tm_sec
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
this->bleLastSetDtTime[sensorId] = millis();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NimBLEClient* getBleClient(const uint8_t sensorId) {
|
|
||||||
if (!NimBLEDevice::isInitialized()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
if (!this->pBLEScan->isScanning()) {
|
||||||
auto& rSensor = Sensors::results[sensorId];
|
this->activeScanBle = !this->activeScanBle;
|
||||||
|
this->pBLEScan->setActiveScan(this->activeScanBle);
|
||||||
|
|
||||||
if (!sSensor.enabled || sSensor.type != Sensors::Type::BLUETOOTH || sSensor.purpose == Sensors::Purpose::NOT_CONFIGURED) {
|
if (this->pBLEScan->start(30000, false, false)) {
|
||||||
return nullptr;
|
Log.sinfoln(
|
||||||
}
|
FPSTR(L_SENSORS_BLE),
|
||||||
|
F("%s scanning started"),
|
||||||
if (this->bleClients[sensorId] && this->bleClients[sensorId] != nullptr) {
|
this->activeScanBle ? "Active" : "Passive"
|
||||||
return this->bleClients[sensorId];
|
|
||||||
}
|
|
||||||
|
|
||||||
auto pClient = NimBLEDevice::createClient();
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
//pClient->setConnectionParams(BLE_GAP_CONN_ITVL_MS(10), BLE_GAP_CONN_ITVL_MS(100), 10, 150);
|
|
||||||
pClient->setConnectTimeout(30000);
|
|
||||||
pClient->setSelfDelete(false, false);
|
|
||||||
pClient->setClientCallbacks(new BluetoothClientCallbacks(sensorId), true);
|
|
||||||
|
|
||||||
this->bleClients[sensorId] = pClient;
|
|
||||||
|
|
||||||
return pClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool subscribeToBleDevice(const uint8_t sensorId, NimBLEClient* pClient) {
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
auto pAddress = pClient->getPeerAddress().toString();
|
|
||||||
|
|
||||||
NimBLERemoteService* pService = nullptr;
|
|
||||||
NimBLERemoteCharacteristic* pChar = nullptr;
|
|
||||||
|
|
||||||
// ENV Service (0x181A)
|
|
||||||
NimBLEUUID serviceUuid((uint16_t) 0x181AU);
|
|
||||||
pService = pClient->getService(serviceUuid);
|
|
||||||
if (!pService) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find env service (%s) on device %s"),
|
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found env service (%s) on device %s"),
|
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
// 0x2A6E - Notify temperature x0.01C (pvvx)
|
|
||||||
bool tempNotifyCreated = false;
|
|
||||||
if (!tempNotifyCreated) {
|
|
||||||
NimBLEUUID charUuid((uint16_t) 0x2A6E);
|
|
||||||
pChar = pService->getCharacteristic(charUuid);
|
|
||||||
|
|
||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
pChar->unsubscribe();
|
|
||||||
tempNotifyCreated = pChar->subscribe(
|
|
||||||
pChar->canNotify(),
|
|
||||||
[sensorId](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
|
|
||||||
if (pChar == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NimBLERemoteService* pService = pChar->getRemoteService();
|
|
||||||
if (pService == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NimBLEClient* pClient = pService->getClient();
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
|
|
||||||
if (length != 2) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': invalid notification data at temp char (%s) on device %s"),
|
|
||||||
sensorId,
|
|
||||||
sSensor.name,
|
|
||||||
pChar->getUUID().toString().c_str(),
|
|
||||||
pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float rawTemp = (pChar->getValue<int16_t>() * 0.01f);
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': received temp: %.2f"),
|
|
||||||
sensorId, sSensor.name, rawTemp
|
|
||||||
);
|
|
||||||
|
|
||||||
// set temp
|
|
||||||
Sensors::setValueById(sensorId, rawTemp, Sensors::ValueType::TEMPERATURE, true, true);
|
|
||||||
|
|
||||||
// update rssi
|
|
||||||
Sensors::setValueById(sensorId, pClient->getRssi(), Sensors::ValueType::RSSI, false, false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (tempNotifyCreated) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 0x2A1F - Notify temperature x0.1C (atc1441/pvvx)
|
|
||||||
if (!tempNotifyCreated) {
|
|
||||||
NimBLEUUID charUuid((uint16_t) 0x2A1F);
|
|
||||||
pChar = pService->getCharacteristic(charUuid);
|
|
||||||
|
|
||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
pChar->unsubscribe();
|
|
||||||
tempNotifyCreated = pChar->subscribe(
|
|
||||||
pChar->canNotify(),
|
|
||||||
[sensorId](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
|
|
||||||
if (pChar == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NimBLERemoteService* pService = pChar->getRemoteService();
|
|
||||||
if (pService == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NimBLEClient* pClient = pService->getClient();
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
|
|
||||||
if (length != 2) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': invalid notification data at temp char (%s) on device %s"),
|
|
||||||
sensorId,
|
|
||||||
sSensor.name,
|
|
||||||
pChar->getUUID().toString().c_str(),
|
|
||||||
pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float rawTemp = (pChar->getValue<int16_t>() * 0.1f);
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': received temp: %.2f"),
|
|
||||||
sensorId, sSensor.name, rawTemp
|
|
||||||
);
|
|
||||||
|
|
||||||
// set temp
|
|
||||||
Sensors::setValueById(sensorId, rawTemp, Sensors::ValueType::TEMPERATURE, true, true);
|
|
||||||
|
|
||||||
// update rssi
|
|
||||||
Sensors::setValueById(sensorId, pClient->getRssi(), Sensors::ValueType::RSSI, false, false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (tempNotifyCreated) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to temp char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tempNotifyCreated) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported temp chars in env service on device %s"),
|
|
||||||
sensorId, sSensor.name, pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
pClient->disconnect();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 0x2A6F - Notify about humidity x0.01% (pvvx)
|
|
||||||
{
|
|
||||||
bool humidityNotifyCreated = false;
|
|
||||||
if (!humidityNotifyCreated) {
|
|
||||||
NimBLEUUID charUuid((uint16_t) 0x2A6F);
|
|
||||||
pChar = pService->getCharacteristic(charUuid);
|
|
||||||
|
|
||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found humidity char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
pChar->unsubscribe();
|
|
||||||
humidityNotifyCreated = pChar->subscribe(
|
|
||||||
pChar->canNotify(),
|
|
||||||
[sensorId](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
|
|
||||||
if (pChar == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NimBLERemoteService* pService = pChar->getRemoteService();
|
|
||||||
if (pService == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NimBLEClient* pClient = pService->getClient();
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
|
|
||||||
if (length != 2) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': invalid notification data at humidity char (%s) on device %s"),
|
|
||||||
sensorId,
|
|
||||||
sSensor.name,
|
|
||||||
pChar->getUUID().toString().c_str(),
|
|
||||||
pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
float rawHumidity = (pChar->getValue<uint16_t>() * 0.01f);
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': received humidity: %.2f"),
|
|
||||||
sensorId, sSensor.name, rawHumidity
|
|
||||||
);
|
|
||||||
|
|
||||||
// set humidity
|
|
||||||
Sensors::setValueById(sensorId, rawHumidity, Sensors::ValueType::HUMIDITY, true, true);
|
|
||||||
|
|
||||||
// update rssi
|
|
||||||
Sensors::setValueById(sensorId, pClient->getRssi(), Sensors::ValueType::RSSI, false, false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (humidityNotifyCreated) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to humidity char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to humidity char (%s) in env service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!humidityNotifyCreated) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported humidity chars in env service on device %s"),
|
|
||||||
sensorId, sSensor.name, pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Battery Service (0x180F)
|
|
||||||
{
|
|
||||||
NimBLEUUID serviceUuid((uint16_t) 0x180F);
|
|
||||||
pService = pClient->getService(serviceUuid);
|
|
||||||
if (!pService) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to find battery service (%s) on device %s"),
|
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.straceln(
|
Log.sinfoln(FPSTR(L_SENSORS_BLE), F("Unable to start scanning"));
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery service (%s) on device %s"),
|
|
||||||
sensorId, sSensor.name, serviceUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
// 0x2A19 - Notify the battery charge level 0..99% (pvvx)
|
|
||||||
bool batteryNotifyCreated = false;
|
|
||||||
if (!batteryNotifyCreated) {
|
|
||||||
NimBLEUUID charUuid((uint16_t) 0x2A19);
|
|
||||||
pChar = pService->getCharacteristic(charUuid);
|
|
||||||
|
|
||||||
if (pChar && (pChar->canNotify() || pChar->canIndicate())) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': found battery char (%s) in battery service on device %s"),
|
|
||||||
sensorId, sSensor.name, charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
pChar->unsubscribe();
|
|
||||||
batteryNotifyCreated = pChar->subscribe(
|
|
||||||
pChar->canNotify(),
|
|
||||||
[sensorId](NimBLERemoteCharacteristic* pChar, uint8_t* pData, size_t length, bool isNotify) {
|
|
||||||
if (pChar == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const NimBLERemoteService* pService = pChar->getRemoteService();
|
|
||||||
if (pService == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NimBLEClient* pClient = pService->getClient();
|
|
||||||
if (pClient == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto& sSensor = Sensors::settings[sensorId];
|
|
||||||
|
|
||||||
if (length != 1) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': invalid notification data at battery char (%s) on device %s"),
|
|
||||||
sensorId,
|
|
||||||
sSensor.name,
|
|
||||||
pChar->getUUID().toString().c_str(),
|
|
||||||
pClient->getPeerAddress().toString().c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto rawBattery = pChar->getValue<uint8_t>();
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE),
|
|
||||||
F("Sensor #%hhu '%s': received battery: %hhu"),
|
|
||||||
sensorId, sSensor.name, rawBattery
|
|
||||||
);
|
|
||||||
|
|
||||||
// set battery
|
|
||||||
Sensors::setValueById(sensorId, rawBattery, Sensors::ValueType::BATTERY, true, true);
|
|
||||||
|
|
||||||
// update rssi
|
|
||||||
Sensors::setValueById(sensorId, pClient->getRssi(), Sensors::ValueType::RSSI, false, false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
if (batteryNotifyCreated) {
|
|
||||||
Log.straceln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': subscribed to battery char (%s) in battery service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': failed to subscribe to battery char (%s) in battery service on device %s"),
|
|
||||||
sensorId, sSensor.name,
|
|
||||||
charUuid.toString().c_str(), pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!batteryNotifyCreated) {
|
|
||||||
Log.swarningln(
|
|
||||||
FPSTR(L_SENSORS_BLE), F("Sensor #%hhu '%s': not found supported battery chars in battery service on device %s"),
|
|
||||||
sensorId, sSensor.name, pAddress.c_str()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setDateOnBleSensor(NimBLEClient* pClient, const struct tm *ptm) {
|
|
||||||
auto ts = mkgmtime(ptm);
|
|
||||||
|
|
||||||
uint8_t data[5] = {};
|
|
||||||
data[0] = 0x23;
|
|
||||||
data[1] = ts & 0xff;
|
|
||||||
data[2] = (ts >> 8) & 0xff;
|
|
||||||
data[3] = (ts >> 16) & 0xff;
|
|
||||||
data[4] = (ts >> 24) & 0xff;
|
|
||||||
|
|
||||||
return pClient->setValue(
|
|
||||||
NimBLEUUID((uint16_t) 0x1f10),
|
|
||||||
NimBLEUUID((uint16_t) 0x1f1f),
|
|
||||||
NimBLEAttValue(data, sizeof(data))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
<label>
|
<label>
|
||||||
<span data-i18n>upgrade.fw</span>:
|
<span data-i18n>upgrade.fw</span>:
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<input type="file" name="fw[file]" accept=".bin">
|
<input type="file" name="fw" accept=".bin">
|
||||||
<button type="button" class="fwResult hidden" disabled></button>
|
<button type="button" class="fwResult hidden" disabled></button>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
<label>
|
<label>
|
||||||
<span data-i18n>upgrade.fs</span>:
|
<span data-i18n>upgrade.fs</span>:
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<input type="file" name="fs[file]" accept=".bin">
|
<input type="file" name="fs" accept=".bin">
|
||||||
<button type="button" class="fsResult hidden" disabled></button>
|
<button type="button" class="fsResult hidden" disabled></button>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
@@ -149,18 +149,16 @@
|
|||||||
try {
|
try {
|
||||||
let fd = new FormData();
|
let fd = new FormData();
|
||||||
|
|
||||||
const fw = upgradeForm.querySelector("[name='fw[file]']").files;
|
const fw = upgradeForm.querySelector("[name='fw']").files;
|
||||||
if (fw.length > 0) {
|
if (fw.length > 0) {
|
||||||
fd.append("fw[name]", fw[0].name);
|
fd.append("fw_size", fw[0].size);
|
||||||
fd.append("fw[size]", fw[0].size);
|
fd.append("fw", fw[0]);
|
||||||
fd.append("fw[file]", fw[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const fs = upgradeForm.querySelector("[name='fs[file]']").files;
|
const fs = upgradeForm.querySelector("[name='fs']").files;
|
||||||
if (fs.length > 0) {
|
if (fs.length > 0) {
|
||||||
fd.append("fs[name]", fs[0].name);
|
fd.append("fs_size", fs[0].size);
|
||||||
fd.append("fs[size]", fs[0].size);
|
fd.append("fs", fs[0]);
|
||||||
fd.append("fs[file]", fs[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let response = await fetch(upgradeForm.action, {
|
let response = await fetch(upgradeForm.action, {
|
||||||
|
|||||||
Reference in New Issue
Block a user