Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jarolift shutter working with keeloq #7788

Merged
merged 11 commits into from
Feb 27, 2020
Merged

Conversation

he-so
Copy link
Contributor

@he-so he-so commented Feb 24, 2020

Description:

This fork adds the Keeloq algorithm to control rf-shutter/rollers. Especially it works like a Jarolift TDRC-01W. You need to connect a CC1101 rf-transmitter via the SPI pins. I have tested this with a Wemos D1 R2, but also a Wemos mini should work. For wiring see Jarolift_MQTT.
It is based on the Jarolift-Keeloq project found here:
http://www.bastelbudenbuben.de/2017/04/25/protokollanalyse-von-jarolift-tdef-motoren/

and here

https://github.com/madmartin/Jarolift_MQTT

Integrating the Keeloq remote with tasmota and the shutter/roller feature offers the advantage to use the homekit slider to move the shutter to a specific position, because the tasmota shutter driver makes some sophisticated calculation regarding the timings to move the shutter to absolute positions. Previous implementations of the Jarolift Keeloq software did not offer this advantage, but were limited in sending the button codes manually by using the GUI or MQTT.

This driver only interfaces with tasmota Commands. There is no GUI component for it.
The implemented commands are:

Command Parameter(s)
KeeloqSet msb, lsb, serial, counter: Sets the Keeloq master key MSB, LSB, serial and counter given either in hex notation prefixed with 0x or as decimal notation. The master key has to be retrieved from your original remote. The serial can be choosen individually. The counter should start at 0. To start using these values, you have to "learn" or "pair" the serial+counter value with your receiver by bringing your receiver to learning mode and sending the command for the learn button.
KeeloqSendButton button: Sends a Keeloq command for the given button code. This command increments the counter and stores it persistently in the settings. It calculates the relevant encrypted value which is part of the data to be sent. Usual codes are: UP=8, STOP=4, DOWN=2, LEARN=1. i.e.: KeeloqButtonSend 2
KeeloqSendRaw string: Send a bit string represented as a character of "0" or "1" via the rf transmitter. Used only for debugging. i.e: KeeloqSendRaw 01010101011001100

When using the USE_SHUTTER mode in Tasmota, it can be triggered by Rules to control the shutter motor by RF:

Rule1 On Power1#state=0 DO KeeloqSendButton 4 endon On Power2#state=0 DO KeeloqSendButton 4 endon on Power1#state=1 DO KeeloqSendButton 8 endon on Power2#State=1 DO KeeloqSendButton 2 endon

Related issue (if applicable): fixes #

Checklist:

  • [x ] The pull request is done against the latest dev branch
  • [x ] Only relevant files were touched
  • [x ] Only one feature/fix was added per PR.
  • [x ] The code change is tested and works on core 2.6.1
  • [x ] The code change pass travis tests. Your PR cannot be merged unless tests pass
  • [x ] I accept the CLA.

@Jason2866
Copy link
Collaborator

Needs the masterkey still to be extracted from a firmware dump?

@he-so
Copy link
Contributor Author

he-so commented Feb 24, 2020

Yes, based on the master key, the device key will be generated when invoking the Set command.

@he-so he-so requested a review from arendst February 25, 2020 20:08
@he-so
Copy link
Contributor Author

he-so commented Feb 25, 2020

Two notes regarding the CLA:

Copy link
Owner

@arendst arendst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine but...

As there are many AddLog_P2 calls taking up precious code space I suggest you use the special macro DEBUG_DRIVER_LOG. This functionality can be enabled during debugging by enabling define DEBUG_TASMOTA_DRIVER.

Search for DEBUG_SENSOR_LOG to see numerous examples.

Important AddLog_P2 can always exist.

@he-so he-so requested a review from arendst February 26, 2020 19:21
Copy link
Owner

@arendst arendst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're doing great but...

  • As time goes on you may have noticed driver id 35 is now occupied by PWM_DIMMER. So pls update to driver id 36
  • Also revisit the Settings map as button_devices (F08) has been released.

Sorry, almost there.

@ascillato
Copy link
Contributor

The TX and RX pins are hardcoded and can be easily turned to user selection. Please check for example the GPS driver for that. Thanks.

@arendst arendst merged commit e7f1e0a into arendst:development Feb 27, 2020
@arendst
Copy link
Owner

arendst commented Feb 27, 2020

Agree with @ascillato Adrian. Pls revisit the GPIO selection.

@he-so
Copy link
Contributor Author

he-so commented Feb 27, 2020

Ok, is see the point. But actually it is not possible to configure the pins, since the CC1101 driver uses hardware SPI only, and the ESP has only one set of MISO, MOSI, SCK etc. as far as I understand. SPI is used for initialisation and reading the status register for receiption (OK, receiving data is not implemented now, but might be soon).

But, maybe there is a already defined value in the arduino/ESP headers that can be reused? I will have a look.

@Jason2866
Copy link
Collaborator

Talking about this GPIOs Tx / Rx

#define TX_PORT            4              // Outputport for transmission
#define RX_PORT            5              // Inputport for reception

@he-so
Copy link
Contributor Author

he-so commented Feb 27, 2020

You are right...

@TheChatty
Copy link
Contributor

Hello, can I use KeeloqSendRaw to send arbitrary commands? In detail I want to send this command.

@he-so
Copy link
Contributor Author

he-so commented Dec 3, 2020

Hello, can I use KeeloqSendRaw to send arbitrary commands? In detail I want to send this command.

Hi, the command can send arbitrary keeloq commands.

@gusman80
Copy link

hey there i made Jarolift_MQTT work fine in my home, sadly the software sometimes crashes.
Now i wanna move to tasmota with keeloq and have the following questions:
max # of controllable shutters 4? (is the limit coming from the maximum number of relays in tasmota?)
how do i change/switch the shutterX to whom i want to send the KeeloqSendButton X command?

thank you

@he-so
Copy link
Contributor Author

he-so commented Mar 27, 2021

@gusman80 , the number of shutters is currently one, because only one serial, counter and key can be saved in the configuration in the way it’s done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants