@treb0r said:
I am trying to add also 433 receiver to allow domoticz update states of the switches is the Socket is switched on or off by remote control. Does anybody know how to do that? After receiving certain code change the state of the corresponding socket.
treb0r
Im an just trying to do this (also with domoticz)
Here is my first try of the function using RCSwitch.h:
/****************************************
* Analyse the Radio traffic and set the states
****************************************/
void readRadio()
{
if (mySwitch.available())
{
int value = mySwitch.getReceivedValue();
if (value == 0)
{
#ifdef DEBUG
Serial.print("Unknown encoding");
#endif
}
else
{
led(false,4,150);
#ifdef DEBUG
Serial.print("Received ");
Serial.print( mySwitch.getReceivedValue() );
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protocol: ");
Serial.println( mySwitch.getReceivedProtocol() );
#endif
if (value == 4373) //Stehlampe ON
{
#ifdef DEBUG
Serial.println("Stehlampe ON detected");
#endif
}
else if (value == 4372 ) //Stehlampe OFF
{
#ifdef DEBUG
Serial.println("Stehlampe OFF detected");
#endif
resend((msgLight1.set(0)),m_repeat);
}
else if (value == 1048597 ) //Vitrine ON
{
#ifdef DEBUG
Serial.println("Vitrine ON detected");
#endif
resend((msgLight2.set(1)),m_repeat);
}
else if (value == 1048596 ) //Vitrine OFF
{
#ifdef DEBUG
Serial.println("Vitrine OFF detected");
#endif
resend((msgLight2.set(0)),m_repeat);
}
mySwitch.resetAvailable();
}
}
}