[RTL_433] Update to rtl_433_ESP v0.1.8 (#1552)
This commit is contained in:
1 parent
4e93722098
commit
7c4c90d777
3 files changed
+18
-13
No files matched your search
+12
-12
@@ -53,7 +53,7 @@ static RTL_433device NO_RTL_433_DEVICE_FOUND = {{0},
|
|||||||
|
|
||||||
RTL_433device* getDeviceById(const char* id); // Declared here to avoid pre-compilation issue (misplaced auto declaration by pio)
|
RTL_433device* getDeviceById(const char* id); // Declared here to avoid pre-compilation issue (misplaced auto declaration by pio)
|
||||||
RTL_433device* getDeviceById(const char* id) {
|
RTL_433device* getDeviceById(const char* id) {
|
||||||
Log.trace(F("getDeviceById %s" CR), id);
|
DISCOVERY_TRACE_LOG(F("getDeviceById %s" CR), id);
|
||||||
|
|
||||||
for (std::vector<RTL_433device*>::iterator it = RTL_433devices.begin(); it != RTL_433devices.end(); ++it) {
|
for (std::vector<RTL_433device*>::iterator it = RTL_433devices.begin(); it != RTL_433devices.end(); ++it) {
|
||||||
if ((strcmp((*it)->uniqueId, id) == 0)) {
|
if ((strcmp((*it)->uniqueId, id) == 0)) {
|
||||||
@@ -66,9 +66,9 @@ RTL_433device* getDeviceById(const char* id) {
|
|||||||
void dumpRTL_433Devices() {
|
void dumpRTL_433Devices() {
|
||||||
for (std::vector<RTL_433device*>::iterator it = RTL_433devices.begin(); it != RTL_433devices.end(); ++it) {
|
for (std::vector<RTL_433device*>::iterator it = RTL_433devices.begin(); it != RTL_433devices.end(); ++it) {
|
||||||
RTL_433device* p = *it;
|
RTL_433device* p = *it;
|
||||||
Log.trace(F("uniqueId %s" CR), p->uniqueId);
|
DISCOVERY_TRACE_LOG(F("uniqueId %s" CR), p->uniqueId);
|
||||||
Log.trace(F("modelName %s" CR), p->modelName);
|
DISCOVERY_TRACE_LOG(F("modelName %s" CR), p->modelName);
|
||||||
Log.trace(F("isDisc %d" CR), p->isDisc);
|
DISCOVERY_TRACE_LOG(F("isDisc %d" CR), p->isDisc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ void createOrUpdateDeviceRTL_433(const char* id, const char* model, uint8_t flag
|
|||||||
|
|
||||||
RTL_433device* device = getDeviceById(id);
|
RTL_433device* device = getDeviceById(id);
|
||||||
if (device == &NO_RTL_433_DEVICE_FOUND) {
|
if (device == &NO_RTL_433_DEVICE_FOUND) {
|
||||||
Log.trace(F("add %s" CR), id);
|
DISCOVERY_TRACE_LOG(F("add %s" CR), id);
|
||||||
//new device
|
//new device
|
||||||
device = new RTL_433device();
|
device = new RTL_433device();
|
||||||
if (strlcpy(device->uniqueId, id, uniqueIdSize) > uniqueIdSize) {
|
if (strlcpy(device->uniqueId, id, uniqueIdSize) > uniqueIdSize) {
|
||||||
@@ -93,7 +93,7 @@ void createOrUpdateDeviceRTL_433(const char* id, const char* model, uint8_t flag
|
|||||||
RTL_433devices.push_back(device);
|
RTL_433devices.push_back(device);
|
||||||
newRTL_433Devices++;
|
newRTL_433Devices++;
|
||||||
} else {
|
} else {
|
||||||
Log.trace(F("update %s" CR), id);
|
DISCOVERY_TRACE_LOG(F("update %s" CR), id);
|
||||||
|
|
||||||
if (flags & device_flags_isDisc) {
|
if (flags & device_flags_isDisc) {
|
||||||
device->isDisc = true;
|
device->isDisc = true;
|
||||||
@@ -117,7 +117,7 @@ void launchRTL_433Discovery(bool overrideDiscovery) {
|
|||||||
xSemaphoreGive(semaphorecreateOrUpdateDeviceRTL_433);
|
xSemaphoreGive(semaphorecreateOrUpdateDeviceRTL_433);
|
||||||
for (std::vector<RTL_433device*>::iterator it = localDevices.begin(); it != localDevices.end(); ++it) {
|
for (std::vector<RTL_433device*>::iterator it = localDevices.begin(); it != localDevices.end(); ++it) {
|
||||||
RTL_433device* pdevice = *it;
|
RTL_433device* pdevice = *it;
|
||||||
Log.trace(F("Device id %s" CR), pdevice->uniqueId);
|
DISCOVERY_TRACE_LOG(F("Device id %s" CR), pdevice->uniqueId);
|
||||||
// Do not launch discovery for the RTL_433devices already discovered (unless we have overrideDiscovery) or that are not unique by their MAC Address (Ibeacon, GAEN and Microsoft Cdp)
|
// Do not launch discovery for the RTL_433devices already discovered (unless we have overrideDiscovery) or that are not unique by their MAC Address (Ibeacon, GAEN and Microsoft Cdp)
|
||||||
if (overrideDiscovery || !isDiscovered(pdevice)) {
|
if (overrideDiscovery || !isDiscovered(pdevice)) {
|
||||||
size_t numRows = sizeof(parameters) / sizeof(parameters[0]);
|
size_t numRows = sizeof(parameters) / sizeof(parameters[0]);
|
||||||
@@ -126,7 +126,7 @@ void launchRTL_433Discovery(bool overrideDiscovery) {
|
|||||||
// Remove the key from the unique id to extract the device id
|
// Remove the key from the unique id to extract the device id
|
||||||
String idWoKey = pdevice->uniqueId;
|
String idWoKey = pdevice->uniqueId;
|
||||||
idWoKey.remove(idWoKey.length() - (strlen(parameters[i][0]) + 1));
|
idWoKey.remove(idWoKey.length() - (strlen(parameters[i][0]) + 1));
|
||||||
Log.trace(F("idWoKey %s" CR), idWoKey.c_str());
|
DISCOVERY_TRACE_LOG(F("idWoKey %s" CR), idWoKey.c_str());
|
||||||
# if OpenHABDiscovery
|
# if OpenHABDiscovery
|
||||||
String value_template = "{{ value_json." + String(parameters[i][0]) + "}}";
|
String value_template = "{{ value_json." + String(parameters[i][0]) + "}}";
|
||||||
# else
|
# else
|
||||||
@@ -138,7 +138,7 @@ void launchRTL_433Discovery(bool overrideDiscovery) {
|
|||||||
String idWoKeyAndModel = idWoKey;
|
String idWoKeyAndModel = idWoKey;
|
||||||
idWoKeyAndModel.remove(0, strlen(pdevice->modelName));
|
idWoKeyAndModel.remove(0, strlen(pdevice->modelName));
|
||||||
idWoKeyAndModel.replace("-", "/");
|
idWoKeyAndModel.replace("-", "/");
|
||||||
Log.trace(F("idWoKeyAndModel %s" CR), idWoKeyAndModel.c_str());
|
DISCOVERY_TRACE_LOG(F("idWoKeyAndModel %s" CR), idWoKeyAndModel.c_str());
|
||||||
topic = topic + "/" + String(pdevice->modelName) + idWoKeyAndModel;
|
topic = topic + "/" + String(pdevice->modelName) + idWoKeyAndModel;
|
||||||
# endif
|
# endif
|
||||||
if (strcmp(parameters[i][0], "tamper") == 0 || strcmp(parameters[i][0], "alarm") == 0 || strcmp(parameters[i][0], "motion") == 0) {
|
if (strcmp(parameters[i][0], "tamper") == 0 || strcmp(parameters[i][0], "alarm") == 0 || strcmp(parameters[i][0], "motion") == 0) {
|
||||||
@@ -188,10 +188,10 @@ void launchRTL_433Discovery(bool overrideDiscovery) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!pdevice->isDisc) {
|
if (!pdevice->isDisc) {
|
||||||
Log.trace(F("Device id %s was not discovered" CR), pdevice->uniqueId); // Remove from production release ?
|
DISCOVERY_TRACE_LOG(F("Device id %s was not discovered" CR), pdevice->uniqueId); // Remove from production release ?
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.trace(F("Device already discovered or that doesn't require discovery %s" CR), pdevice->uniqueId);
|
DISCOVERY_TRACE_LOG(F("Device already discovered or that doesn't require discovery %s" CR), pdevice->uniqueId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ void rtl_433_Callback(char* message) {
|
|||||||
|
|
||||||
uniqueid.replace("/", "-");
|
uniqueid.replace("/", "-");
|
||||||
|
|
||||||
Log.notice(F("uniqueid: %s" CR), uniqueid.c_str());
|
// Log.notice(F("uniqueid: %s" CR), uniqueid.c_str());
|
||||||
if (!isAduplicateSignal(MQTTvalue)) {
|
if (!isAduplicateSignal(MQTTvalue)) {
|
||||||
# ifdef ZmqttDiscovery
|
# ifdef ZmqttDiscovery
|
||||||
if (disc)
|
if (disc)
|
||||||
|
|||||||
@@ -125,6 +125,11 @@ const char parameters[40][4][24] = {
|
|||||||
{"strike_count", "strike count", "", ""}, // from rtl_433_mqtt_hass.py
|
{"strike_count", "strike count", "", ""}, // from rtl_433_mqtt_hass.py
|
||||||
{"event", "Status", "", "moisture"}};
|
{"event", "Status", "", "moisture"}};
|
||||||
# endif
|
# endif
|
||||||
|
# ifdef RTL_433_DISCOVERY_LOGGING
|
||||||
|
# define DISCOVERY_TRACE_LOG(...) Log.trace(__VA_ARGS__)
|
||||||
|
# else
|
||||||
|
# define DISCOVERY_TRACE_LOG(...)
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
/*-------------------RF topics & parameters----------------------*/
|
/*-------------------RF topics & parameters----------------------*/
|
||||||
//433Mhz MQTT Subjects and keys
|
//433Mhz MQTT Subjects and keys
|
||||||
|
|||||||
+1
-1
@@ -148,7 +148,7 @@ smartrc-cc1101-driver-lib = SmartRC-CC1101-Driver-Lib@2.5.7
|
|||||||
stl = https://github.com/mike-matera/ArduinoSTL.git#7411816
|
stl = https://github.com/mike-matera/ArduinoSTL.git#7411816
|
||||||
shtc3 = https://github.com/sparkfun/SparkFun_SHTC3_Arduino_Library
|
shtc3 = https://github.com/sparkfun/SparkFun_SHTC3_Arduino_Library
|
||||||
somfy_remote=Somfy_Remote_Lib@0.3.0
|
somfy_remote=Somfy_Remote_Lib@0.3.0
|
||||||
rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP.git#v0.1.7
|
rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP.git#v0.1.8
|
||||||
emodbus = miq19/eModbus@1.0.0
|
emodbus = miq19/eModbus@1.0.0
|
||||||
gfSunInverter = https://github.com/BlackSmith/GFSunInverter.git#v1.0.1
|
gfSunInverter = https://github.com/BlackSmith/GFSunInverter.git#v1.0.1
|
||||||
decoder = https://github.com/theengs/decoder.git#v1.3.0
|
decoder = https://github.com/theengs/decoder.git#v1.3.0
|
||||||
|
|||||||
Reference in new issue
Block a user