Skip to content

Commit 7e89241

Browse files
NorthernMan54Northern Man
authored andcommitted
Minor RTL_433 Tuning (1technophile#960)
* Update to SmartRC-CC1101-Driver-Lib@^2.5.4 and removal of workaround from 1technophile#847 Tks to @LSatan workaround no longer needed LSatan/SmartRC-CC1101-Driver-Lib#65 * Default to value as subject for rtl_433 and receiver switching * Default to not publishing unparsed signals * Fix for missing String for uint64_t * Fix is only required when value a subject is defined and not PiLight Co-authored-by: Northern Man <sgracey@Heisenberg.local>
1 parent 472d0c5 commit 7e89241

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

main/ZgatewayRTL_433.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
*/
2929
#include "User_config.h"
3030
#ifdef ZgatewayRTL_433
31+
# ifndef ZradioCC1101
32+
# error "CC1101 is the only supported receiver module for RTL_433 and needs to be enabled."
33+
# endif
3134

3235
# include <rtl_433_ESP.h>
3336

main/main.ino

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void pub(const char* topicori, JsonObject& data) {
292292
# else
293293
SIGNAL_SIZE_UL_ULL value = data["value"];
294294
if (value != 0) {
295-
topic = topic + "/" + String(value);
295+
topic = topic + "/" + toString(value);
296296
}
297297
# endif
298298
#endif
@@ -1808,3 +1808,32 @@ void MQTTtoSYS(char* topicOri, JsonObject& SYSdata) { // json object decoding
18081808
#endif
18091809
}
18101810
}
1811+
1812+
#if defined(valueAsASubject) && !defined(ZgatewayPilight)
1813+
# if defined(ESP32) || defined(ESP8266) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
1814+
String toString(uint64_t input) {
1815+
String result = "";
1816+
uint8_t base = 10;
1817+
1818+
do {
1819+
char c = input % base;
1820+
input /= base;
1821+
1822+
if (c < 10)
1823+
c += '0';
1824+
else
1825+
c += 'A' - 10;
1826+
result = c + result;
1827+
} while (input);
1828+
return result;
1829+
}
1830+
1831+
# else
1832+
1833+
String toString(uint32_t input) {
1834+
String result = String(input);
1835+
1836+
return result;
1837+
}
1838+
# endif
1839+
#endif

platformio.ini

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ smartrc-cc1101-driver-lib = SmartRC-CC1101-Driver-Lib@2.5.5
120120
stl = https://github.com/mike-matera/ArduinoSTL.git#7411816
121121
shtc3 = https://github.com/sparkfun/SparkFun_SHTC3_Arduino_Library
122122
somfy_remote=Somfy_Remote_Lib@0.3.0
123-
rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP#38ee89a
123+
rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP#e03f689
124124
emodbus = miq19/eModbus@1.0.0
125125
gfSunInverter = https://github.com/BlackSmith/GFSunInverter.git#v1.0.1
126126

@@ -561,8 +561,11 @@ build_flags =
561561
'-DZradioCC1101="CC1101"'
562562
'-DZgatewayRTL_433="rtl_433"'
563563
'-DGateway_Name="OpenMQTTGateway_rtl_433_ESP"'
564-
'-DRF_RECEIVER_GPIO=4'
565-
; '-DRTL_DEBUG=4' ; enable rtl_433 verbose device decode
564+
'-DRF_RECEIVER_GPIO=4' ; CC1101 - GDO2
565+
'-DRF_EMITTER_GPIO=2' ; CC1101 - GDO0
566+
'-DvalueAsASubject=true' ; mqtt topic includes model and device
567+
; '-DPUBLISH_UNPARSED=true' ; Publish details of undecoded signals
568+
; '-DRTL_DEBUG=4' ; enable rtl_433 verbose device decode
566569

567570
[env:esp32dev-multi_receiver]
568571
platform = ${com.esp32_platform}
@@ -585,6 +588,7 @@ build_flags =
585588
'-DGateway_Name="OpenMQTTGateway_multi_receiver"'
586589
'-DRF_RECEIVER_GPIO=4' ; CC1101 - GDO2
587590
'-DRF_EMITTER_GPIO=2' ; CC1101 - GDO0
591+
'-DvalueAsASubject=true' ; mqtt topic includes model and device (rtl_433) or protocol and id ( RF and PiLight )
588592
; '-DDEFAULT_RECEIVER=1' ; Default receiver to enable on startup
589593

590594
[env:ttgo-lora32-v1]

0 commit comments

Comments
 (0)