From 2d650061ff7ab00e8a47d67eb33d68143e0e5ad9 Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 8 Apr 2023 09:39:10 +0200 Subject: [PATCH] Update Kaarsen.ino --- Kaarsen.ino | 61 ++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/Kaarsen.ino b/Kaarsen.ino index b8e0554..38347a5 100644 --- a/Kaarsen.ino +++ b/Kaarsen.ino @@ -72,6 +72,10 @@ RCSwitch mySwitch = RCSwitch(); #define CANDLES_CHILD_ID 5 #define LED_CHILD_ID 6 +#define HAARD_CHILD_ID 7 + + + #define MY_RAWBUF 50 const char * TYPE2STRING[] = { "UNKONWN", @@ -206,6 +210,7 @@ void presentation () present(CHILD_ID, S_IR); present(CANDLES_CHILD_ID, S_LIGHT); present(LED_CHILD_ID, S_LIGHT); + present(HAARD_CHILD_ID, S_LIGHT); } @@ -310,6 +315,29 @@ void receive(const MyMessage &message) { } } + } + + //Message of type V_LIGHT ? + if (message.type==V_LIGHT) + { + //Lamp 1 + if (message.sensor==HAARD_CHILD_ID) + { + if(message.getBool()==1) + { + Serial.println(" --> HAARD ON"); + IrSender.sendNEC(0x0, 0x81, 5); + } + else + { + Serial.println(" --> HAARD OFF"); + IrSender.sendNEC(0x0, 0x81, 5); + } + + } + + + } /* @@ -456,39 +484,6 @@ void sendRCCode(byte index) { else if (pIr->code.type == SONY) { irsend.sendSony(pIr->code.value, pIr->code.len); } - else if (pIr->code.type == PANASONIC) { - irsend.sendPanasonic(pIr->code.address, pIr->code.value); - Serial.print(AddrTxt); - Serial.println(pIr->code.address, HEX); - } - else if (pIr->code.type == JVC) { - irsend.sendJVC(pIr->code.value, pIr->code.len, false); - } - else if (pIr->code.type == SAMSUNG) { - irsend.sendSAMSUNG(pIr->code.value, pIr->code.len); - } - else if (pIr->code.type == WHYNTER) { - irsend.sendWhynter(pIr->code.value, pIr->code.len); - } - else if (pIr->code.type == AIWA_RC_T501) { - irsend.sendAiwaRCT501(pIr->code.value); - } - else if (pIr->code.type == LG || pIr->code.type == SANYO || pIr->code.type == MITSUBISHI) { - Serial.println(NATxt); - return; - } - else if (pIr->code.type == DISH) { - // need to repeat the command 4 times with 100 mS pause - for (byte i=0; i < 4; i++) { - if (i > 0) { delay(100); } - irsend.sendDISH(pIr->code.value, pIr->code.len); - } - } - else if (pIr->code.type == SHARP) { - irsend.sendSharp(pIr->code.address, pIr->code.value); - Serial.print(AddrTxt); - Serial.println(pIr->code.address, HEX); - } else if (pIr->code.type == DENON) { irsend.sendDenon(pIr->code.value, pIr->code.len); }