Next step, learning remote codes.
I’m seeing this error in Terminal 1:
pi@raspberrypi:~/broadlink-mqtt $ python3 mqtt.py
[2020-08-21 16:59:53,757] DEBUG Connected to 'RM4' Broadlink device at '192.168.1.6' (MAC 89:c6:b9:a7:df:24) and started listening for commands at MQTT topic having prefix 'broadlink/'
[2020-08-21 16:59:53,764] DEBUG Connected to MQTT broker, subscribing to topic broadlink/#
[2020-08-21 17:01:53,995] DEBUG Sending RM temperature 0.0 to topic broadlink/temperature
[2020-08-21 17:03:54,091] DEBUG Sending RM temperature 0.0 to topic broadlink/temperature
[2020-08-21 17:05:54,104] DEBUG Sending RM temperature 0.0 to topic broadlink/temperature
[2020-08-21 17:07:54,226] DEBUG Sending RM temperature 0.0 to topic broadlink/temperature
[2020-08-21 17:07:55,133] DEBUG Received MQTT message broadlink/bedroom/bedroom_fan/low record
[2020-08-21 17:07:55,133] DEBUG Recording command to file /home/pi/broadlink-mqtt/commands/bedroom/bedroom_fan/low
[2020-08-21 17:08:00,467] ERROR Error
Traceback (most recent call last):
File "mqtt.py", line 198, in on_message
record(device, file)
File "mqtt.py", line 254, in record
ir_packet = device.check_data()
File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 631, in check_data
check_error(response[0x22:0x24])
File "/usr/local/lib/python3.7/dist-packages/broadlink/exceptions.py", line 97, in check_error
raise exception(error_code)
broadlink.exceptions.StorageError: The device storage is full
[2020-08-21 17:09:54,234] DEBUG Sending RM temperature 0.0 to topic broadlink/temperature
[2020-08-21 17:11:54,351] DEBUG Sending RM temperature 0.0 to topic broadlink/temperature
Thanks for this info
Does it mean I’m stuck till they fix the problem?
Or will I be able to use the workaround described in the second link?
Try the following lines in the Python interactive shell:
First find your device and enter learning mode
import broadlink device = broadlink.discover() devices.auth() device.enter_learning()
Now the LED indicator should be white, press the button now. After that, run:
packet = devices.check_data() print(packet.hex())
This should show the IR packet in hex format.
Like other people, the broadlink binding gave me the OFFLINE error code when I added the RM4 Pro to OpenHAB.
I’m sorry if this is a complete noob question, but how do I use the workaround?
Do I need to add my network/device info in every place there are brackets () in the workaround commands?
If that’s the case, I’m not sure what info I should add.
@mjeshurun I’ve updated my tutorial to include using python-broadlink to capture codes. Go back to my first post, to the Teach remote codes header, then click on Click to teach via python-broadlink. Let me know how it goes.
I really don’t know how to thank you for all your good efforts and help.
You have my deepest gratitude!
I tried the python-broadlink solution you added, but I’m still getting error messages when I try to capture remote codes.
Here is a copy of the messages output when I followed your steps:
pi@raspberrypi:~ $ python3
Python 3.7.3 (default, Dec 20 2019, 18:57:59)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import broadlink
>>> devices = broadlink.discover(timeout=5)
>>> print(devices)
[<broadlink.rm4 object at 0xb66aadf0>]
>>> devices[0].auth()
True
>>> devices[0].enter_learning()
>>> packet = devices[0].check_data()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/dist-packages/broadlink/__init__.py", line 631, in check_data
check_error(response[0x22:0x24])
File "/usr/local/lib/python3.7/dist-packages/broadlink/exceptions.py", line 97, in check_error
raise exception(error_code)
broadlink.exceptions.StorageError: The device storage is full
>>> print(packet.hex())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'packet' is not defined
>>> devices[0].send_data(packet)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'packet' is not defined
>>>
I don’t know if this is related to the problem, but my RM4 Pro LED turns to color RED after I enter learning mode (It’s not WHITE as in your description). Also, the LED does not turn off after I press the remote button I want to learn.
I’m pretty sure the remote is close enough to the RM4 Pro to capture the code. The distance between the remote and RM4 Pro was 10 cm.
Yes, 10cm should certainly be close enough, unless the batteries in your remote have died!
Hmmm, I’m not sure what’s happening. I’ve never seen a red LED!
It might be worth completely re-setting the Broadlink device, and re-connecting it back to the wifi - just to start from new. Then try the new learning method?
I’ll have a think, but because I can’t replicate the error it’s a little tricky to debug. It’s obviously an issue, as evidenced by the GitHub link above, but not one I currently have!
EDIT: OK, so according to this comment, you will need to remove line 74 in the exceptions.py file within your python-broadlink folder.
You will then need to reinstall python-broadlink:
sudo python3 setup.py install
Then retry all the teaching stuff.
Still doesn’t explain the red LED though, I don’t think…
When you’ve got time, could you run the following command when inside your python-broadlink folder, and paste the output here?
git log -1
Additionally, check out this post, especially when it gets to learning codes: could you try that method and let me know if it works? You’ve done almost all of it before, except it uses a slightly different learning method. I expect this to fail too, but just want to check!
Also, just to double check: how are you connecting the device to your WiFi? App or python-broadlink? If it’s the app I wonder whether it is somehow still connecting to the cloud, therefore disabling local control?
I connected my device to Wifi using the Broadlink app, but once the device was added to the Wifi network (and AP mode slow LED flashing stopped) I did not continue to add the device to the app.
I tried using the python-broadlink method to connect the device to the Wifi network, but the command did not do anything and the device stayed in AP mode with blue LED flashing slowly.
This is the command I used (with my network’s name and passcode):
Reading around online, it looks like your device only has a blue LED and a red/orange LED, and when it is in learning mode the red/orange LED is on. So it might actually be working as intended! If you have the user guide, it might be worth checking. Don’t forget that my guide is based on the RM4C Mini, which is not the same as yours!
When learning a remote code my white LED (your red/orange LED) remains on for at least 10 seconds after I started pressing the remote button. Make sure to keep pressing the button until the LED turns off! I don’t know whether this affects the broadlink.exceptions.StorageError: The device storage is full issue though.
If I was you, I would contribute to the open issue on the python-broadlink GitHub, explain the steps you’ve taken, and the results you’re getting, and see if anyone else can help!
can I use this command for block internet (cloud) access to the RM? I’ve a simple router and I can not block a single IP, only configure an IP reservation.