From 04d7a205d16092094dc48f22702aa921b14b9638 Mon Sep 17 00:00:00 2001 From: Northern Man <19808920+NorthernMan54@users.noreply.github.com> Date: Wed, 19 Apr 2023 11:58:33 -0400 Subject: [PATCH] Update to version to RTL_433_ESP version 0.2.1 (#1612) * Update to version 0.2.1 * Lint --- main/ZgatewayRTL_433.ino | 13 +++++++++---- platformio.ini | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/main/ZgatewayRTL_433.ino b/main/ZgatewayRTL_433.ino index be1f119..b28e0bd 100644 --- a/main/ZgatewayRTL_433.ino +++ b/main/ZgatewayRTL_433.ino @@ -40,7 +40,7 @@ char messageBuffer[JSON_MSG_BUFFER]; -rtl_433_ESP rtl_433(-1); +rtl_433_ESP rtl_433; # ifdef ZmqttDiscovery SemaphoreHandle_t semaphorecreateOrUpdateDeviceRTL_433; @@ -129,8 +129,14 @@ void launchRTL_433Discovery(bool overrideDiscovery) { DISCOVERY_TRACE_LOG(F("idWoKey %s" CR), idWoKey.c_str()); # if OpenHABDiscovery String value_template = "{{ value_json." + String(parameters[i][0]) + "}}"; + if (strcmp(parameters[i][0], "battery_ok") == 0)) { + value_template = "{{ float(value_json." + String(parameters[i][0]) + ") * 99 + 1 }}"; // https://github.com/merbanan/rtl_433/blob/93f0f30c28cfb6b82b8cc3753415b01a85bee91d/examples/rtl_433_mqtt_hass.py#L187 + } # else String value_template = "{{ value_json." + String(parameters[i][0]) + " | is_defined }}"; + if (strcmp(parameters[i][0], "battery_ok") == 0) { + value_template = "{{ float(value_json." + String(parameters[i][0]) + ") * 99 + 1 | is_defined }}"; // https://github.com/merbanan/rtl_433/blob/93f0f30c28cfb6b82b8cc3753415b01a85bee91d/examples/rtl_433_mqtt_hass.py#L187 + } # endif String topic = subjectRTL_433toMQTT; # if valueAsATopic @@ -314,7 +320,7 @@ extern void MQTTtoRTL_433(char* topicOri, JsonObject& RTLdata) { } if (RTLdata.containsKey("status")) { Log.notice(F("RTL_433 get status:" CR)); - rtl_433.getStatus(1); + rtl_433.getStatus(); success = true; } if (success) { @@ -340,12 +346,11 @@ extern void enableRTLreceive() { # endif rtl_433.initReceiver(RF_MODULE_RECEIVER_GPIO, receiveMhz); - rtl_433.enableReceiver(RF_MODULE_RECEIVER_GPIO); + rtl_433.enableReceiver(); } extern void disableRTLreceive() { Log.trace(F("disableRTLreceive" CR)); - rtl_433.enableReceiver(-1); rtl_433.disableReceiver(); } diff --git a/platformio.ini b/platformio.ini index 18148a1..adf3c95 100644 --- a/platformio.ini +++ b/platformio.ini @@ -150,7 +150,7 @@ smartrc-cc1101-driver-lib = SmartRC-CC1101-Driver-Lib@2.5.7 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.git#v0.1.9 +rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP.git#v0.2.1 emodbus = miq19/eModbus@1.0.0 gfSunInverter = https://github.com/BlackSmith/GFSunInverter.git#v1.0.1 decoder = https://github.com/theengs/decoder.git