minor cleanup

This commit is contained in:
proddy
2021-03-21 12:48:03 +01:00
parent f2dbc26491
commit 25b1957dbf
10 changed files with 29 additions and 137 deletions

View File

@@ -1,10 +1,6 @@
# Change the IP address to that of your ESP device to enable local development of the UI. # Change the IP address to that of your ESP device to enable local development of the UI.
# Remember to also enable CORS in platformio.ini before uploading the code to the device. # Remember to also enable CORS in platformio.ini before uploading the code to the device
# with -DENABLE_CORS
# ESP32 dev
REACT_APP_HTTP_ROOT=http://10.10.10.101 REACT_APP_HTTP_ROOT=http://10.10.10.101
REACT_APP_WEB_SOCKET_ROOT=ws://10.10.10.101 REACT_APP_WEB_SOCKET_ROOT=ws://10.10.10.101
# ESP8266 dev
#REACT_APP_HTTP_ROOT=http://10.10.10.140
#REACT_APP_WEB_SOCKET_ROOT=ws://10.10.10.140

View File

@@ -35,7 +35,7 @@ class SecuritySettingsForm extends React.Component<SecuritySettingsFormProps> {
/> />
<Box bgcolor="primary.main" color="primary.contrastText" p={2} mt={2} mb={2}> <Box bgcolor="primary.main" color="primary.contrastText" p={2} mt={2} mb={2}>
<Typography variant="body1"> <Typography variant="body1">
The Super User password is used to sign authentication tokens and also the Console's `su` password. If you modify this all users will be signed out. The Super User password is used to sign authentication tokens and is also the Console's `su` password. If you modify this all users will be signed out.
</Typography> </Typography>
</Box> </Box>
<FormActions> <FormActions>

View File

@@ -26,16 +26,8 @@ uuid::log::Logger Command::logger_{F_(command), uuid::log::Facility::DAEMON};
std::vector<Command::CmdFunction> Command::cmdfunctions_; std::vector<Command::CmdFunction> Command::cmdfunctions_;
/*
static emsesp::array<Command::CmdFunction> cmdfunctions_(90, 255, 16); // reserve space for 90 commands
emsesp::array<Command::CmdFunction> * Command::commands() {
return &cmdfunctions_;
}
*/
// calls a command // calls a command
// id may be used to represent a heating circuit for example // id may be used to represent a heating circuit for example, it's optional
// returns false if error or not found // returns false if error or not found
bool Command::call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id) { bool Command::call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id) {
auto cf = find_command(device_type, cmd); auto cf = find_command(device_type, cmd);
@@ -99,14 +91,6 @@ void Command::add(const uint8_t device_type, const __FlashStringHelper * cmd, cm
return; return;
} }
/*
CmdFunction cf;
cf.cmd_ = cmd;
cf.device_type_ = device_type;
cf.cmdfunction_json_ = nullptr; // empty
cf.cmdfunction_ = cb;
cmdfunctions_.push(cf);
*/
cmdfunctions_.emplace_back(device_type, cmd, cb, nullptr); cmdfunctions_.emplace_back(device_type, cmd, cb, nullptr);
// see if we need to subscribe // see if we need to subscribe
@@ -122,15 +106,6 @@ void Command::add_with_json(const uint8_t device_type, const __FlashStringHelper
return; return;
} }
/*
CmdFunction cf;
cf.cmd_ = cmd;
cf.device_type_ = device_type;
cf.cmdfunction_json_ = cb;
cf.cmdfunction_ = nullptr; // empty
cmdfunctions_.push(cf);
*/
cmdfunctions_.emplace_back(device_type, cmd, nullptr, cb); // add command cmdfunctions_.emplace_back(device_type, cmd, nullptr, cb); // add command
} }

View File

@@ -26,8 +26,6 @@
#include <vector> #include <vector>
#include <functional> #include <functional>
// #include "containers.h"
#include "console.h" #include "console.h"
#include <uuid/log.h> #include <uuid/log.h>
@@ -59,10 +57,8 @@ class Command {
return cmdfunctions_; return cmdfunctions_;
} }
// static emsesp::array<Command::CmdFunction> * commands();
static bool call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id, JsonObject & json); static bool call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id, JsonObject & json);
static bool call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id); static bool call(const uint8_t device_type, const char * cmd, const char * value, const int8_t id = 0);
static void add(const uint8_t device_type, const __FlashStringHelper * cmd, cmdfunction_p cb); static void add(const uint8_t device_type, const __FlashStringHelper * cmd, cmdfunction_p cb);
static void add_with_json(const uint8_t device_type, const __FlashStringHelper * cmd, cmdfunction_json_p cb); static void add_with_json(const uint8_t device_type, const __FlashStringHelper * cmd, cmdfunction_json_p cb);
static void show_all(uuid::console::Shell & shell); static void show_all(uuid::console::Shell & shell);

View File

@@ -227,8 +227,7 @@ bool Boiler::publish_ha_config() {
char topic[Mqtt::MQTT_TOPIC_MAX_SIZE]; char topic[Mqtt::MQTT_TOPIC_MAX_SIZE];
snprintf_P(topic, sizeof(topic), PSTR("homeassistant/sensor/%s/boiler/config"), Mqtt::base().c_str()); snprintf_P(topic, sizeof(topic), PSTR("homeassistant/sensor/%s/boiler/config"), Mqtt::base().c_str());
Mqtt::publish_ha(topic, Mqtt::publish_ha(topic, doc.as<JsonObject>()); // publish the config payload with retain flag
doc.as<JsonObject>()); // publish the config payload with retain flag
return true; return true;
} }

View File

@@ -448,9 +448,9 @@ bool Thermostat::thermostat_ha_cmd(const char * message, uint8_t hc_num) {
return false; return false;
} }
// check for mode first // check for mode first, which is a string
if (!set_mode(message, hc_num)) { if (!set_mode(message, hc_num)) {
// handle as a numerical temperature value // otherwise handle as a numerical temperature value and set the setpoint temp
float f = strtof((char *)message, 0); float f = strtof((char *)message, 0);
set_temperature(f, HeatingCircuit::Mode::AUTO, hc_num); set_temperature(f, HeatingCircuit::Mode::AUTO, hc_num);
} }

View File

@@ -124,7 +124,7 @@ std::string EMSdevice::brand_to_string() const {
return std::string{}; return std::string{};
} }
// returns the name of the MQTT topic to use for a specific device // returns the name of the MQTT topic to use for a specific device, without the base
std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) { std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) {
switch (device_type) { switch (device_type) {
case DeviceType::SYSTEM: case DeviceType::SYSTEM:
@@ -308,6 +308,7 @@ bool EMSdevice::get_toggle_fetch(uint16_t telegram_id) {
} }
// list device values, only for EMSESP_DEBUG mode // list device values, only for EMSESP_DEBUG mode
#if defined(EMSESP_DEBUG)
void EMSdevice::show_device_values_debug(uuid::console::Shell & shell) { void EMSdevice::show_device_values_debug(uuid::console::Shell & shell) {
size_t total_s = 0; size_t total_s = 0;
uint8_t count = 0; uint8_t count = 0;
@@ -324,7 +325,7 @@ void EMSdevice::show_device_values_debug(uuid::console::Shell & shell) {
shell.printfln("Total size of %d elements: %d", count, total_s); shell.printfln("Total size of %d elements: %d", count, total_s);
shell.println(); shell.println();
} }
#endif
// list all the telegram type IDs for this device // list all the telegram type IDs for this device
void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) { void EMSdevice::show_telegram_handlers(uuid::console::Shell & shell) {

View File

@@ -824,7 +824,7 @@ void EMSESP::show_devices(uuid::console::Shell & shell) {
#if defined(EMSESP_DEBUG) #if defined(EMSESP_DEBUG)
emsdevice->show_mqtt_handlers(shell); emsdevice->show_mqtt_handlers(shell);
shell.println(); shell.println();
emsdevice->show_device_values_debug(shell); // emsdevice->show_device_values_debug(shell);
#endif #endif
shell.println(); shell.println();

View File

@@ -22,19 +22,15 @@
namespace emsesp { namespace emsesp {
// CRC lookup table with poly 12 for faster checking // CRC lookup table with poly 12 for faster checking
const uint8_t ems_crc_table[] = {0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E, 0x20, 0x22, 0x24, 0x26, const uint8_t ems_crc_table[] = {0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E, 0x20, 0x22, 0x24, 0x26, 0x28, 0x2A, 0x2C, 0x2E, 0x30, 0x32, 0x34, 0x36, 0x38,
0x28, 0x2A, 0x2C, 0x2E, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3A, 0x3C, 0x3E, 0x40, 0x42, 0x44, 0x46, 0x48, 0x4A, 0x4C, 0x4E, 0x3A, 0x3C, 0x3E, 0x40, 0x42, 0x44, 0x46, 0x48, 0x4A, 0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5A, 0x5C, 0x5E, 0x60, 0x62, 0x64, 0x66, 0x68, 0x6A, 0x6C, 0x6E, 0x70, 0x72,
0x50, 0x52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 0xB9, 0xBB, 0xBD, 0xBF, 0xB1, 0xB3, 0xB5, 0xB7, 0xA9, 0xAB, 0xAD, 0xAF,
0xA1, 0xA3, 0xA5, 0xA7, 0xD9, 0xDB, 0xDD, 0xDF, 0xD1, 0xD3, 0xD5, 0xD7, 0xC9, 0xCB, 0xCD, 0xCF, 0xC1, 0xC3, 0xC5, 0xC7,
0xF9, 0xFB, 0xFD, 0xFF, 0xF1, 0xF3, 0xF5, 0xF7, 0xE9, 0xEB, 0xED, 0xEF, 0xE1, 0xE3, 0xE5, 0xE7};
uint32_t EMSbus::last_bus_activity_ = 0; // timestamp of last time a valid Rx came in uint32_t EMSbus::last_bus_activity_ = 0; // timestamp of last time a valid Rx came in
bool EMSbus::bus_connected_ = false; // start assuming the bus hasn't been connected bool EMSbus::bus_connected_ = false; // start assuming the bus hasn't been connected
@@ -59,13 +55,7 @@ uint8_t EMSbus::calculate_crc(const uint8_t * data, const uint8_t length) {
// creates a telegram object // creates a telegram object
// stores header in separate member objects and the rest in the message_data block // stores header in separate member objects and the rest in the message_data block
Telegram::Telegram(const uint8_t operation, Telegram::Telegram(const uint8_t operation, const uint8_t src, const uint8_t dest, const uint16_t type_id, const uint8_t offset, const uint8_t * data, const uint8_t message_length)
const uint8_t src,
const uint8_t dest,
const uint16_t type_id,
const uint8_t offset,
const uint8_t * data,
const uint8_t message_length)
: operation(operation) : operation(operation)
, src(src) , src(src)
, dest(dest) , dest(dest)
@@ -202,8 +192,7 @@ void RxService::add(uint8_t * data, uint8_t length) {
// 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();
if ((trace_watch_id == WATCH_ID_NONE) || (type_id == trace_watch_id) if ((trace_watch_id == WATCH_ID_NONE) || (type_id == trace_watch_id) || ((trace_watch_id < 0x80) && ((src == trace_watch_id) || (dest == trace_watch_id)))) {
|| ((trace_watch_id < 0x80) && ((src == trace_watch_id) || (dest == trace_watch_id)))) {
LOG_NOTICE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); LOG_NOTICE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str());
} else if (EMSESP::trace_raw()) { } else if (EMSESP::trace_raw()) {
LOG_TRACE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str()); LOG_TRACE(F("Rx: %s"), Helpers::data_to_hex(data, length).c_str());
@@ -234,13 +223,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
/*
QueuedRxTelegram qrxt;
qrxt.telegram_ = std::make_shared<Telegram>(operation, src, dest, type_id, offset, message_data, message_length);
qrxt.id_ = rx_telegram_id_++;
rx_telegrams_.push(qrxt);
*/
} }
// start and initialize Tx // start and initialize Tx
@@ -285,15 +267,11 @@ void TxService::send() {
} }
delayed_send_ = 0; delayed_send_ = 0;
// auto telegram = tx_telegrams_.pop(); // get the Telegram, also removes from queue
// if we're in read-only mode (tx_mode 0) forget the Tx call // if we're in read-only mode (tx_mode 0) forget the Tx call
if (tx_mode() != 0) { if (tx_mode() != 0) {
// send_telegram(telegram);
send_telegram(tx_telegrams_.front()); send_telegram(tx_telegrams_.front());
} }
// auto telegram = tx_telegrams_.pop();
tx_telegrams_.pop_front(); // remove the telegram from the queue tx_telegrams_.pop_front(); // remove the telegram from the queue
} }
@@ -371,10 +349,7 @@ void TxService::send_telegram(const QueuedTxTelegram & tx_telegram) {
length++; // add one since we want to now include the CRC length++; // add one since we want to now include the CRC
LOG_DEBUG(F("Sending %s Tx [#%d], telegram: %s"), LOG_DEBUG(F("Sending %s Tx [#%d], telegram: %s"), (telegram->operation == Telegram::Operation::TX_WRITE) ? F("write") : F("read"), tx_telegram.id_, Helpers::data_to_hex(telegram_raw, length).c_str());
(telegram->operation == Telegram::Operation::TX_WRITE) ? F("write") : F("read"),
tx_telegram.id_,
Helpers::data_to_hex(telegram_raw, length).c_str());
set_post_send_query(tx_telegram.validateid_); set_post_send_query(tx_telegram.validateid_);
// send the telegram to the UART Tx // send the telegram to the UART Tx
@@ -414,14 +389,7 @@ void TxService::send_telegram(const uint8_t * data, const uint8_t length) {
} }
*/ */
void TxService::add(const uint8_t operation, void TxService::add(const uint8_t operation, const uint8_t dest, const uint16_t type_id, const uint8_t offset, uint8_t * message_data, const uint8_t message_length, const uint16_t validateid, const bool front) {
const uint8_t dest,
const uint16_t type_id,
const uint8_t offset,
uint8_t * message_data,
const uint8_t message_length,
const uint16_t validateid,
const bool front) {
auto telegram = std::make_shared<Telegram>(operation, ems_bus_id(), dest, type_id, offset, message_data, message_length); auto telegram = std::make_shared<Telegram>(operation, ems_bus_id(), dest, type_id, offset, message_data, message_length);
#ifdef EMSESP_DEBUG #ifdef EMSESP_DEBUG
@@ -507,13 +475,6 @@ void TxService::add(uint8_t operation, const uint8_t * data, const uint8_t lengt
LOG_DEBUG(F("[DEBUG] New Tx [#%d] telegram, length %d"), tx_telegram_id_, message_length); LOG_DEBUG(F("[DEBUG] New Tx [#%d] telegram, length %d"), tx_telegram_id_, message_length);
#endif #endif
/*
QueuedTxTelegram qtxt;
qtxt.id_ = tx_telegram_id_++;
qtxt.retry_ = false;
qtxt.telegram_ = std::make_shared<Telegram>(operation, ems_bus_id(), dest, type_id, offset, message_data, message_length);
*/
if (front) { if (front) {
// tx_telegrams_.push_front(qtxt); // add to front of queue // tx_telegrams_.push_front(qtxt); // add to front of queue
tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram), false, validate_id); // add to front of queue tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram), false, validate_id); // add to front of queue
@@ -580,9 +541,7 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui
reset_retry_count(); // give up reset_retry_count(); // give up
increment_telegram_fail_count(); // another Tx fail increment_telegram_fail_count(); // another Tx fail
LOG_ERROR(F("Last Tx %s operation failed after %d retries. Ignoring request."), LOG_ERROR(F("Last Tx %s operation failed after %d retries. Ignoring request."), (operation == Telegram::Operation::TX_WRITE) ? F("Write") : F("Read"), MAXIMUM_TX_RETRIES);
(operation == Telegram::Operation::TX_WRITE) ? F("Write") : F("Read"),
MAXIMUM_TX_RETRIES);
return; return;
} }
@@ -600,14 +559,6 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui
} }
tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram_last_), true, get_post_send_query()); tx_telegrams_.emplace_front(tx_telegram_id_++, std::move(telegram_last_), true, get_post_send_query());
/*
QueuedTxTelegram qtxt;
qtxt.id_ = tx_telegram_id_++;
qtxt.retry_ = true; // this time it is a retry
qtxt.telegram_ = telegram_last_;
tx_telegrams_.push_front(qtxt); // add to front of queue
*/
} }
uint16_t TxService::read_next_tx() { uint16_t TxService::read_next_tx() {

View File

@@ -31,7 +31,6 @@
#include <uuid/log.h> #include <uuid/log.h>
// #include "containers.h"
#include "helpers.h" #include "helpers.h"
#define MAX_RX_TELEGRAMS 10 // size of Rx queue #define MAX_RX_TELEGRAMS 10 // size of Rx queue
@@ -239,17 +238,6 @@ class RxService : public EMSbus {
return rx_telegrams_; return rx_telegrams_;
} }
/*
struct QueuedRxTelegram {
uint16_t id_;
std::shared_ptr<const Telegram> telegram_;
};
const emsesp::queue<QueuedRxTelegram> queue() const {
return rx_telegrams_;
}
*/
private: private:
static constexpr uint8_t EMS_BUS_QUALITY_RX_THRESHOLD = 5; // % threshold before reporting quality issues static constexpr uint8_t EMS_BUS_QUALITY_RX_THRESHOLD = 5; // % threshold before reporting quality issues
@@ -258,7 +246,6 @@ class RxService : public EMSbus {
uint32_t telegram_error_count_ = 0; // # Rx CRC errors uint32_t telegram_error_count_ = 0; // # Rx CRC errors
std::shared_ptr<const Telegram> rx_telegram; // the incoming Rx telegram std::shared_ptr<const Telegram> rx_telegram; // the incoming Rx telegram
std::deque<QueuedRxTelegram> rx_telegrams_; // the Rx Queue std::deque<QueuedRxTelegram> rx_telegrams_; // the Rx Queue
// emsesp::queue<QueuedRxTelegram> rx_telegrams_ = emsesp::queue<QueuedRxTelegram>(MAX_RX_TELEGRAMS); // the Rx Queue
}; };
class TxService : public EMSbus { class TxService : public EMSbus {
@@ -359,18 +346,6 @@ class TxService : public EMSbus {
return tx_telegrams_; return tx_telegrams_;
} }
/*
struct QueuedTxTelegram {
uint16_t id_;
std::shared_ptr<const Telegram> telegram_;
bool retry_; // true if its a retry
};
const emsesp::queue<QueuedTxTelegram> queue() const {
return tx_telegrams_;
}
*/
#if defined(EMSESP_DEBUG) #if defined(EMSESP_DEBUG)
static constexpr uint8_t MAXIMUM_TX_RETRIES = 0; // when compiled with EMSESP_DEBUG don't retry static constexpr uint8_t MAXIMUM_TX_RETRIES = 0; // when compiled with EMSESP_DEBUG don't retry
#else #else
@@ -380,7 +355,6 @@ class TxService : public EMSbus {
private: private:
std::deque<QueuedTxTelegram> tx_telegrams_; // the Tx queue std::deque<QueuedTxTelegram> tx_telegrams_; // the Tx queue
// emsesp::queue<QueuedTxTelegram> tx_telegrams_ = emsesp::queue<QueuedTxTelegram>(MAX_TX_TELEGRAMS); // the Tx Queue
uint32_t telegram_read_count_ = 0; // # Tx successful reads uint32_t telegram_read_count_ = 0; // # Tx successful reads
uint32_t telegram_write_count_ = 0; // # Tx successful writes uint32_t telegram_write_count_ = 0; // # Tx successful writes