diff --git a/main/ZgatewayRTL_433.ino b/main/ZgatewayRTL_433.ino index 7271867..b124a4c 100644 --- a/main/ZgatewayRTL_433.ino +++ b/main/ZgatewayRTL_433.ino @@ -28,6 +28,9 @@ */ #include "User_config.h" #ifdef ZgatewayRTL_433 +# ifndef ZradioCC1101 +# error "CC1101 is the only supported receiver module for RTL_433 and needs to be enabled." +# endif # include diff --git a/main/main.ino b/main/main.ino index 418f4fe..b7b1331 100644 --- a/main/main.ino +++ b/main/main.ino @@ -298,7 +298,7 @@ void pub(const char* topicori, JsonObject& data) { # else SIGNAL_SIZE_UL_ULL value = data["value"]; if (value != 0) { - topic = topic + "/" + String(value); + topic = topic + "/" + toString(value); } # endif #endif @@ -1783,3 +1783,32 @@ void MQTTtoSYS(char* topicOri, JsonObject& SYSdata) { // json object decoding #endif } } + +#if defined(valueAsASubject) && !defined(ZgatewayPilight) +# if defined(ESP32) || defined(ESP8266) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) +String toString(uint64_t input) { + String result = ""; + uint8_t base = 10; + + do { + char c = input % base; + input /= base; + + if (c < 10) + c += '0'; + else + c += 'A' - 10; + result = c + result; + } while (input); + return result; +} + +# else + +String toString(uint32_t input) { + String result = String(input); + + return result; +} +# endif +#endif \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 2eda357..4d97e13 100644 --- a/platformio.ini +++ b/platformio.ini @@ -120,7 +120,7 @@ smartrc-cc1101-driver-lib = SmartRC-CC1101-Driver-Lib@2.5.5 stl = https://github.com/mike-matera/ArduinoSTL.git#7411816 shtc3 = https://github.com/sparkfun/SparkFun_SHTC3_Arduino_Library somfy_remote=Somfy_Remote_Lib@0.3.0 -rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP#38ee89a +rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP#e03f689 emodbus = miq19/eModbus@1.0.0 gfSunInverter = https://github.com/BlackSmith/GFSunInverter.git#v1.0.1 @@ -561,8 +561,11 @@ build_flags = '-DZradioCC1101="CC1101"' '-DZgatewayRTL_433="rtl_433"' '-DGateway_Name="OpenMQTTGateway_rtl_433_ESP"' - '-DRF_RECEIVER_GPIO=4' -; '-DRTL_DEBUG=4' ; enable rtl_433 verbose device decode + '-DRF_RECEIVER_GPIO=4' ; CC1101 - GDO2 + '-DRF_EMITTER_GPIO=2' ; CC1101 - GDO0 + '-DvalueAsASubject=true' ; mqtt topic includes model and device +; '-DPUBLISH_UNPARSED=true' ; Publish details of undecoded signals +; '-DRTL_DEBUG=4' ; enable rtl_433 verbose device decode [env:esp32dev-multi_receiver] platform = ${com.esp32_platform} @@ -585,6 +588,7 @@ build_flags = '-DGateway_Name="OpenMQTTGateway_multi_receiver"' '-DRF_RECEIVER_GPIO=4' ; CC1101 - GDO2 '-DRF_EMITTER_GPIO=2' ; CC1101 - GDO0 + '-DvalueAsASubject=true' ; mqtt topic includes model and device (rtl_433) or protocol and id ( RF and PiLight ) ; '-DDEFAULT_RECEIVER=1' ; Default receiver to enable on startup [env:ttgo-lora32-v1]