ability to repeat signal

#27
This commit is contained in:
1technophile committed 2017-05-20 14:29:16 +02:00
1 parent 76ed1eae4f
commit 4d04780553
3 files changed
+14 -5

No files matched your search

+2
View File
@@ -79,6 +79,7 @@ const byte subnet[] = { 255, 255, 255, 0 }; //ip adress
#define subjectRFtoMQTTbits "home/433toMQTT/bits"
#define subjectRFtoMQTTlength "home/433toMQTT/length"
#define RFprotocolKey "433_" // protocol will be defined if a subject contains RFprotocolKey followed by a value of 1 digit
#define repeatRFwMQTT true // do we repeat a received signal by using mqtt
/*
RF supported protocols
433_1
@@ -103,6 +104,7 @@ RF supported protocols
#define subjectMultiGTWIR "+/IRtoMQTT"
#define IRbitsKey "BITS_" // bits will be defined if a subject contains IRbitsKey followed by a value of 2 digits
#define IRRptKey "RPT_" // repeats will be defined if a subject contains IRRptKey followed by a value of 1 digit
#define repeatIRwMQTT true // do we repeat a received signal by using mqtt
#define pubIRunknownPrtcl false // key to avoid mqtt publication of unknown IR protocol (set to true if you want to publish unknown protocol)
+5 -1
View File
@@ -67,6 +67,10 @@ boolean IRtoMQTT(){
String value = String(MQTTvalue);
trc(value);
boolean result = client.publish(subjectIRtoMQTT,(char *)value.c_str());
if (repeatIRwMQTT){
trc(F("Publishing IR signal so as to make the gateway(s) repeat it"));
client.publish(subjectMQTTtoIR,(char *)value.c_str());
}
return result;
}
}
@@ -224,7 +228,7 @@ void MQTTtoIR(char * topicOri, char * datacallback) {
signalSent = true;
}
#endif
if (signalSent){
if (signalSent){ // we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also
boolean result = client.publish(subjectGTWIRtoMQTT, datacallback);
if (result){
trc(F("Signal below sent by IR and acknowledgment published"));
+7 -4
View File
@@ -27,8 +27,7 @@ CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT
RCSwitch mySwitch = RCSwitch();
void setupRF()
{
void setupRF(){
//RF init parameters
mySwitch.enableTransmit(RF_EMITTER_PIN);
@@ -59,6 +58,10 @@ boolean RFtoMQTT(){
String value = String(MQTTvalue);
trc(value);
boolean result = client.publish(subjectRFtoMQTT,(char *)value.c_str());
if (repeatRFwMQTT){
trc(F("Publishing IR signal so as to make the gateway(s) repeat it"));
client.publish(subjectMQTTtoRF,(char *)value.c_str());
}
return result;
}
}
@@ -106,8 +109,8 @@ void MQTTtoRF(char * topicOri, char * datacallback) {
trc(String(valuePLSL));
mySwitch.setProtocol(valuePRT,valuePLSL);
mySwitch.send(data, 24);
// Acknowledgement to the GTWRF topic
boolean result = client.publish(subjectGTWRFtoMQTT, datacallback);
// Acknowledgement to the GTWRF topic
boolean result = client.publish(subjectGTWRFtoMQTT, datacallback);// we acknowledge the sending by publishing the value to an acknowledgement topic, for the moment even if it is a signal repetition we acknowledge also
if (result){
trc(F("Signal below sent by RF and acknowledgment published"));
trc(String(data));