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

Add support for Broadlink RM4C mini (0x6539) #476

Merged
merged 1 commit into from
Jan 8, 2021

Conversation

felipediel
Copy link
Collaborator

@felipediel felipediel commented Nov 16, 2020

Add support for Broadlink RM4C mini (0x6539)
#411 (comment)
home-assistant/core#42983 (comment)

@guieiras-dev
Copy link

Awesome!! That is exactly what I need.

@mmakaay
Copy link

mmakaay commented Dec 9, 2020

Manually patched my local code, and I can confirm that the solution is working for me. Thanks.

@zaberxxx
Copy link

zaberxxx commented Dec 9, 2020

Manually patched my local code, and I can confirm that the solution is working for me. Thanks.

May I ask how to manually patch the code?
Or how long PR usually be released to public? Have been waiting for 0x653c to be supported for almost a month.
Thank you.

@felipediel
Copy link
Collaborator Author

felipediel commented Dec 9, 2020

  1. Open Home Assistant and install "SSH & Web Terminal" add-on
  2. Disable Protection mode
  3. Connect to the device via SSH and update init.py with your type:
ssh USER@IPADDRESS
docker exec -it homeassistant /bin/bash
cd /./usr/local/lib/python3.8/site-packages/broadlink
wget -O __init__.py https://raw.githubusercontent.com/felipediel/python-broadlink/patch-23/broadlink/__init__.py
  1. Restart the server.

@mmakaay
Copy link

mmakaay commented Dec 10, 2020

Note that this patch is only required during the discovery phase in Home Assistant.

I followed pretty much the route that @felipediel describes above, to patch the code inside the running container.
Afterwards, I restarted the server from the Home Assistant web interface, to be sure that the container wasn't restarted (because that would rollback the change to the file).
After doing so I could add my devices to the Broadlink integration, and record and send commands.

When this all was setup and working, I fully restarted the container, bringing back the original code for the python-broadlink library. I was happy to see that my integration kept working.

@centromedicointer
Copy link

Note that this patch is only required during the discovery phase in Home Assistant.

I followed pretty much the route that @felipediel describes above, to patch the code inside the running container.
Afterwards, I restarted the server from the Home Assistant web interface, to be sure that the container wasn't restarted (because that would rollback the change to the file).
After doing so I could add my devices to the Broadlink integration, and record and send commands.

When this all was setup and working, I fully restarted the container, bringing back the original code for the python-broadlink library. I was happy to see that my integration kept working.

Thank you it worked for mee!!

@blavak68
Copy link

1. Open Home Assistant and install "SSH & Web Terminal" add-on

2. Disable Protection mode

3. Connect to the device via SSH and update **init**.py with your type:
ssh USER@IPADDRESS
docker exec -it homeassistant /bin/bash
cd /./usr/local/lib/python3.8/site-packages/broadlink
wget -O __init__.py https://raw.githubusercontent.com/felipediel/python-broadlink/patch-23/broadlink/__init__.py
1. Restart the server.

Thx, it worked for mee!! (0x6539)

@jonastep
Copy link

Not able to make it work.

First thing is that the folder broadlink is was not created, so I created manually (is this correct?).
Second thing is I didnt find 0x6539 in the init.py so I have added one line manually.

I am still getting

Unsupported device: 0x6539. If it worked before, please open an issue at https://github.com/home-assistant/core/issues

Any advice on what to check or what could be blocking this integration?

@felipediel
Copy link
Collaborator Author

felipediel commented Dec 18, 2020

The folder exists, but elsewhere. You can find it with:

find / -name broadlink

Another installation option:

ssh USER@IPADDRESS
docker exec -it homeassistant /bin/bash
pip3 install git+https://github.com/felipediel/python-broadlink.git@patch-23 --force-reinstall --no-deps

@jonastep
Copy link

jonastep commented Dec 18, 2020

Thanks for the help @felipediel. I was able to install the device with another method:

1.- Open SSH & Web Terminal
2.- Login: ssh USER@IPADDRESS
3: Enter the command: cd /./usr/local/lib/python3.8/site-packages/broadlink
4: Open the file using the command: vi init.py
5: Inside the file Type "i" (This will start edition mode on the file).
6: Add under the section "Supported Types" the line
0x6539: (rm4, "RM4C mini", "Broadlink"),
7: Press ESC
8: Type ":wq" and then press enter.
9: Reboot HASSIO.

Thank you for the support works great.

@KTibow
Copy link
Contributor

KTibow commented Dec 18, 2020

Given how many PRs there are for devices that aren't merged, would it make sense to just have something in the UI to manually specify the device type, or some kind of auto-detection? That would save some of the hassle.

@felipediel
Copy link
Collaborator Author

felipediel commented Dec 18, 2020

@KTibow We already have a PR for this, but it is not ready yet.

@hasan-fardan
Copy link

it didn't work for me is still get device not supported (0x6539)

@hasan-fardan
Copy link

hasan-fardan commented Dec 26, 2020

i changed the code proovided by @felipediel by adding new line " 0x6539: (rm4, "RM4 mini", "Broadlink"), ". i saved this code in repository : https://raw.githubusercontent.com/hasan-fardan/python-broadlink/main/__init__.py

Then I did the same steps:

  1. Open Home Assistant and install "SSH & Web Terminal" add-on
  2. Disable Protection mode
  3. Connect to the device via SSH and update init.py with your type:
    ssh USER@IPADDRESS
    docker exec -it homeassistant /bin/bash
    cd /./usr/local/lib/python3.8/site-packages/broadlink
    wget -O init.py https://raw.githubusercontent.com/hasan-fardan/python-broadlink/main/__init__.py

Finally, restart Home assistant

@hasan-fardan
Copy link

After I added my broadlink rm4 mini I can't learn codes anymore. When I run the service to learn code it runs as usual but when I send the command I just learned it does nothing. Also, when I searched for the learned codes I didn't see the folder ".storage"

@felipediel
Copy link
Collaborator Author

felipediel commented Dec 26, 2020

The .storage folder is hidden. If you are on Windows, you need to check that box to show hidden files and folders.

Do you see any errors in the logs? Check if the entity is turned on. There is a button.

@hasan-fardan
Copy link

thanks. i saw them

@bulutsemih
Copy link

you are great felipediel ,Thanks to everyone who contributed

@hasan-fardan
Copy link

my broadlink rm4 mini stopped working. its state changed to unavailable. in the broadlink app I can control it normally but in home assistant I cant. when I try to add it again it says device not available even though I followed the same steps as before.

@hasan-fardan
Copy link

hasan-fardan commented Dec 31, 2020

this method works

ssh USER@IPADDRESS
docker exec -it homeassistant /bin/bash
pip3 install git+https://github.com/felipediel/python-broadlink.git@patch-24 --force-reinstall --no-deps

edit: it worked on the rm4 mini but stopped my rm4 pro

@jonastep
Copy link

my broadlink rm4 mini stopped working. its state changed to unavailable. in the broadlink app I can control it normally but in home assistant I cant. when I try to add it again it says device not available even though I followed the same steps as before.

For me the RM4C Mini stopped working after the update. I had to learn again the commands and now it's working again, did you try it?

@hasan-fardan
Copy link

my broadlink rm4 mini stopped working. its state changed to unavailable. in the broadlink app I can control it normally but in home assistant I cant. when I try to add it again it says device not available even though I followed the same steps as before.

For me the RM4C Mini stopped working after the update. I had to learn again the commands and now it's working again, did you try it?

it's unavailable in my case

@hasan-fardan
Copy link

my broadlink rm4 mini stopped working. its state changed to unavailable. in the broadlink app I can control it normally but in home assistant I cant. when I try to add it again it says device not available even though I followed the same steps as before.

For me the RM4C Mini stopped working after the update. I had to learn again the commands and now it's working again, did you try it?

it's unavailable in my case

now both the pro and the mini works. I copied felipediel code and and added both devices (0x653c , 0x6539)

for the setup install "ssh and web terminal"
turn off the protection mode
type:
ssh USER@IPADDRESS
docker exec -it homeassistant /bin/bash
pip3 install git+https://github.com/hasan-fardan/python-broadlink.git@patch-24 --force-reinstall --no-deps

then restart home assistant

@wojciechczyz
Copy link

2021.1 Is still missing this definition.

@KTibow
Copy link
Contributor

KTibow commented Jan 7, 2021

@mjg59 might be on vacation.

@mjg59 mjg59 merged commit e7e92cc into mjg59:master Jan 8, 2021
@Arturasm
Copy link

my broadlink rm4 mini stopped working. its state changed to unavailable. in the broadlink app I can control it normally but in home assistant I cant. when I try to add it again it says device not available even though I followed the same steps as before.

For me the RM4C Mini stopped working after the update. I had to learn again the commands and now it's working again, did you try it?

it's unavailable in my case

now both the pro and the mini works. I copied felipediel code and and added both devices (0x653c , 0x6539)

for the setup install "ssh and web terminal"
turn off the protection mode
type:
ssh USER@IPADDRESS
docker exec -it homeassistant /bin/bash
pip3 install git+https://github.com/hasan-fardan/python-broadlink.git@patch-24 --force-reinstall --no-deps

then restart home assistant

Help please - I do via terminal or putty - after i do login no such command "docker...".
What I do wrong?

@KTibow
Copy link
Contributor

KTibow commented Jan 12, 2021

@Arturasm did you:

  • for the setup install "ssh and web terminal" addon
  • turn off the protection mode
  • open the web interface
  • run those commands:
docker exec -it homeassistant /bin/bash
pip3 install git+https://github.com/hasan-fardan/python-broadlink.git@patch-24 --force-reinstall --no-deps
  • then restart HA

@Arturasm
Copy link

@Arturasm did you:

  • for the setup install "ssh and web terminal" addon
  • turn off the protection mode
  • open the web interface
  • run those commands:
docker exec -it homeassistant /bin/bash
pip3 install git+https://github.com/hasan-fardan/python-broadlink.git@patch-24 --force-reinstall --no-deps
  • then restart HA

I do not get what is turn off protection mode. Is it in SSH/Terminal add-on config? I use Putty. Tried on web terminal, the same.

@hasan-fardan
Copy link

make sure its "ssh and web terminal" not "terminal and ssh". one you open it you will see a toggle called protection mode.
Screenshot 2021-01-12 200256

@Arturasm
Copy link

make sure its "ssh and web terminal" not "terminal and ssh". one you open it you will see a toggle called protection mode.
Screenshot 2021-01-12 200256

Thank you very much, all went well. Have used official SSH and had no luck... probably not only me get here stucked.

@felipediel felipediel mentioned this pull request Jan 20, 2021
felipediel added a commit to felipediel/python-broadlink that referenced this pull request Jan 29, 2021
Add support for Broadlink RM4C mini (0x6539) (mjg59#476)

Add support for Broadlink RM4 pro (0x653C) (mjg59#472)

Add support for Broadlink RM4S (0x6364) (mjg59#475)

Add support for Broadlink MCB1 (0x756F) (mjg59#478)

Add support for Broadlink MCB1 (0xA56A) (mjg59#478)

Add support for Broadlink RM mini 3 (0x6508) (mjg59#479)

Add support for Efergy Ego (0x271D) (mjg59#481)

Add support for Broadlink SCB1E (0x5115) (mjg59#514)

Add support for Broadlink SCB1E (0x6113) (mjg59#488)

Add support for Broadlink SP4L-EU (0x618B) (mjg59#489)

Add support for Broadlink SP4L-UK (0xA589) (mjg59#491)

Add support for Broadlink RM3 mini (0x27d3) (mjg59#493)

Add support for Broadlink SP4L-AU (0x6489) (mjg59#498)

Add support for BG Electrical AHC/U-01 (0x51E2) (mjg59#497)

Add support for Broadlink MCB1 (0x6111) (mjg59#509)
felipediel added a commit to felipediel/python-broadlink that referenced this pull request Jan 29, 2021
Add support for Broadlink RM4C mini (0x6539) (mjg59#476)

Add support for Broadlink RM4 pro (0x653C) (mjg59#472)

Add support for Broadlink RM4S (0x6364) (mjg59#475)

Add support for Broadlink MCB1 (0x756F) (mjg59#478)

Add support for Broadlink MCB1 (0xA56A) (mjg59#478)

Add support for Broadlink RM mini 3 (0x6508) (mjg59#479)

Add support for Efergy Ego (0x271D) (mjg59#481)

Add support for Broadlink SCB1E (0x5115) (mjg59#514)

Add support for Broadlink SCB1E (0x6113) (mjg59#488)

Add support for Broadlink SP4L-EU (0x618B) (mjg59#489)

Add support for Broadlink SP4L-UK (0xA589) (mjg59#491)

Add support for Broadlink RM3 mini (0x27d3) (mjg59#493)

Add support for Broadlink SP4L-AU (0x6489) (mjg59#498)

Add support for BG Electrical AHC/U-01 (0x51E2) (mjg59#497)

Add support for Broadlink MCB1 (0x6111) (mjg59#509)
@Arturasm
Copy link

Arturasm commented Feb 5, 2021

2021.2 still does not have RM4C mini?

As well github asks for user/pass:
docker exec -it homeassistant /bin/bash
pip3 install git+https://github.com/felipediel/python-broadlink.git@patch-24 --force-reinstall --no-deps

@guieiras-dev
Copy link

guieiras-dev commented Feb 5, 2021

2021.2 still does not have RM4C mini?

As well github asks for user/pass:
docker exec -it homeassistant /bin/bash
pip3 install git+https://github.com/felipediel/python-broadlink.git@patch-24 --force-reinstall --no-deps

It was not tagged yet. We need to wait until maiteiners release a new version on PyPi.

@NikitaKorneev
Copy link

Thanks everyone, the advice helped. You guys are awesome!

@Arturasm
Copy link

Arturasm commented Mar 4, 2021

Hi guys,

help me to update 2021.03 HA version with working latest Broadlink solution. Older one in up here is not working anymore.

@NikitaKorneev
Copy link

Hi guys,

help me to update 2021.03 HA version with working latest Broadlink solution. Older one in up here is not working anymore.

Are you saying that solution proposed above doesn’t work anymore?

@Arturasm
Copy link

Arturasm commented Mar 4, 2021

Log says succeeded, but I integration says no correct device.

@felipediel
Copy link
Collaborator Author

Hi @Arturasm. You need to re-patch your installation when you update Home Assistant. You can use this branch:

ssh USER@IPADDRESS
docker exec -it homeassistant /bin/bash
pip3 install git+https://github.com/felipediel/python-broadlink.git --force-reinstall --no-deps

This is what is happening: we skipped v0.16.1 and with v0.17.0 almost ready it makes no sense to release the previous version, which has already been tested by many people informally and would be just another obstacle for many important updates that are coming. We need to think about the whole.

So I ask everyone to be patient while waiting. I am working daily to make this happen. If you see people in trouble, please copy and paste the instructions to help them.

@kylemd
Copy link

kylemd commented Mar 4, 2021

@felipediel might be worth adding to the readme for now until the new version is ready.

You can definitely see you're working every day on it, speed of development is blowing me away at the moment!

@felipediel
Copy link
Collaborator Author

It won't be necessary, we're almost there.

@percevalknight
Copy link

percevalknight commented Mar 11, 2021

Hi @Arturasm. You need to re-patch your installation when you update Home Assistant. You can use this branch:

ssh USER@IPADDRESS
docker exec -it homeassistant /bin/bash
pip3 install git+https://github.com/felipediel/python-broadlink.git --force-reinstall --no-deps

This is what is happening: we skipped v0.16.1 and with v0.17.0 almost ready it makes no sense to release the previous version, which has already been tested by many people informally and would be just another obstacle for many important updates that are coming. We need to think about the whole.

So I ask everyone to be patient while waiting. I am working daily to make this happen. If you see people in trouble, please copy and paste the instructions to help them.

Hey, the workaround at the moment is still isntalling 0.16.0 for me:

Collecting git+https://github.com/felipediel/python-broadlink.git
  Cloning https://github.com/felipediel/python-broadlink.git to /tmp/pip-req-build-o2ruhg4k
Building wheels for collected packages: broadlink
  Building wheel for broadlink (setup.py) ... done
  Created wheel for broadlink: filename=broadlink-0.16.0-py3-none-any.whl size=18576 sha256=d92ef51cb301aa474d2d0410a794effd965aaf06f9ffc239b8f95806b02c9039
  Stored in directory: /tmp/pip-ephem-wheel-cache-2wsyx81w/wheels/cf/fd/af/fa64ea00b4170b602f84cdff19c6e07871c8e1cf3b504ae005
Successfully built broadlink
Installing collected packages: broadlink
  Attempting uninstall: broadlink
    Found existing installation: broadlink 0.16.0
    Uninstalling broadlink-0.16.0:
      Successfully uninstalled broadlink-0.16.0
Successfully installed broadlink-0.16.0

Was 0.16.1 cancelled while waiting for 0.17.0?

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.