From 91ffe4d1af37e0b9dcacea3d01f3e88cfb2ea3cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Wed, 27 Dec 2017 11:03:28 +0100 Subject: [PATCH] Match MQTT rfout codes to switches --- code/espurna/rfbridge.ino | 83 ++++++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/code/espurna/rfbridge.ino b/code/espurna/rfbridge.ino index 2c281973..9af59322 100644 --- a/code/espurna/rfbridge.ino +++ b/code/espurna/rfbridge.ino @@ -112,6 +112,42 @@ void _rfbSend(byte * message, int times) { } +bool _rfbMatch(char * code, unsigned char& relayID, unsigned char& value) { + + if (strlen(code) != 18) return false; + + bool found = false; + String compareto = String(&code[12]); + compareto.toUpperCase(); + DEBUG_MSG_P(PSTR("[RFBRIDGE] Trying to match code %s\n"), compareto.c_str()); + + for (unsigned char i=0; i