KaKu Bridge ( Klik-aan Klik-uit )

Introduction: KaKu Bridge ( Klik-aan Klik-uit )

This KakuBridge is a very cheap (< $8 ) and very simple to build domotica system for Klik-aan Klik-uit devices, (CoCo). You can control up to 9 devices via a remote control on a webpage. Moreover with the KakuBridge you can schedule each device. For instance switch on 10 minutes after sunset, switch off 10 minutes before sunrise. All together this is a fairly complete domotica system for Klik-aan Klik-uit devices.

A summary of the possibilities:

  • Simple to connect to wifi via a wifi config portal.
  • All settings can be done via its webpages.
  • Registering of remotes easely via webinterface.
  • Control up to 9 Kaku ( CoCo ) devices via one virtual remote.
  • User defined number of buttons on the virtual remote.
  • The user can grant labels to the buttons..
  • Software can be updated over the air.
  • Can completely work alone but also works with domoticz via usb, http or mosquitto.
  • For each button on the remote you can set 3 advanced timers to schedule your lamps.

Now you can say goodby to those hardware remotes. Switch with your phone from anywhere, make a schedule for your garden light, connect it with your domotica software, etc.

Supplies

a NodeMCU v3 or Wemos d1 (mini) board ( $2,50 )

a set of an rf433 receiver and transmitter ($1,40 )

6 dupont wires

an usb to micro usb cable (for the power supply)

an USB wallplug power supply

This together you can buy for less than 8 dollar.

Step 1: How Do We Build It

THE HARDWARE

This is not a long story. Simply connect the receiver and the transmitter to the Wemos. See the schematic and the hardware picture. Thats all.

Optional, when you build it in a housing, it can be conveniant to use the external led. This led signals:

  • that the hardwarebutton is long-pressed ( to reboot or wipe the wificredentials)
  • when the AP mode is started (continuously on)
  • when an rf signal is received (short flashes)

The blue onboard LED has the same funtionallity. Also you can connect a tactile pushbutton. With this button you can reboot the Wemos or you can put it in the AP mode. This can be handy when you can't remember its IP address.

THE SOFTWARE

The software comes in 2 languages, Dutch and English.

I made it extremely simple to install the software on your ESP device. Please follow these steps:

  1. Download and unzip the file in a folder on your computer.
  2. Enter this folder and click on Serial_Communicator.exe, the program will start.
  3. Connect the ESP via the usb cable to your computer
  4. You can test now on which com port the ESP is connected.
  5. Read the help text to proceed.

When the software is installed, the blue onboard led wil light up. Now you can proceed to the chapter "how does it work".

serial_communicator
In the download package i included a nice tool to communicate with the ESP through serial. Connect the esp with the usb cable to your windows computer. You can issue all kinds of commands, analize boot information, IP address, analize rf signals, put lamps on and off, etc.


DOWNLOAD.

Update dec 31 2020:

Some issues repaired, (logging, alloff, timers, dimming, cosmetic, mosquitto)

DOWNLOAD KAKUBRIDGE-3_0.zip

Step 2: HOW DOES IT WORK

CONNECT TO WIFI

Once the software is uploaded, the wemos boots and the blue LED is lighted up continuously. This means an accesspoint (AP) is opened where you can connect it to your wifi. Now open the wifi settings on your laptop, phone or tablet. You'l see a netwerk called ESP-123456 or similar. Connect to this network with password 123456789 and browse to 192.168.4.1. Enter your credentials and follow the further instructions. Don't forget to set the adminitrators password. Default this is 000000000. When successfully connected, the ESP will reboot and the led flashes 3 times.

REGISTER A REMOTE

When rebooted you can now visit the homepage of the device. The next thing to do is to register a KaKu remote. Open the menu item "register" click enroll, push an ON- button on your kaku remote, click yes to register.

Now your kaku sockets should listen to the virtual remote. If not, you can learn them to listen. Put a socket in learning mode by putting it into a wall outlet. Now push a button on the virtual remote. This way you can teach up to 9 devices. You can set 3 timers for each button and by combining mutiple devices on one button you can configure more complex switching scenario's. Use your imagination....

CONTROL WITH API

The kakubridge listens to direct commands like "ip-of-kakubridge/SW1=ON" or "ip-of-kakubridge/SW3=OFF"

Step 3: Housing

Since i own a 3d printer i can design a housing with a 3d drawing program. And print it of course. I am still working on a design that i will make available on this platform.

For those who not own a printer, a piece of mdf and some hotglue to fix the components would be enough. Normally you place this device somewhere central to you devices, For instance upon the cupboard where it will be out of sight.

Step 4: TROUBLESHOOTING

In my home this device works flawlessly. If you however run into trouble i am willing to help of course.

First check if you have the latest softwareversion installed and upgrade if not.

If that doesn't help , please provide an understandable description of the problem, Check the serial monitor and the statuspage for debug information.

Problem: you cannot register your kaku remote control.

Check if the blue onboard led flashes when you press a button on the physical remote.

If not, check your receiver.

Check in the status page if there are files present. You should always see "wificonfig.json".

In the AP modus you can wipe and format the filesystem. For brand new ESP devices this can be usefull.

Connect to a serial monitor (Arduino IDE) to see tons of debug information.

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Organization Contest

      Organization Contest
    • Reclaimed Materials Contest

      Reclaimed Materials Contest

    21 Comments

    0
    joosterhoff
    joosterhoff

    10 months ago on Step 1

    I've updated the firmware to the 12 dec version via OTA. After changing the protocol names to capitals it is possible to send a switch on command via domoticz and the light turns on. But in domoticz i receive a time out and domoticz thinks the light is still off.
    The problem then is that i can't switch the light off anymore. When i look to the mqtt settings in the RFLink it looks like the mosquito option is not enabled. After enabeling and refreshing the page the option is disabled again.

    0
    hansiart
    hansiart

    Reply 10 months ago

    I solved the domoticz issue, the problem was that the KAKUBRIDGE didn't report back after sending the command. Its working now again.
    I tested again with mqtt, cannot find problems.
    The mqtt tries to connect serveral times but when not succeeded it drops the mqtt Enabled variable. So it wouldn't keep trying to connect with possible wrong settings. You have to carefully check if the broker exists and the topic exists. You have to install mqtt on your RPI first.

    log.jpg
    0
    joosterhoff
    joosterhoff

    Reply 10 months ago

    Thanks. Tested the dim function and it's working fine now!

    0
    hansiart
    hansiart

    Reply 11 months ago

    You can use the "serial communicater app" that i included in the latest software release to analyze the rf dimming signals. You can send (dimming) commands via the serial communicater, If that works than domoticz can too. If you send me an example of the format his dimming signal has (eg. NewKaku;F2345E;1;??? ) i can investigate how we could make that work.

    As for messages, yes, the kakubridge sends mqtt messages that domoticz can receive. You can google how. Also via serial messages are send, like 20;OK, watch this with the serial communicator..

    0
    hansiart
    hansiart

    Reply 11 months ago

    You probably can see what is send by domoticz in its log. What is received you can see in the statuspage of the Kakubridge (last task via serial).

    When you put it in learning mode you can catch the received rf signal when you use the fysical dim button. What does this look like?
    I don't have a dimmer myself...

    0
    joosterhoff
    joosterhoff

    Reply 11 months ago

    Domoticz log only shows me i did an action. I don't see wat domoticz has send.
    I have made a second nodemcu to receive the messages and setup my old domotica system (pimatic) where dimmer function worked.
    When sending dim percentage from pimatic to the kaku dimmer it is responding correct and the light goes directly to the desired percentage.
    The messages i captured via the nodemcu are:
    20;0E;NewKaku;ID=74CBB1;SWITCH=1;CMD=OFF; (at 1%)
    20;0F;NewKaku;ID=74CBB1;SWITCH=1;CMD=OFF; (at 45%)
    20;10;NewKaku;ID=74CBB1;SWITCH=1;CMD=OFF; (at 78%)
    20;11;NewKaku;ID=74CBB1;SWITCH=1;CMD=OFF; (at 100%)

    0
    hansiart
    hansiart

    Reply 11 months ago

    This what my domoticz dimmer seems to send :
    2020-11-06 09:17:52.173 Status: Incoming connection from: 192.168.0.201
    2020-11-06 09:18:05.197 Status: User: Admin initiated a switch command (844/DIMMER/Set Level)
    2020-11-06 09:18:05.198 Status: RFLink Sending: 10;NewKaku;2dfe55e;1;3
    Your observations are correct, when the last part of the command (the "3") is not "ON", "ALLON" or "ALLOFF", it is treated as an OFF command. So this newkaku library (i borrowed from the internet) cannot send dimming commands currently.

    I think i can adapt it in such way that when there is a value from 0-14, it sends extra dim bits, but i have no clou what they should look like. Therefor i have to improve the serial communicator and the kakubridge so that more debuginformation can be gathered. I come back to you when i have results.

    0
    joosterhoff
    joosterhoff

    Reply 11 months ago

    Thank you for looking into it.
    I've another question. I'm trying to connect my kaku doorbell to domoticz.
    I don't understand very well what is happening.
    I've "learned" the switch in the nodemcu.
    When i push learn switch in domoticz i get a time out.
    Same is happening with a kaku remote.
    But when i push the learn switch in domoticz and give a "on" command from one of my existing switches in domoticz it comes with the message: already in use by .....
    The messages copied from serial monitor in arduino (can't copy from serial communicator):
    rf received Fri Nov 6 18:26:13 2020
    * * * * * * * * * * * * *
    RFlink_data : 20;01;NewKaku;ID=20D28CE;SWITCH=1;CMD=ALLON;
    * * * * * * * * * * * * *
    Send via MQTT: Topic: domoticz/received/NewKaku/20D28CE Payload: {"SWITCH":1,"CMD":"ALLON"}
    History_CurrentEvent = 1
    FetchSignal: a known rf signal has been received: 20;01;NewKaku;ID=20D28CE;SWITCH=1;CMD=ALLON;
    on received signal: device 0 Switched off
    rf received Fri Nov 6 18:26:15 2020
    * * * * * * * * * * * * *
    RFlink_data : 20;02;NewKaku;ID=20D28CE;SWITCH=1;CMD=ALLON;
    * * * * * * * * * * * * *
    Send via MQTT: Topic: domoticz/received/NewKaku/20D28CE Payload: {"SWITCH":1,"CMD":"ALLON"}
    History_CurrentEvent = 2
    FetchSignal: a known rf signal has been received: 20;02;NewKaku;ID=20D28CE;SWITCH=1;CMD=ALLON;
    on received signal: device 0 Switched off

    In domoticz log i don't see any response when pressing the button.

    0
    hansiart
    hansiart

    Reply 11 months ago

    What should happen is that wen you click a fysical remote, (or otherwise a known rf transmission is received) the kakubridge sends a message via serial like "20;12;NewKaku;e12345f;1;ON". Domoticz uses this message to register a switch, unless it's already there. I changed this message for better human readability in the serial monitor but there it went wrong.

    Here is a link to a beta version that solves that problem. Learning a switch in domoticz works now. It also spits out more debug information. Included is a slightly improved version of the serial_communicator. Maybe it helps to tackle your doorbel and dimmer problem.
    https://1drv.ms/u/s!AkMG5FvUwhediUnShj1DtYBeJ7pm?e...

    if you install this with the "fw update" option in the menu, this works very smooth and you'l keep the settings in your kakubridge.

    0
    joosterhoff
    joosterhoff

    Reply 11 months ago

    Learning switches (including my doorbell) is working fine now.
    Wat i see in the new serial_communicator when sending a dim command is this:

    FetchSignal catched a valid signal, returning true
    RawSignal.ino fetchSignal() values:
    RawSignal.Mean = 545
    RawSignal.Number = 149
    we are in RFL_Protocols.h bool Decode(), Learning_Mode = 0
    doing RF_Decode in RFL_Protocol_Start.h
    RF_Decode command starts with On_Off OFF
    when do we come here ?RFLink_File.Known_Devices = NewKaku;ID=20D28CE;FetchSignal: an unknown rf signal has been received
    FetchSignal catched a valid signal, returning true
    RawSignal.ino fetchSignal() values:
    RawSignal.Mean = 545
    RawSignal.Number = 149
    we are in RFL_Protocols.h bool Decode(), Learning_Mode = 0
    doing RF_Decode in RFL_Protocol_Start.h
    RF_Decode command starts with On_Off OFF
    when do we come here ?RFLink_File.Known_Devices = NewKaku;ID=20D28CE;FetchSignal: an unknown rf signal has been received
    FetchSignal catched a valid signal, returning true
    RawSignal.ino fetchSignal() values:
    RawSignal.Mean = 545
    RawSignal.Number = 149
    we are in RFL_Protocols.h bool Decode(), Learning_Mode = 0
    doing RF_Decode in RFL_Protocol_Start.h
    RF_Decode command starts with On_Off OFF
    when do we come here ?RFLink_File.Known_Devices = NewKaku;ID=20D28CE;FetchSignal: an rf signal has been received:
    20;0D;NewKaku;ID=20D28CE;SWITCH=1;CMD=ALLON;
    on received signal: device 0 Switched off

    I have also a problem with the sunscreen. When i send the open command all my devices go on (allon) and my sunscreen is moving out. I can stop the sunscreen by sending the on command again but getting it moving in is not possible. This are te captured messages in serial_communicator:
    FetchSignal catched a valid signal, returning true
    RawSignal.ino fetchSignal() values:
    RawSignal.Mean = 469
    RawSignal.Number = 133
    we are in RFL_Protocols.h bool Decode(), Learning_Mode = 0
    doing RF_Decode in RFL_Protocol_Start.h
    RF_Decode command starts with On_Off OFF
    when do we come here ?RFLink_File.Known_Devices = NewKaku;ID=20D28CE;FetchSignal: an unknown rf signal has been received
    FetchSignal catched a valid signal, returning true
    RawSignal.ino fetchSignal() values:
    RawSignal.Mean = 469
    RawSignal.Number = 133
    we are in RFL_Protocols.h bool Decode(), Learning_Mode = 0
    doing RF_Decode in RFL_Protocol_Start.h
    RF_Decode command starts with On_Off OFF
    when do we come here ?RFLink_File.Known_Devices = NewKaku;ID=20D28CE;FetchSignal: an rf signal has been received:
    20;0D;NewKaku;ID=20D28CE;SWITCH=1;CMD=ALLON;
    on received signal: device 0 Switched off

    0
    hansiart
    hansiart

    Reply 11 months ago

    I am almost done getting the dimmercommands to work. In the mean time i have a request: Would you be so kind to remove all your comments to this project? It's only unnecessary reading for others and might scare them off, thinking that there a lot of issues involved. Thanks in advance.

    0
    joosterhoff
    joosterhoff

    Question 11 months ago

    I have the system up and running now. While putting the ESP in learning mode it receives code NewKaku;ID=12EC3FE; but after clicking Yes nothing shows up and my devices list is empty. Arduino serial monitor says:
    rf received Mon Oct 26 21:30:09 2020
    * * * * * * * * * * * * *
    RFlink_data : 20;05;NewKaku;ID=12EC3FE;SWITCH=1;CMD=ON;
    * * * * * * * * * * * * *
    History_CurrentEvent = 5
    er is een bekend rf signaal ontvangen20;05;NewKaku;ID=12EC3FE;SWITCH=1;CMD=ON;
    substrings zijn : 1 ON
    going to save the signaal

    0
    hansiart
    hansiart

    Answer 11 months ago

    Hi Joosterhoff, sorry to hear that, so far i had no issues while testing this process. What board do you use, Did you save any other settings and do you see any files in the information page?

    0
    joosterhoff
    joosterhoff

    Reply 11 months ago

    Board type: NodeMCU 0.9 ESP-12 Module. The problem occurs direct after flashing. After that i changed IP adres to Fixed IP and configured the mqtt broker. But before that it was also not working. What do you mean by files in the info page?

    0
    hansiart
    hansiart

    Reply 11 months ago

    When you go to the status page, you'l see the contents of the filesystem. A file RFLink.txt should be present. If other files are there and not RFLink.txt then have no clou of what happened.

    In the AP mode you can wipe and format the filesystem, maybe that could help. Disconnect from the power and reconnect sometimes helps too after flashing.

    I published a new version with extended timers, maybe you can try that one. You can now enter your kaku protocol manually. I tested this extensive so i am 100% sure that it works. Good luck.

    0
    joosterhoff
    joosterhoff

    Reply 11 months ago

    contents of filesystem :

    contents RFLink.txtno devices registered

    In the new version a added manualy: NewKaku;ID=12EC3FE; but after applying no devices appear.

    Could it be something with the type of kaku? i'm trying with the APA3-1500R

    0
    hansiart
    hansiart

    Reply 11 months ago

    Oke, can you see the main page with the buttons? See image
    -if so, what happens in the serial log when you push a button?

    In the status page, is there a file RFLink.txt?
    - if not, are there any other files?
    - if so, you can also see the contents. What is in the file?

    I am trying to find out if this is a file system problem, Did you try to erase and format the filesystem of your board.
    I noticed that your kaku id has 7 characters, (mine has 6) and that was not correctly handled but i solve that already. I replaced the downloadfile with a new version that handles your protocol correctly.

    home_small.jpg
    0
    joosterhoff
    joosterhoff

    Reply 11 months ago

    Ok. Some progress. After updating with your last version it is possible to manualy add switches. After adding the first one i'm seeing the remote for the first time and i can switch the socket on and off (it is not responding very quickly but it's responding). But it is now not working to "learn" new switch codes from my fysical remote. After putting the ESP in learning mode i see the blue led blinking after sending my remote command but nothing appears in the register devices page.

    I don't have a big problem with this. I make some new ID's and learn my sockets it's second remote.

    Now i have to find out how i can use this in domoticz (new for me).