mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
fix: mqtt subscriptions, web devcelist, roomcontrol replys after switchoff
This commit is contained in:
@@ -155,7 +155,7 @@ function EMSESPSettingsControllerForm(props: EMSESPSettingsControllerFormProps)
|
|||||||
/>
|
/>
|
||||||
<TextValidator
|
<TextValidator
|
||||||
validators={['required', 'isNumber', 'minNumber:0', 'maxNumber:65535']}
|
validators={['required', 'isNumber', 'minNumber:0', 'maxNumber:65535']}
|
||||||
errorMessages={['Keep alive is required', "Must be a number", "Must be 0 or higher (0=off)", "Max value is 65535"]}
|
errorMessages={['Syslog Mark is required', "Must be a number", "Must be 0 or higher (0=off)", "Max value is 65535"]}
|
||||||
name="syslog_mark_interval"
|
name="syslog_mark_interval"
|
||||||
label="Syslog Mark Interval (seconds, 0=off)"
|
label="Syslog Mark Interval (seconds, 0=off)"
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|||||||
@@ -27,10 +27,9 @@ void EMSESPDevicesService::emsespDevicesService(AsyncWebServerRequest * request)
|
|||||||
deviceRoot["productid"] = emsdevice->product_id();
|
deviceRoot["productid"] = emsdevice->product_id();
|
||||||
deviceRoot["version"] = emsdevice->version();
|
deviceRoot["version"] = emsdevice->version();
|
||||||
}
|
}
|
||||||
|
|
||||||
response->setLength();
|
|
||||||
request->send(response);
|
|
||||||
}
|
}
|
||||||
|
response->setLength();
|
||||||
|
request->send(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
@@ -256,6 +256,9 @@ void Mqtt::start(AsyncMqttClient * mqttClient) {
|
|||||||
|
|
||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
mqttClient_->setWill(make_topic(will_topic_, "status"), 1, true, "offline"); // with qos 1, retain true
|
mqttClient_->setWill(make_topic(will_topic_, "status"), 1, true, "offline"); // with qos 1, retain true
|
||||||
|
mqttClient_->onMessage([this](char * topic, char * payload, AsyncMqttClientMessageProperties properties, size_t len, size_t index, size_t total) {
|
||||||
|
on_message(topic, payload, len);
|
||||||
|
});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,18 +65,17 @@ void Roomctrl::check(const uint8_t addr, const uint8_t * data) {
|
|||||||
if (hc_ > 3) {
|
if (hc_ > 3) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// no reply if the temperature is not set
|
|
||||||
if (remotetemp[hc_] == EMS_VALUE_SHORT_NOTSET) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// reply to writes with write nack byte
|
// reply to writes with write nack byte
|
||||||
if (addr & 0x80) { // it's a write to us
|
if (addr & 0x80) { // it's a write to us
|
||||||
nack_write(); // we don't accept writes.
|
nack_write(); // we don't accept writes.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// for now we only reply to version and remote temperature
|
// reads: for now we only reply to version and remote temperature
|
||||||
|
// empty message back if temperature not set or unknown message type
|
||||||
if (data[2] == 0x02) {
|
if (data[2] == 0x02) {
|
||||||
version(addr, data[0]);
|
version(addr, data[0]);
|
||||||
|
} else if (remotetemp[hc_] == EMS_VALUE_SHORT_NOTSET) {
|
||||||
|
unknown(addr, data[0], data[2], data[3]);
|
||||||
} else if (data[2] == 0xAF && data[3] == 0) {
|
} else if (data[2] == 0xAF && data[3] == 0) {
|
||||||
temperature(addr, data[0]);
|
temperature(addr, data[0]);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -205,11 +205,6 @@ void RxService::add(uint8_t * data, uint8_t length) {
|
|||||||
message_length = length - 6 - shift;
|
message_length = length - 6 - shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we don't have a type_id or empty data block, exit
|
|
||||||
if ((type_id == 0) || (message_length == 0)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we're watching and "raw" print out actual telegram as bytes to the console
|
// if we're watching and "raw" print out actual telegram as bytes to the console
|
||||||
if (EMSESP::watch() == EMSESP::Watch::WATCH_RAW) {
|
if (EMSESP::watch() == EMSESP::Watch::WATCH_RAW) {
|
||||||
uint16_t trace_watch_id = EMSESP::watch_id();
|
uint16_t trace_watch_id = EMSESP::watch_id();
|
||||||
@@ -222,6 +217,11 @@ void RxService::add(uint8_t * data, uint8_t length) {
|
|||||||
LOG_DEBUG(F("[DEBUG] New Rx [#%d] telegram, message length %d"), rx_telegram_id_, message_length);
|
LOG_DEBUG(F("[DEBUG] New Rx [#%d] telegram, message length %d"), rx_telegram_id_, message_length);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// if we don't have a type_id or empty data block, exit
|
||||||
|
if ((type_id == 0) || (message_length == 0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// create the telegram
|
// create the telegram
|
||||||
auto telegram = std::make_shared<Telegram>(Telegram::Operation::RX, src, dest, type_id, offset, message_data, message_length);
|
auto telegram = std::make_shared<Telegram>(Telegram::Operation::RX, src, dest, type_id, offset, message_data, message_length);
|
||||||
|
|
||||||
@@ -233,7 +233,6 @@ void RxService::add(uint8_t * data, uint8_t length) {
|
|||||||
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue
|
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tx CODE starts here...
|
// Tx CODE starts here...
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user