From 7f542c834746e229e284f55bcb5141693c0c4adf Mon Sep 17 00:00:00 2001 From: peshovec Date: Sat, 8 Mar 2025 00:48:15 +0200 Subject: [PATCH] [RF] ZgatewatPilight: toggle RawEnabled only if Pilight is active receiver (#2159) --- docs/use/rf.md | 5 ++++- main/ZgatewayPilight.ino | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/use/rf.md b/docs/use/rf.md index 54a892b..560a3a4 100644 --- a/docs/use/rf.md +++ b/docs/use/rf.md @@ -230,7 +230,10 @@ Generate your RF signals by pressing a remote button or other and you will see : #### Enabling RAW packet return support First, you need to compile a binary with `Pilight_rawEnabled true` uncommented in config_RF.h. -Once the device is online, you can turn on the RAW packet return support with the following MQTT command: +Once the device is online and the active receiver is Pilght, you can toggle raw packet return. +If current active receiver is not Pilight the toggle command will be ignored and harmless error message will be published. + +You can turn on the RAW packet return support with the following MQTT command: `mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTtoPilight/protocols" -m '{"rawEnabled":true}'` diff --git a/main/ZgatewayPilight.ino b/main/ZgatewayPilight.ino index b2329d9..1828858 100644 --- a/main/ZgatewayPilight.ino +++ b/main/ZgatewayPilight.ino @@ -182,10 +182,12 @@ void XtoPilight(const char* topicOri, JsonObject& Pilightdata) { if (Pilightdata.containsKey("rawEnabled")) { Log.notice(F("Setting PiLight raw output enabled: %T" CR), (bool)Pilightdata["rawEnabled"]); pilightRawEnabled = (bool)Pilightdata["rawEnabled"]; - disablePilightReceive(); - delay(1); - enablePilightReceive(); - success = true; + if (currentReceiver == ACTIVE_PILIGHT) { + disablePilightReceive(); + delay(1); + enablePilightReceive(); + success = true; + } } # endif