Go Down

Topic: Control Livolo switches / Livolo switch library (Read 135038 times) previous topic - next topic

Cleverhouse

Fussion of Livolo lib and Livolo recieve code here: https://goo.gl/nzwYCH

joevpt

#166
Aug 24, 2017, 03:35 pm Last Edit: Aug 24, 2017, 04:06 pm by joevpt
Hi,

How did you manage to set the light to on and off? I don't understand. Please advise. Thanks.
I'm working on this now,  but the simple way to get On and Off to work, is to use a scene.  When you put the Livolo switch into learn mode (hold the button for 5 seconds or so), and set the button to the desired state (On or Off), then if you send a scene code from a remote, then switch will go to that state.  You have four scenes available for each switch, so use one of them for ON (and another for OFF if you need to).

In my case, I use a different RemoteID for eah room.  The All Off code switches off the lamp for me in that room, and now Scene 1 turns on the lamp for me in that room. Using the other scenes is not essential for me as I want to be able to turn ON or turn OFF the lamp (not toggle it).

Thanks to the guys who bought the remotes for posting the scene codes.

[ By the way, the scene codes listed above are not valid for the four button remotes. The codes in the four button remotes are A=8, B=16, C=56 and D=42 (All OFF) ]

GoGs99

Hello, thanks for the code. it work perfect...
just little change code with about delay...
If get error, it will go for next  read.

Code: [Select]

#define SIGNAL_IN 0 // INTERRUPT 0 = DIGITAL PIN 2 - use the interrupt number in attachInterrupt

volatile byte impulse = 0; // kolejny puls
volatile int bufor[53];
volatile boolean header = false;
volatile unsigned long StartPeriod = 0; // set in the interrupt
volatile boolean stop_ints = false;


void setup()
{
 attachInterrupt(SIGNAL_IN, calcInput, CHANGE);

 Serial.begin(9600);
}

void loop()
{
 if (stop_ints) //data in buffer
 {
   unsigned long binary = 1;
   //byte i = 0;
   for (byte j = 0; j < 46; j++)
   {
     //Serial.print(binary);
     if ((bufor[j] > 220) &&
         (bufor[j] < 400))
     {
       binary <<= 1;
       //binary |= 1;
       //i++;
       bitSet(binary,0);
     }
     else if ((bufor[j] > 90) &&
              (bufor[j] < 220) && (bufor[j + 1] > 90) &&
              (bufor[j + 1] < 220)) {
       binary <<= 1;
       j++;
       
     }
     else if ((bufor[j] > 90) &&
              (bufor[j] < 220) && (bufor[j + 1] > 220) &&
              (bufor[j + 1] < 400)) {
       binary <<= 1;
       bitSet(binary,0);
       //i += 2;
       j++;
     }
     else break;
         }
         //Serial.println(bitRead(binary,4));
   if (bitRead(binary,23))
   {
     bitClear(binary,23);
     Serial.print("remoteID:");
     Serial.print((binary / 128) & 65535);
     Serial.print(" - ");
     Serial.print("key code:");
     Serial.println(binary & 127);
     delay (1000);
   }
   else {
     Serial.println("wrong code  ");
     Serial.println(binary, BIN);
     delay (100);
   }
   
   header = false;
   impulse = 0;
   stop_ints = false;

   // }
 }
}

// interrupt below...


void calcInput()
{
 // get the time using micros
 unsigned int duration = (int)(micros() - StartPeriod); // save pulse length to bufor
 StartPeriod = micros(); //begin next impulse
 //Serial.println(StartPeriod);
 if (stop_ints) return;
 if ((duration < 90) || (duration > 600)) goto reset; //impulse not right
 bufor[impulse++] = duration;
 if (duration < 415) return;
 if (!header)
 {
   header = true;
   impulse = 0;
   return;
 }
 else
 {
   if ((impulse < 23) || (impulse > 52)) goto reset; //too long or too short info
   stop_ints = true;
   return;
 }
reset:
 header = false;
 impulse = 0;
 return;
}

mmib

Hi,


any idea how to work with livolo dimmers? It seems this code working with switches only but dimmers has some different codes.

I have 4 button and 20 buttons transmitters for this dimmers/switches and it work. But arduino code works with switches only.

Maybe someone can point to link to decode RF signal from remote? (need decoder to get id and button key, not just lib to get pulses).

Go Up