65 lines
1.7 KiB
Plaintext
65 lines
1.7 KiB
Plaintext
|
|
// Process commands received from X10 compatible IR remote
|
|
void infraredEvent(char house, byte unit, byte command, bool isRepeat)
|
|
{
|
|
|
|
//Show Status IR icon
|
|
sendCommand("p0.pic=54");
|
|
sendCommand("tm1.en=1");
|
|
|
|
#ifdef DEBUG
|
|
Serial.println("!! IR Received !!");
|
|
#endif
|
|
if (!isRepeat)
|
|
{
|
|
#ifdef DEBUG
|
|
Serial.println(command);
|
|
#endif
|
|
// Handle Address Command (House + Unit)
|
|
if (command == CMD_ADDRESS)
|
|
{
|
|
#ifdef DEBUG
|
|
Serial.println("cmd == CMD_ADDRESS");
|
|
Serial.println(house);
|
|
Serial.println(unit);
|
|
Serial.println(command);
|
|
#endif
|
|
if (unit <= 16)
|
|
{
|
|
#ifdef DEBUG
|
|
Serial.println("Switch...");
|
|
#endif
|
|
if (unit == 1) //Staandelamp
|
|
if(main_btn_staandelamp==0)
|
|
domoticz_send_nvalue(idx_staandelamp, 1);
|
|
else
|
|
domoticz_send_nvalue(idx_staandelamp, 0);
|
|
|
|
if (unit == 2) //Haard
|
|
if(main_btn_haardverlichting==0)
|
|
domoticz_send_nvalue(idx_haardverlichting, 1);
|
|
else
|
|
domoticz_send_nvalue(idx_haardverlichting, 0);
|
|
|
|
if (unit == 4) //Rooster
|
|
if(main_btn_rooster==0)
|
|
domoticz_send_nvalue(idx_rooster, 1);
|
|
else
|
|
domoticz_send_nvalue(idx_rooster, 0);
|
|
|
|
if (unit == 5) //Hanglamp
|
|
if(main_btn_hanglamp==0)
|
|
domoticz_send_nvalue(idx_hanglamp, 1);
|
|
else
|
|
domoticz_send_nvalue(idx_hanglamp, 0);
|
|
|
|
if (unit == 3) //Tuin
|
|
if(main_btn_tuinverlichting==0)
|
|
domoticz_send_nvalue(idx_tuinverlichting, 1);
|
|
else
|
|
domoticz_send_nvalue(idx_tuinverlichting, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|