mjg59 / python-broadlink

Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs
MIT License
1.35k stars 477 forks source link

315Mhz RF learning #748

Closed Chanete closed 1 year ago

Chanete commented 1 year ago

Hi, I know this is and old issue and there is no answer yet from the development.

As far as I've read the only way to learn a 315Mhz code is to start with the app the process to learn a new code and once it starts the 30 second countdown start the python code to learn the code and then, press the button on the remote,

I've been unable to do this. This is my little python code to achive this:

import broadlink

devices = broadlink.discover()

print(devices)

device = broadlink.hello('192.168.1.205') # IP address of your Broadlink device. print(device) # Its an rm4: Broadlink RM4 pro (0x649b) device.auth()

print("Detect Fewq. ")

device.sweep_frequency()

print("Searching for RF packet") device.find_rf_packet() print("Find exited") packet = device.check_data() print(packet)

No matter what timing I use (go fast, slow, long press, short press...) I always get this same error: 智能遥控 (RM4 pro at 192.168.1.205) Searching for RF packet Find exited Traceback (most recent call last): File "grabar_rf.py", line 14, in packet = device.check_data() File "/home/sjc/.local/lib/python3.7/site-packages/broadlink/remote.py", line 21, in check_data check_error(response[0x22:0x24]) File "/home/sjc/.local/lib/python3.7/site-packages/broadlink/exceptions.py", line 137, in check_error raise exception(error_code) broadlink.exceptions.StorageError: [Errno -5] The device storage is full

by the way, If I use the app, it works like a charm!

Any clue in how to learn my RF codes? Thx for your help-

Chanete commented 1 year ago

For those of you (like me) stuck with the problem of recording 315mhz rf codes, this branch from this reps solved my problem!! https://github.com/mjg59/python-broadlink/pull/613#issuecomment-1315114274 . It took me a while to find this answer, ny the way @mjg59 this is a great improvement and solves this issue, you should consider merging this repo (just 2 files..)