mjg59 / python-broadlink

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

Broadlink RM4 PRO is not able to learn or to send RF Signal #358

Closed Virtual-Nomad closed 3 years ago

Virtual-Nomad commented 4 years ago

Unsure if this is the right place to raise this issue, however, I cam across https://github.com/mjg59/python-broadlink/issues/355 which relates to a similar issue except with IR. Currently, I am trying to get my RM4 Pro to work with the HA and having issues bring able to learn RF (IR learns and sends no problem at all) with both python-broadlink and Home assistant. (I also have an issue with it as a sensor (temperature and humidity) - although not that concerned/interested in this side at the moment)

Current Setup Home Assistant 0.109.3 Broadlink RM4 Pro Added to network using python-broadlink - PASS when I attempt devices[0].host[0] > ‘192.168.1.172’ - PASS devices[0].get_type() > ‘Unknown’ - Cant get the type (so this may be a concern or compatibility issue) devices[0].enter_learning() > AttributeError: device instance has no attribute ‘enter_learning’ _FAIL

Under Home assistant Added to HA as switch - configuration.yaml switch: platform: broadlink host: 192.168.1.172 mac: 24:df:a7:b9:c0:5a type: rm4_pro timeout: 15 retry: 5 switches: tv_samsung_power: friendly_name: "Samsung TV Power" command_on: IRSTRING command_off: IRSTRING When I run broadlink.learn

As far as the sensor is concerned sensor: platform: broadlink host: 192.168.1.172 mac: 24:df:a7:b9:c0:5a type: rm4_pro monitored_conditions: temperature humidity Both Temperature and Humidity just show a value of 0

Do you know if anyone has been successful with the RM4 Pro and RF?

Another point is that I cant get the RM4 Pro to work with e-control (or broadlink manager) so have not been able to get any RF packets to test it broadlink.send command to see if that works.

Seeker100 commented 4 years ago

Hi, First time to this forum.

I have the RM4 Pro and Veraplus hub and have the same issue. I have downloaded on the 9th July the broadlink_cli app and the broadlink module. So I can learn IR codes fine but nothing on the RF. The broadlink has the orange learning light come but times out with nothing picked up.

IR ./broadlink_cli --type 0x6026 --host redacted --mac 24dfa7d32c05 --learn Learning… 260c1c39371c1c1c1d….......c1c1c391c1c1c1c381b1d391c1c000d05000000000000 Base64: JgBgABsdH….......BwcOBwcHBw5HBwcHDgbHTkcHAANBQAAAAAAAA==

RF ./broadlink_cli --type 0x6026 --host redacted --mac 24dfa7d32c05 --rfscanlearn Learning RF Frequency, press and hold the button to learn... RF Frequency not found

From the previous few posts it looks to work, so I wonder what I need to do the same?

Seeker100 commented 4 years ago

Apologies, did not pick up on the link as it stated homebridge. I have the veraplus hub and currently run broadlink_cli on my mac, so to get a working RF learning part I need to install the homebridge on my mac?

kiwi-cam commented 4 years ago

@Seeker100 No, the Homebridge link is just referencing using this Python module to workaround for learning not working in the Homebridge module.

Seeker100 commented 4 years ago

Ah okay, but not sure if I have confused something here. From my first post (see above) I have downloaded on the the 9th July the broadlink_cli and Python module from https://github.com/mjg59/python-broadlink> The RF does not work for me (IR does) and that was what I was trying to get some clarity on how to fix?

felipediel commented 4 years ago

@Seeker100 Did you hold the button?

Seeker100 commented 4 years ago

if you meant on the remote, yes I hold it down till the timeout (about 30 secs). I have just tried with two different RF remotes (one of them being the amazon firestick remote and the other a roller blind remote). The IR learning is still working.

felipediel commented 4 years ago

You can only control 315 and 433MHz devices. Amazon Firestick is 2.4GHz.

Seeker100 commented 4 years ago

Ah, okay but the main roller blind remote is 433Mhz and I have managed to learn the RF through the broadlink app (I've been told by broadlink that the e-control and IHC app do not work with the RM4?)

felipediel commented 4 years ago

I have no idea, but it should work, since it is working for other users with the same device. Have you tried with another remote?

Seeker100 commented 4 years ago

Unfortunately most of my other remotes use 2.4Ghz. I will try to get hold of one to test

Seeker100 commented 4 years ago

okay, managed to find my kitchen extractor fan remote which operates at 433.92Mhz Does not work either.

BlueTalon6 commented 4 years ago

@Seeker100

Ah, okay but the main roller blind remote is 433Mhz and I have managed to learn the RF through the broadlink app (I've been told by broadlink that the e-control and IHC app do not work with the RM4?)

Have you got the RM4 integrated with the broadlink cloud through the app? If so, you need to remove it as it interferes with RM4 control via HASS (although I'm not sure if that applies to the python-broadlink package). https://www.home-assistant.io/integrations/broadlink/#troubleshooting

Also, does the orange light stay on the full 30 seconds until timeout?

Seeker100 commented 3 years ago

No the RM4 is not integrated through the cloud with any of the broadlink apps.

Yes, the light definitely stays on the full 30 secs before timing out.

joramos21 commented 3 years ago

Hi, Finally there is useful information. Thank you guys. I just received an RM4 Pro and it was a pain connect it to the network. I had to use the Broadlink app named "Broadlink -Universal TV Remote". Then I was able to add my ir and rf devices and use my phone to manage the devices. It works. Something I really dislike is that it doesn't work without internet access and since yesterday, the app transfered around 12 Mb !!! This may be due to custom pictures I set for the devices. Anyways, I don't want the device to connect to internet. I hope it can work with Home Assistant (I have HassOS 4.12, app version 2.3.0-306-full). Someone here posted this link (thank you) : https://www.home-assistant.io/integrations/broadlink/#troubleshooting It is written : "Many users are experiencing problems with the new Broadlink RM Mini 3 and the entire RM4 series. Once connected to the cloud, these devices lose their local capabilities and can no longer be controlled by Home Assistant. To fix the problem, you need to follow these steps: Remove the device from Broadlink App Factory reset the device Add the device to your local network using the app Do not set up a cloud (not now, not ever). This means that you don’t have to complete the setup in the app, configure only the Wi-Fi and don’t add the Broadlink device to the app"

If I want to connect the Broadlink to my router, the app asks to create an account so, since it is created, it is connected to the cloud. So I don't know how to do it. Does someone know if this model will work on my local network only without internet accces ?

Thank you very much for your help.

Cheers.

Jo

joramos21 commented 3 years ago

One more thing. I download on github a software that runs on Windows called "Broadlink Manager 1.0.0.1". I start a scan and it finds the Broadlink on the network but shows as "Unknow" and when I click on "Connect", I get this : ooking for devices... Found device : Unknown [192.168.1.27] Writing compatible device not detected!

felipediel commented 3 years ago

If you wait for the next version of Home Assistant things will be easier for you, as there will be a configuration flow to assist with unlocking the device.

I need to check your device type to make sure things will work for you. Please install this packet in your computer (pip install broadlink), open Python 3 and:

import broadlink as blk
devs = blk.discover(timeout=5)
[(hex(d.devtype), d.model) for d in devs]

What is the output?

joramos21 commented 3 years ago

Hi, Thank you for the answer :-)

I get : []

Nothing else.

Thank you.

Good week-end.

Jo

joramos21 commented 3 years ago

Sorry, one more thing.

If I add in the configuration.yaml file the broadlink device as a remote, I doesn't appear in the list of services. I have to declare it as a switch. I don't know why, if there is already a switch in the file, it is not allowed and gives an error.

So I remove the other switch and added this : switch:

Then, I can see in the list of services on the developper tools a service called broadlink.send (in all the tutos I have found the service contains the ip address, I don't know if it means something).

When I click on the "call service" button, it returns : Failed to call service broadlink/send. required key not provided @ data['packet']

Any idea ?

Thank you.

felipediel commented 3 years ago

I made a flow to assist with the configuration of theses devices, as it sometimes can be a little tricky. The official release will be available soon. Don't fry your brains out to make a setup that will undergo breaking changes soon. You just need to wait and things will be much simpler.

felipediel commented 3 years ago

I think that your device is locked btw.

import broadlink as blk
d = blk.discover(timeout=5, discover_ip_address='192.168.1.27')[0]
(hex(d.devtype), d.model, d.is_locked)

What is the output?

joramos21 commented 3 years ago

('0x61a2', 'RM4 pro', False)

joramos21 commented 3 years ago

Hi made some more tests. I added this to configuration.yaml 👍 switch:

remote:

Then under Services (Developper tools), I type : Service = remote.learn_command Entity = remote.broadlink

Service Data (YAML, optional) 1 entity_id: remote.broadlink 2 device: ampli_Denon 3 command: mute

Then I clicked on button "CALL SERVICE" and I received a notification and the led on the broadlink device turned on until I pressed the mute button on my Denon amplifier. I read that then there must be a new file in the config folder, that was not created and on the states (Developper tools), column "Entity" there must be an entry like "persistent_notification_notification" that is not present. That's all. Thank you

felipediel commented 3 years ago

('0x61a2', 'RM4 pro', False)

Your device is fully supported and is unlocked. About this error:

When I click on the "call service" button, it returns : Failed to call service broadlink/send. required key not provided @ data['packet']

You need to specify a packet when calling broadlink.send:

# Example configuration.yaml

script:
  tv_select_source:
    sequence:
      - service: broadlink.send
        data:
          host: 192.168.1.27
          packet: "JgCMAJSSFDYUNhQ2FBEUERQRFBEUERQ2FDYUNhQRFBEUERQRFBEUERQRFDYUERQRFBEUERQRFDYUNhQRFDYUNhQ2FDYUNhQABfWUkhQ2FDYUNhQRFBEUERQRFBEUNhQ2FDYUERQRFBEUERQRFBEUERQ2FBEUERQRFBEUERQ2FDYUERQ2FDYUNhQ2FDYUAA0FAAAAAAAAAAAAAAAA"

About this issue:

I read that then there must be a new file in the config folder, that was not created and on the states (Developper tools), column "Entity" there must be an entry like "persistent_notification_notification" that is not present.

remote.learn_command does not create persistent notifications. The codes are stored in the .storage folder.

joramos21 commented 3 years ago

Muchisimas gracias. Thank you.

felipediel commented 3 years ago

@Virtual-Nomad Good news: https://github.com/home-assistant/core/pull/39671

joramos21 commented 3 years ago

Hi, I've been able to learn IR commands. If I'm not wrong it has not been implemented yet for RF, right ? Temperature sensor is not working as for many people. I haven't found a solution. Thank you. Good day. Jo

BlueTalon6 commented 3 years ago

@Virtual-Nomad Good news: home-assistant/core#39671

This will be awesome. I've managed to get my setup working the the python tool, but it is an undertaking.

Cheers

felipediel commented 3 years ago

@joramos21 Are you using the HTS2 cable?

joramos21 commented 3 years ago

Yes, I'm using the HTS2 cable.

felipediel commented 3 years ago

Show me your config.

joramos21 commented 3 years ago

BROADLINK

REMOTES ----------------------------------

remote:

SENSORS -----------------------------------

sensor:

joramos21 commented 3 years ago

Sorry for the format. Some character seem to be interpreted.

felipediel commented 3 years ago

You forgot to specify a type for the sensor.

joramos21 commented 3 years ago

Hi, It works perfectly. Thanks a lot. I saw many people posting the configuration without the type so I did it wrong. About the learning RF signals, it is not possible yet right ? It is what I understood reading your comments. Good day to you and thank you for your availability.

joramos21 commented 3 years ago

Hi, Still not possible to learn a RF signal. IR works great. When I click on the "CALL SERVICE" button, the red light on the Broadlink turns on but even pressing a long time on the RF remote button, nothing happens. Is there a way to learn RF signals? Thank you. Good weekend. Jo

felipediel commented 3 years ago

You are waiting for: https://github.com/home-assistant/core/pull/40605 https://github.com/home-assistant/core/pull/39671. We need to change the architecture of Home Assistant. There is a discussion for this. These things take time, so don't hold your breath.

In the docs you can learn how to workaround for now. https://www.home-assistant.io/integrations/broadlink/

joramos21 commented 3 years ago

Hi, I have been following both Requests and if I understand we need to wait a little bit more to have the broadlink be able to learn RF signals. I was able to learn ir codes and suddenly (I don't know if it is due to an update) the device stopped working. I can see it on the network. I didn't change the configuration.yaml file and the ip I declared and the mac are correct. I can ping the device. But on the "Developer Tools" > "States", when I look for the "remote.broadlink" Entity I find it but the icon is greyed out and when I select it, State = unavailable. I've been looking on the internet for 2 weeks but cannot find what the problem is. Any idea ? Thank you.

KTibow commented 3 years ago

@joramos21 HA problem, ask on HA forum. Could be YAML has been deprecated, it's a common cause.

joramos21 commented 3 years ago

Ok, thank you. But everythink works appart Broadlink.

KTibow commented 3 years ago

@joramos21 I dunno what you mean. Just make a new topic there.

felipediel commented 3 years ago

@joramos21 We have changed many things recently. You need to read the docs, add the device via Integrations page and update your configuration. If you have any issue just ping me and I come back here to help you.

joramos21 commented 3 years ago

Hi, As you kindly proposed, I ask for your help. After having updated home assistant, I found the new Broadlink integration... great :-) I'm able to learn an ir command like this : image

And I'm able to send the learned command like this : image

And it works.

I tried to create a button but it didn't work. I don't understand how to do it. Then regarding RF signals, I read the doc. I can see I cannot proceed the same way as ir signals. I have plugs I use to turn on and off lights.

Thanks a lot. Jo

joramos21 commented 3 years ago

I tried like explained in the doc to add this in configuration.yaml but I get an error when checking configuration : script: Denon_Radio_Favorite1: sequence:

BlueTalon6 commented 3 years ago

I tried like explained in the doc to add this in configuration.yaml but I get an error when checking configuration : script: Denon_Radio_Favorite1: ...

Has that lost the indentation when you pasted it? If it looks exactly like that, you need to fix the indentation for it to be valid yaml.

joramos21 commented 3 years ago

I split configuration.yaml like this : group: !include groups.yaml automation: !include automations.yaml script: !include scripts.yaml scene: !include scenes.yaml

I think indentation is correct. In configuration.yaml I added "script:" before "Denon_Radio_Favorite1:" : image

I also tried to put it in the scripts.yaml file removing "script:"

felipediel commented 3 years ago

You cannot use capital letters for scripts.

joramos21 commented 3 years ago

So great, it works, thank you. Regarding RF, I read about all the different methods in the doc. Let's give it a try :-)

felipediel commented 3 years ago

I am still working on a service for learning RF commands, I will have to rebase the PR this week. For now, you can learn them using this library (as I explained before) and send using the b64: prefix.

joramos21 commented 3 years ago

Hi, How long do you think it will take to you ? Your work is great and I prefer to use your service, something reliable. Thank you.

felipediel commented 3 years ago

The PR is ready, now we are waiting for a review.