mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
add known devices without product-id or version-info #174
This commit is contained in:
@@ -84,12 +84,12 @@
|
|||||||
{157, DeviceType::THERMOSTAT, F("RC200/CW100"), DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18
|
{157, DeviceType::THERMOSTAT, F("RC200/CW100"), DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18
|
||||||
{158, DeviceType::THERMOSTAT, F("RC300/RC310/Moduline 3000/1010H/CW400/Sense II"), DeviceFlags::EMS_DEVICE_FLAG_RC300}, // 0x10
|
{158, DeviceType::THERMOSTAT, F("RC300/RC310/Moduline 3000/1010H/CW400/Sense II"), DeviceFlags::EMS_DEVICE_FLAG_RC300}, // 0x10
|
||||||
{165, DeviceType::THERMOSTAT, F("RC100/Moduline 1000/1010"), DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18, 0x38
|
{165, DeviceType::THERMOSTAT, F("RC100/Moduline 1000/1010"), DeviceFlags::EMS_DEVICE_FLAG_RC100}, // 0x18, 0x38
|
||||||
{216, DeviceType::THERMOSTAT, F("CRF200S"), DeviceFlags::EMS_DEVICE_FLAG_CRF | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18
|
|
||||||
{172, DeviceType::THERMOSTAT, F("Rego 2000/3000"), DeviceFlags::EMS_DEVICE_FLAG_RC300}, // 0x10
|
{172, DeviceType::THERMOSTAT, F("Rego 2000/3000"), DeviceFlags::EMS_DEVICE_FLAG_RC300}, // 0x10
|
||||||
|
{216, DeviceType::THERMOSTAT, F("CRF200S"), DeviceFlags::EMS_DEVICE_FLAG_CRF | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE}, // 0x18
|
||||||
|
|
||||||
// Thermostat - Sieger - 0x10 / 0x17
|
// Thermostat - Sieger - 0x10 / 0x17
|
||||||
{ 66, DeviceType::THERMOSTAT, F("ES72/RC20"), DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17 or remote
|
{ 66, DeviceType::THERMOSTAT, F("ES72/RC20"), DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17 or remote
|
||||||
{ 76, DeviceType::THERMOSTAT, F("ES73"), DeviceFlags::EMS_DEVICE_FLAG_RC35}, // 0x10
|
{ 76, DeviceType::THERMOSTAT, F("ES73"), DeviceFlags::EMS_DEVICE_FLAG_RC30_N}, // 0x10
|
||||||
{113, DeviceType::THERMOSTAT, F("ES72/RC20"), DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17
|
{113, DeviceType::THERMOSTAT, F("ES72/RC20"), DeviceFlags::EMS_DEVICE_FLAG_RC20_N}, // 0x17
|
||||||
|
|
||||||
// Thermostat - Junkers - 0x10
|
// Thermostat - Junkers - 0x10
|
||||||
@@ -125,12 +125,17 @@
|
|||||||
{171, DeviceType::CONNECT, F("OpenTherm Converter"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
{171, DeviceType::CONNECT, F("OpenTherm Converter"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||||
{205, DeviceType::CONNECT, F("Moduline Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
{205, DeviceType::CONNECT, F("Moduline Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||||
{206, DeviceType::CONNECT, F("Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
{206, DeviceType::CONNECT, F("Easy Connect"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||||
|
|
||||||
|
// wireless sensor base- 0x50
|
||||||
{236, DeviceType::CONNECT, F("Wireless sensor base"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
{236, DeviceType::CONNECT, F("Wireless sensor base"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||||
|
|
||||||
// Switches - 0x11
|
// Switches - 0x11
|
||||||
{ 71, DeviceType::SWITCH, F("WM10"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
{ 71, DeviceType::SWITCH, F("WM10"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||||
|
|
||||||
// Gateways - 0x48
|
// Gateways - 0x48
|
||||||
{189, DeviceType::GATEWAY, F("KM200/MB LAN 2"), DeviceFlags::EMS_DEVICE_FLAG_NONE}
|
{189, DeviceType::GATEWAY, F("KM200/MB LAN 2"), DeviceFlags::EMS_DEVICE_FLAG_NONE},
|
||||||
|
|
||||||
|
// generic - 0x40 or other with no product-id and no version
|
||||||
|
{0, DeviceType::GENERIC, F("unknown"), DeviceFlags::EMS_DEVICE_FLAG_NONE}
|
||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|||||||
@@ -736,6 +736,11 @@ void EMSESP::process_UBADevices(std::shared_ptr<const Telegram> telegram) {
|
|||||||
void EMSESP::process_version(std::shared_ptr<const Telegram> telegram) {
|
void EMSESP::process_version(std::shared_ptr<const Telegram> telegram) {
|
||||||
// check for valid telegram, just in case
|
// check for valid telegram, just in case
|
||||||
if (telegram->message_length < 3) {
|
if (telegram->message_length < 3) {
|
||||||
|
// for empty telegram add device with empty product, version and brand
|
||||||
|
if (!telegram->message_length) {
|
||||||
|
std::string version = "00.00";
|
||||||
|
(void)add_device(telegram->src, 0, version, 0);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -852,7 +857,7 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
|
|||||||
LOG_NOTICE(F("%s"), pretty_telegram(telegram).c_str());
|
LOG_NOTICE(F("%s"), pretty_telegram(telegram).c_str());
|
||||||
}
|
}
|
||||||
if (first_scan_done_ && !knowndevice && (telegram->src != EMSbus::ems_bus_id()) && (telegram->src != 0x0B) && (telegram->src != 0x0C)
|
if (first_scan_done_ && !knowndevice && (telegram->src != EMSbus::ems_bus_id()) && (telegram->src != 0x0B) && (telegram->src != 0x0C)
|
||||||
&& (telegram->src != 0x0D)) {
|
&& (telegram->src != 0x0D) && (telegram->message_length > 0)) {
|
||||||
send_read_request(EMSdevice::EMS_TYPE_VERSION, telegram->src);
|
send_read_request(EMSdevice::EMS_TYPE_VERSION, telegram->src);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -978,6 +983,35 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, std::
|
|||||||
auto name = uuid::read_flash_string(device_p->name);
|
auto name = uuid::read_flash_string(device_p->name);
|
||||||
auto device_type = device_p->device_type;
|
auto device_type = device_p->device_type;
|
||||||
auto flags = device_p->flags;
|
auto flags = device_p->flags;
|
||||||
|
|
||||||
|
// empty reply to version, read a generic device from database
|
||||||
|
if (product_id == 0) {
|
||||||
|
// check for known device IDs
|
||||||
|
if (device_id == 0x40) {
|
||||||
|
name = "rf room temperature sensor";
|
||||||
|
} else if (device_id == 0x17) {
|
||||||
|
name = "generic thermostat";
|
||||||
|
device_type = DeviceType::THERMOSTAT;
|
||||||
|
flags = DeviceFlags::EMS_DEVICE_FLAG_RC10 | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE;
|
||||||
|
} else if (device_id == 0x04) {
|
||||||
|
name = "RS232";
|
||||||
|
device_type = DeviceType::CONNECT;
|
||||||
|
} else if (device_id == 0x0A) {
|
||||||
|
name = "terminal";
|
||||||
|
device_type = DeviceType::CONNECT;
|
||||||
|
} else if (device_id == 0x0B) {
|
||||||
|
name = "service key";
|
||||||
|
device_type = DeviceType::CONNECT;
|
||||||
|
} else if (device_id == 0x0D) {
|
||||||
|
name = "modem";
|
||||||
|
device_type = DeviceType::CONNECT;
|
||||||
|
} else if (device_id == 0x0E) {
|
||||||
|
name = "converter";
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LOG_DEBUG(F("Adding new device %s (device ID 0x%02X, product ID %d, version %s)"), name.c_str(), device_id, product_id, version.c_str());
|
LOG_DEBUG(F("Adding new device %s (device ID 0x%02X, product ID %d, version %s)"), name.c_str(), device_id, product_id, version.c_str());
|
||||||
emsdevices.push_back(EMSFactory::add(device_type, device_id, product_id, version, name, flags, brand));
|
emsdevices.push_back(EMSFactory::add(device_type, device_id, product_id, version, name, flags, brand));
|
||||||
emsdevices.back()->unique_id(++unique_id_count_);
|
emsdevices.back()->unique_id(++unique_id_count_);
|
||||||
|
|||||||
@@ -234,6 +234,15 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add empty telegram to rx-queue
|
||||||
|
void RxService::add_empty(const uint8_t src, const uint8_t dest, const uint16_t type_id) {
|
||||||
|
auto telegram = std::make_shared<Telegram>(Telegram::Operation::RX, src, dest, type_id, 0, nullptr, 0);
|
||||||
|
// only if queue is not full
|
||||||
|
if (rx_telegrams_.size() < MAX_RX_TELEGRAMS) {
|
||||||
|
rx_telegrams_.emplace_back(rx_telegram_id_++, std::move(telegram)); // add to queue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// start and initialize Tx
|
// start and initialize Tx
|
||||||
// send out request to EMS bus for all devices
|
// send out request to EMS bus for all devices
|
||||||
void TxService::start() {
|
void TxService::start() {
|
||||||
@@ -543,14 +552,14 @@ void TxService::send_raw(const char * telegram_data) {
|
|||||||
|
|
||||||
// get first value, which should be the src
|
// get first value, which should be the src
|
||||||
if ((p = strtok(telegram, " ,"))) { // delimiter
|
if ((p = strtok(telegram, " ,"))) { // delimiter
|
||||||
strlcpy(value, p, 10);
|
strlcpy(value, p, sizeof(value));
|
||||||
data[0] = (uint8_t)strtol(value, 0, 16);
|
data[0] = (uint8_t)strtol(value, 0, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
// and iterate until end
|
// and iterate until end
|
||||||
while (p != 0) {
|
while (p != 0) {
|
||||||
if ((p = strtok(nullptr, " ,"))) {
|
if ((p = strtok(nullptr, " ,"))) {
|
||||||
strlcpy(value, p, 10);
|
strlcpy(value, p, sizeof(value));
|
||||||
uint8_t val = (uint8_t)strtol(value, 0, 16);
|
uint8_t val = (uint8_t)strtol(value, 0, 16);
|
||||||
data[++count] = val;
|
data[++count] = val;
|
||||||
}
|
}
|
||||||
@@ -576,6 +585,9 @@ void TxService::retry_tx(const uint8_t operation, const uint8_t * data, const ui
|
|||||||
(operation == Telegram::Operation::TX_WRITE) ? F("Write") : F("Read"),
|
(operation == Telegram::Operation::TX_WRITE) ? F("Write") : F("Read"),
|
||||||
MAXIMUM_TX_RETRIES,
|
MAXIMUM_TX_RETRIES,
|
||||||
telegram_last_->to_string().c_str());
|
telegram_last_->to_string().c_str());
|
||||||
|
if (operation == Telegram::Operation::TX_READ) {
|
||||||
|
EMSESP::rxservice_.add_empty(telegram_last_->dest, telegram_last_->src, telegram_last_->type_id);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ class RxService : public EMSbus {
|
|||||||
|
|
||||||
void loop();
|
void loop();
|
||||||
void add(uint8_t * data, uint8_t length);
|
void add(uint8_t * data, uint8_t length);
|
||||||
|
void add_empty(const uint8_t src, const uint8_t dst, const uint16_t type_id);
|
||||||
|
|
||||||
uint32_t telegram_count() const {
|
uint32_t telegram_count() const {
|
||||||
return telegram_count_;
|
return telegram_count_;
|
||||||
|
|||||||
Reference in New Issue
Block a user