eschava / broadlink-mqtt

MQTT client to control BroadLink devices
MIT License
222 stars 60 forks source link

Support for RF capture/playback on RM PRO devices #22

Closed squidage closed 6 years ago

squidage commented 6 years ago

Hi,

Firstly thank you for your great efforts.

Secondly, does your code support the RF features of the RM Pro devices?

eschava commented 6 years ago

Parent library (python-broadlink) has no differences between IR and RF signals so I suppose RF is supported as well :)

tlc76 commented 6 years ago

Hi, I own a RM 3 pro plus and I am not able to record RF codes using the broadlink-mqtt script.

Recording/replaying IR codes works like a charm, files are being created and reused for each and every recorded remote button press.

After executing a regular "record" mqtt command, when pressing any key on a RF remote control, nothing happens, the Broadlink device does not record anything.

When using the Google Play Broadlink app ("ihc"), you can record RF signals in two steps :

  1. long press the desired button on the RF remote - this is to allow the device to learn the RF frequency
  2. short press the same button for capturing the RF code.

After steps 1 and 2 are performed in the Broadlink ihc app, the command is then available and functional.

Any advice on how to learn RF codes with broadlink-mqtt? Is this function available? If not, will it be?

Thanks a lot

later edit: I think when sending data, the RF packets contain a different byte (offset 0x04): 0x26 = IR, 0xb2 for RF 433Mhz, 0xd7 for RF 315Mhz (more details here)

eschava commented 6 years ago

Sorry, format of RF packet doesn't matter

I've rechecked sources of broadlink_cli utility provided by python-broadlink library and see that there is no difference between IR and RF learning as well

tlc76 commented 6 years ago

OK, thanks.

I've revisited the app and it seems in order to learn RF codes, you need to perform two steps in sequence:

  1. From the two shown options "Learn" or "Sweep frequencies", you must select the 2nd one and then long press on the RF remote button you wish to learn;
  2. After that, the app learns the operating frequency and automatically moves to the second step, which is requesting the user to short press the same button to finally learn the button.

If the Sweep frequencies function is not performed, the Broadlink device does NOT learn the RF code.

This means that most probably there should be another mqtt topic/command which should put the Broadlink device into "Sweep frequencies" mode.

I've tested with a 433 MHz RF remote Silvercrest (EAN 60494) which controls (on/off) 4 RF sockets individually or grouped.

Meanwhile I found another python script (Broadlink-e-control-db-dump) which decodes a .db file from the e-Control android app and saves all learnt codes from the app into text files.

Thank you, Cristian

eschava commented 6 years ago

I found similar information for the parent python-broadlink library:

To receive RF commands, “sweep frequency” command is required. However, it is currently not implemented in this library. Therefore, you can only receive IR commands but not RF commands.

There’s a workout for this. You can receive the RF data from a third party like RMBridge and hook the data to the send command.

The string RF data is just a bunch of HEX code which you can deal with b”173e2748290” to convert to byte array.

References: https://github.com/mjg59/python-broadlink/issues/87 https://github.com/mjg59/python-broadlink/issues/198