From cbbb929c70f188fff24e9ab8bbdc9a537ddf924a Mon Sep 17 00:00:00 2001 From: Northern Man <19808920+NorthernMan54@users.noreply.github.com> Date: Thu, 8 Jun 2023 09:40:38 -0400 Subject: [PATCH] [RF] rtl_433_ESP to version 0.3.0 (#1668) Update to rtl_433_ESP 0.3.0 Resolves issue with sx127x chipset and receiving higher frequencies Includes support for receiving FSK signals, requires compiler directive OOK_MODULATION=false to switch to FSK mode Adds unit of measure for rtl_433/battery_ok devices RTL_433_ESP Battery Auto Discovery Missing Unit of Measurement #1644 Updates value template for rtl_433/battery_ok in openHab mode Resolves out of stack space crash lilygo-rtl_433 crash after chacon remote control button pressed #1655 --- main/ZgatewayRTL_433.ino | 6 +++++- main/ZwebUI.ino | 7 +++++++ main/config_RF.h | 2 +- platformio.ini | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/main/ZgatewayRTL_433.ino b/main/ZgatewayRTL_433.ino index 8497547381..8da77d2b4c 100644 --- a/main/ZgatewayRTL_433.ino +++ b/main/ZgatewayRTL_433.ino @@ -129,7 +129,11 @@ void launchRTL_433Discovery(bool overrideDiscovery) { DISCOVERY_TRACE_LOG(F("idWoKey %s" CR), idWoKey.c_str()); 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 + if (OpenHABDisc) { + value_template = "{{ value_json." + String(parameters[i][0]) + " * 99 + 1 }}"; // https://github.com/merbanan/rtl_433/blob/93f0f30c28cfb6b82b8cc3753415b01a85bee91d/examples/rtl_433_mqtt_hass.py#L187 + } else { + 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 + } } String topic = subjectRTL_433toMQTT; # if valueAsATopic diff --git a/main/ZwebUI.ino b/main/ZwebUI.ino index 8268cbf234..fe06912cd3 100644 --- a/main/ZwebUI.ino +++ b/main/ZwebUI.ino @@ -1533,6 +1533,13 @@ void webUIPubPrint(const char* topicori, JsonObject& data) { } } + float moisture = data["moisture"]; + if (data.containsKey("moisture") && moisture <= 100 && moisture >= 0) { + char moist[5]; + dtostrf(moisture, 3, 1, moist); + line3 += "moist: " + (String)moist + "% "; + } + line3.toCharArray(message->line3, WEBUI_TEXT_WIDTH); // Line 4 diff --git a/main/config_RF.h b/main/config_RF.h index e89f6965c2..c1668b091e 100644 --- a/main/config_RF.h +++ b/main/config_RF.h @@ -90,7 +90,7 @@ const char parameters[40][4][24] = { {"temperature_2_C", "temperature", "°C", "temperature"}, {"temperature_F", "temperature", "°F", "temperature"}, {"time", "timestamp", "", "timestamp"}, - {"battery_ok", "battery", "", "battery"}, + {"battery_ok", "battery", "%", "battery"}, {"humidity", "humidity", "%", "humidity"}, {"moisture", "moisture", "%", "humidity"}, {"pressure_hPa", "pressure", "hPa", "pressure"}, diff --git a/platformio.ini b/platformio.ini index 655bb50cbd..46dfa97fd4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -148,7 +148,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.2.1 +rtl_433_ESP = https://github.com/NorthernMan54/rtl_433_ESP.git#v0.3.0 emodbus = miq19/eModbus@1.0.0 gfSunInverter = https://github.com/BlackSmith/GFSunInverter.git#v1.0.1 decoder = https://github.com/theengs/decoder.git