esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
413 stars 26 forks source link

Support for KlikAnKlikUt (KaKu) RF433 Switches #283

Open bluesheep opened 5 years ago

bluesheep commented 5 years ago

The KaKu range of switches uses a different RF433 protocol from the RemoteSwitch library.

There is a library to support this at https://bitbucket.org/fuzzillogic/433mhzforarduino/wiki/Home

Additional context

OttoWinter commented 5 years ago

FYI, technically already supported through raw remote codes.

bjw-s commented 5 years ago

I've been trying to get this working by using the raw codes, but haven't had any luck yet so far 🙁

After looking at the logs with a remote_receiver component, I have managed to see the codes that are being sent by the original KaKu button. Then, in order to send (e.g.) a group on request I have tried to do the following based on the logic as it is implemented in NewRemoteTransmitter:

# Set up remote transmitter
remote_transmitter:
  pin: 
    number: D9
    mode: OUTPUT
  carrier_duty_percent: 100%

switch:
  - platform: template
    name: Raw Code Power Button
    id: test
    turn_on_action:
      # Start pulse
      - remote_transmitter.transmit_raw:
          code: [3138, -1294, 731, -267, 1739, -1270, 735, -275, 1733, -1282, 722, -1275, 732, -1274, 731, -1278, 728, -278, 1728, -282, 1724, -281, 1726, -286, 1720, -290, 1717, -289, 1718, -1284, 723, -1287, 719, -287, 1719, -292, 1713, -1289, 718, -1287, 720, -1296, 711, -1288, 719, -1294, 712, -1293, 714, -1302, 702, -298, 1712, -298, 1708, -1299, 715, -1298, 709, -1292, 715, -1297, 710, -1296, 715]
      # Address (45878526)
      - remote_transmitter.transmit_raw:
          code: [3090, -1293, 714, -292, 1715, -1293, 714, -300, 1707, -1300, 707, -1309, 697, -1298, 709, -1299, 708, -300, 1707, -304, 1702, -297, 1710, -299, 1704, -304, 1710, -319, 1685, -1301, 706, -1302, 705, -298, 1708, -299, 1708, -1304, 703, -1300, 707, -1300, 705, -1309, 697, -1300, 705, -1303, 704, -1307, 701, -302, 1705, -300, 1707, -1307, 700, -1300, 708, -1304, 702, -1303, 704, -1301, 706]
      - remote_transmitter.transmit_raw:
          code: [3085, -1298, 708, -304, 1704, -1303, 703, -301, 1707, -1303, 704, -1302, 705, -1301, 706, -1303, 704, -299, 1708, -303, 1703, -305, 1702, -304, 1703, -301, 1706, -300, 1707, -1301, 706, -1300, 707, -301, 1706, -302, 1706, -1300, 707, -1299, 707, -1300, 708, -1305, 701, -1301, 706, -1305, 702, -1310, 694, -312, 1697, -310, 1700, -1305, 702, -1307, 699, -1299, 709, -1303, 703, -1302, 706]
      - remote_transmitter.transmit_raw:
          code: [3087, -1306, 700, -300, 1707, -1296, 711, -298, 1709, -1306, 702, -1297, 709, -1302, 706, -1309, 698, -301, 1706, -299, 1709, -307, 1700, -300, 1702, -303, 1707, -304, 1703, -1298, 709, -1297, 711, -299, 1708, -296, 1711, -1314, 694, -1301, 706, -1301, 705, -1298, 709, -1298, 710, -1297, 709, -1302, 705, -300, 1708, -298, 1709, -1304, 703, -1301, 707, -1299, 708, -1300, 707, -1303, 703]
      - remote_transmitter.transmit_raw:
          code: [3083, -1295, 713, -298, 1708, -1296, 711, -293, 1713, -1296, 711, -1295, 713, -1295, 712, -1303, 704, -296, 1712, -294, 1713, -294, 1714, -294, 1712, -295, 1711, -300, 1707, -1302, 705, -1299, 708, -300, 1707, -296, 1711, -1301, 707, -1304, 703, -1296, 711, -1314, 692, -1304, 703, -1306, 698, -1301, 709, -298, 1710, -300, 1707, -1301, 706, -1300, 707, -1298, 709, -1309, 698, -1297, 711]
      - remote_transmitter.transmit_raw:
          code: [3088, -1297, 711, -292, 1710, -1304, 703, -301, 1710, -1295, 712, -1300, 707, -1293, 714, -1300, 707, -296, 1712, -292, 1715, -295, 1712, -293, 1687, -349, 1685, -299, 1708, -1297, 709, -1295, 713, -299, 1708, -297, 1710, -1298, 709, -1296, 711, -1300, 708, -1293, 714, -1311, 697, -1293, 713, -1296, 711, -294, 1713, -296, 1711, -1297, 710, -1293, 715, -1298, 709, -1294, 714, -1294, 712]
      - remote_transmitter.transmit_raw:
          code: [3087, -1290, 717, -291, 1716, -1289, 718, -292, 1715, -1293, 714, -1294, 713, -1293, 714, -1290, 717, -296, 1711, -293, 1714, -292, 1716, -294, 1712, -294, 1713, -293, 1714, -1297, 709, -1293, 715, -290, 1717, -291, 1715, -1296, 712, -1292, 715, -1292, 715, -1292, 715, -1293, 711, -1310, 710, -1289, 710, -294, 1711, -293, 1714, -1294, 714, -1297, 709, -1293, 715, -1292, 716, -1294, 712]
      - remote_transmitter.transmit_raw:
          code: [3087, -1292, 716, -291, 1716, -1289, 718, -290, 1717, -1292, 715, -1291, 716, -1295, 713, -1294, 712, -291, 1716, -295, 1707, -299, 1713, -293, 1713, -292, 1716, -290, 1717, -1295, 712, -1295, 712, -294, 1713, -293, 1714, -1294, 713, -1296, 711, -1293, 714, -1298, 709, -1297, 711, -1294, 712, -1294, 713, -299, 1708, -298, 1709, -1295, 712, -1295, 712, -1300, 707, -1294, 714, -1302, 705]
      - remote_transmitter.transmit_raw:
          code: [3087, -1293, 714, -291, 1716, -1293, 714, -292, 1715, -1291, 716, -1292, 715, -1294, 713, -1295, 712, -291, 1716, -291, 1715, -291, 1700, -340, 1685, -292, 1715, -290, 1716, -1295, 713, -1296, 710, -292, 1715, -291, 1716, -1292, 715, -1293, 715, -1291, 715, -1293, 715, -1296, 706, -1302, 710, -1293, 714, -294, 1713, -292, 1715, -1296, 711, -1291, 716, -1292, 715, -1292, 715, -1292, 716]
      # Group bit (1)
      - remote_transmitter.transmit_raw:
          code: [3089, -1293, 714, -291, 1716, -1292, 714, -291, 1717, -1291, 716, -1295, 712, -1294, 714, -1293, 714, -292, 1714, -296, 1706, -301, 1719, -308, 1692, -289, 1718, -292, 1714, -1293, 714, -1297, 711, -290, 1716, -293, 1714, -1296, 711, -1298, 709, -1292, 715, -1301, 707, -1292, 715, -1292, 714, -1297, 711, -292, 1715, -295, 1712, -1294, 713, -1291, 716, -1293, 714, -1297, 711, -1293, 713]
      # On/Off (1)
      - remote_transmitter.transmit_raw:
          code: [3093, -1291, 715, -289, 1719, -1293, 713, -289, 1718, -1289, 718, -1291, 716, -1293, 715, -1290, 716, -293, 1714, -294, 1713, -291, 1716, -291, 1716, -298, 1709, -295, 1711, -1294, 713, -1295, 713, -293, 1714, -297, 1710, -1293, 714, -1291, 716, -1298, 709, -1293, 710, -1303, 683, -1323, 710, -1291, 716, -290, 1717, -292, 1715, -1292, 715, -1296, 711, -1296, 711, -1294, 713, -1300, 708]
      # Send unit (0)
      - remote_transmitter.transmit_raw:
          code: [3087, -1290, 717, -292, 1715, -1291, 716, -291, 1716, -1296, 711, -1297, 710, -1292, 715, -1296, 711, -292, 1711, -301, 1710, -289, 1717, -299, 1709, -293, 1714, -291, 1715, -1298, 710, -1291, 716, -295, 1712, -291, 1716, -1291, 716, -1293, 714, -1295, 712, -1293, 714, -1292, 717, -1290, 716, -1293, 713, -293, 1715, -291, 1715, -1292, 716, -1298, 709, -1293, 714, -1295, 712, -1294, 713]
      - remote_transmitter.transmit_raw:
          code: [3081, -1292, 716, -296, 1711, -1292, 714, -293, 1714, -1291, 717, -1289, 717, -1298, 710, -1293, 713, -291, 1716, -295, 1712, -297, 1708, -323, 1687, -295, 1712, -293, 1713, -1294, 713, -1292, 715, -297, 1710, -292, 1715, -1292, 715, -1292, 715, -1290, 717, -1301, 703, -1300, 711, -1294, 713, -1298, 709, -297, 1710, -294, 1713, -1295, 712, -1299, 708, -1293, 714, -1294, 714, -1293, 713]
      - remote_transmitter.transmit_raw:
          code: [3090, -1293, 713, -294, 1713, -1292, 716, -289, 1717, -1290, 717, -1292, 716, -1290, 716, -1295, 712, -294, 1709, -296, 1715, -291, 1703, -342, 1679, -290, 1717, -293, 1714, -1295, 711, -1293, 715, -292, 1714, -297, 1711, -1295, 711, -1293, 715, -1293, 714, -1293, 714, -1296, 710, -1296, 712, -1292, 714, -296, 1712, -291, 1716, -1294, 713, -1295, 712, -1298, 709, -1297, 711, -1297, 709]
      - remote_transmitter.transmit_raw:
          code: [3091, -1289, 719, -289, 1718, -1290, 717, -290, 1716, -1293, 715, -1288, 719, -1289, 718, -1291, 716, -299, 1707, -293, 1714, -297, 1711, -290, 1716, -296, 1711, -296, 1711, -1293, 714, -1294, 713, -292, 1715, -295, 1712, -1294, 713, -1295, 712, -1298, 705, -1301, 683, -1319, 717, -1293, 714, -1290, 716, -292, 1715, -295, 1712, -1293, 714, -1292, 716, -1296, 710, -1293, 714, -1292, 715]
      # Stop pulse
      - remote_transmitter.transmit_raw:
          code: [3093, -1292, 715, -297, 1709, -1295, 712, -290, 1718, -1290, 717, -1292, 714, -1294, 713, -1294, 709, -297, 1714, -293, 1715, -293, 1713, -291, 1716, -299, 1708, -296, 1711, -1295, 712, -1293, 714, -292, 1715, -293, 1714, -1294, 713, -1295, 713, -1290, 717, -1294, 712, -1294, 713, -1299, 709, -1291, 716, -294, 1713, -291, 1715, -1292, 716, -1293, 714, -1292, 715, -1297, 710, -1293, 714]

Unfortunately, that doesn't trigger any of the KaKu devices that are listening for that code. When I run a simple Arduino project with the RemoteSwitch library, it does work.

Is there anything else I could/should try?

bluesheep commented 5 years ago

I'm in the same position, I'm sorry for not responding to the previous message. I have been unable to get the raw transmissions to work.

glmnet commented 5 years ago

That is one large code for a single switch.

Are you sure you’re not trying to do several switches?

bjw-s commented 5 years ago

I agree it seems rather big, but that’s what remote_receiver caught when pushing the original button. The ‘new’ KaKu protocol being weird as it is, I thought it could be worth the try.

andrasbiro commented 4 years ago

I looked into this, and I'm fairly sure it won't be possible to support kaku with the rc_switch protocol. Instead, it would be nice to see something similar to Portisch's flexible implementation: https://github.com/Portisch/RF-Bridge-EFM8BB1/wiki/Define-new-protocol-in-RF_Protocols.h (written for the EFM8 on the sonoff gateway, also would be nice to have support for it)

This seems to be a superset of rc_switch - I'm thinking of porting it myself but I don't think I will have the time and motivation to finish it :)

For the record: I've tested the above firmware with Tasmota, and receive is not super reliable - though I suspect it's just a tolerance problem.

andrasbiro commented 4 years ago

Okay, I realized that it is possible to make it work, see above. The remaining issues to fully support kaku:

github-k8n commented 1 year ago

It seems the merged PR only enabled support for NEXA protocol, while KaKu is still unsupported. There's more information on the KaKu protocol here: https://manual.pilight.org/protocols/433.92/switch/kaku.html

(On a side-note, the KaKu devices are sometimes received/identified as NEXA devices and sending works if you send the same NEXA code AND repeat it (doesn't work without repeating) which confirms the issue described by @andrasbiro regarding the sync (beginning vs end).

github-k8n commented 1 year ago

Keep in mind that there is "old" KaKu (which gets identified by and works with rc_switch_raw) and "new" KaKu protocol which seems to be related to NEXA. Just as a heads up in case there is some confusion regarding those two.

Old (not related to this issue): https://manual.pilight.org/protocols/433.92/switch/kaku_old.html

New (the topic here): https://manual.pilight.org/protocols/433.92/switch/kaku.html

github-k8n commented 1 year ago

I have three Intertechno ITLR-3500 switches and I could send one of them if it helps to progress here. (also I'd be happy to test new versions of the remote receiver/transmitter components anytime.. using a modded Sonoff RF bridge but also have an ESP32 with a RXB6 receiver)