Update Kaarsen.ino

This commit is contained in:
Frank 2023-04-08 09:39:10 +02:00
parent fabc23ad7b
commit 2d650061ff

View File

@ -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);
}