Skip to content

Commit f66d23d

Browse files
NorthernMan54Northern Man
andauthored
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 a95ccdc commit f66d23d

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
@@ -298,7 +298,7 @@ void pub(const char* topicori, JsonObject& data) {
298298
# else
299299
SIGNAL_SIZE_UL_ULL value = data["value"];
300300
if (value != 0) {
301-
topic = topic + "/" + String(value);
301+
topic = topic + "/" + toString(value);
302302
}
303303
# endif
304304
#endif
@@ -1783,3 +1783,32 @@ void MQTTtoSYS(char* topicOri, JsonObject& SYSdata) { // json object decoding
17831783
#endif
17841784
}
17851785
}
1786+
1787+
#if defined(valueAsASubject) && !defined(ZgatewayPilight)
1788+
# if defined(ESP32) || defined(ESP8266) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)
1789+
String toString(uint64_t input) {
1790+
String result = "";
1791+
uint8_t base = 10;
1792+
1793+
do {
1794+
char c = input % base;
1795+
input /= base;
1796+
1797+
if (c < 10)
1798+
c += '0';
1799+
else
1800+
c += 'A' - 10;
1801+
result = c + result;
1802+
} while (input);
1803+
return result;
1804+
}
1805+
1806+
# else
1807+
1808+
String toString(uint32_t input) {
1809+
String result = String(input);
1810+
1811+
return result;
1812+
}
1813+
# endif
1814+
#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)