From 40152d6a02e6d2ca5dde96ee1f0c5597eb747b9c Mon Sep 17 00:00:00 2001 From: Jon Date: Sun, 19 Jul 2020 20:29:49 +0900 Subject: [PATCH] Rf receive only (#701) * Disable RF transmit * Added definition example (commented out) Co-authored-by: Jonathan Michael Wells --- docs/use/rf.md | 6 ++++++ main/ZgatewayRF.ino | 4 ++++ main/config_RF.h | 1 + 3 files changed, 11 insertions(+) diff --git a/docs/use/rf.md b/docs/use/rf.md index 8da5641..2373448 100644 --- a/docs/use/rf.md +++ b/docs/use/rf.md @@ -15,6 +15,12 @@ Generate your RF signals by pressing a remote button or other and you should see `home/OpenMQTTGateway/433toMQTT {"value":1315156,"protocol":1,"length":24,"delay":317}` +### Disabling Transmit function to safe a PIN + +To disable transmit functions to allow the use of another pin, add the following to the config_rf.h file : + +`#define RF_DISABLE_TRANSMIT` + ### Send data by MQTT to convert it on RF signal `mosquitto_pub -t "home/OpenMQTTGateway/commands/MQTTto433" -m '{"value":1315156}'` diff --git a/main/ZgatewayRF.ino b/main/ZgatewayRF.ino index 37b3e16..28096a4 100644 --- a/main/ZgatewayRF.ino +++ b/main/ZgatewayRF.ino @@ -63,7 +63,11 @@ void setupRF() { ELECHOUSE_cc1101.setMHZ(CC1101_FREQUENCY); ELECHOUSE_cc1101.SetRx(CC1101_FREQUENCY); # endif +# ifdef RF_DISABLE_TRANSMIT + mySwitch.disableTransmit(); +# else mySwitch.enableTransmit(RF_EMITTER_GPIO); +# endif mySwitch.setRepeatTransmit(RF_EMITTER_REPEAT); mySwitch.enableReceive(RF_RECEIVER_GPIO); Log.trace(F("ZgatewayRF setup done" CR)); diff --git a/main/config_RF.h b/main/config_RF.h index 6e1d93d..b589537 100644 --- a/main/config_RF.h +++ b/main/config_RF.h @@ -60,6 +60,7 @@ extern void MQTTtoPilight(char* topicOri, JsonObject& RFdata); #define subjectMultiGTWRF "+/+/433toMQTT" //RF number of signal repetition - Can be overridden by specifying "repeat" in a JSON message. #define RF_EMITTER_REPEAT 20 +//#define RF_DISABLE_TRANSMIT //Uncomment this line to disable RF transmissions. (RF Receive will work as normal.) /*-------------------RF2 topics & parameters----------------------*/ //433Mhz newremoteswitch MQTT Subjects and keys