home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.38k stars 30.64k forks source link

Broadlink Remote Learning Issue #34450

Closed akator70 closed 4 years ago

akator70 commented 4 years ago

The problem

Just tried to program an IR remote with a Broadlink RM Mini "Bean." The normal notifications activated by a learning script, i.e., "press power" are not persistent and flicker by. It is impossible to learn or relearn a remote.

Environment

Problem-relevant configuration.yaml

`learn_apple_remote_g4_imac: alias: Learn Apple Remote for G4 iMac sequence:

Traceback/Error logs

Additional information

probot-home-assistant[bot] commented 4 years ago

Hey there @danielhiversen, @felipediel, mind taking a look at this issue as its been labeled with a integration (broadlink) you are listed as a codeowner for? Thanks!

felipediel commented 4 years ago

@caalexis The captures are in the .storage folder. The file starts with broadlink_remote and ends with codes.json. You can send the command using remote.send_command, you don't need to see the code (unless you want to set up a switch).

akator70 commented 4 years ago

@felipediel, thanks for the reply.

The issue is that I can no longer get HA to learn a remote. When the script runs to learn the remote, the notifications flash by, disappear, and end in less than a second. There isn't a chance to push a button for HA to learn anything.

I tried rebooting HA and programming a remote from different computers, the results were the same.

There are no new remote codes in the files because HA never learned them.

felipediel commented 4 years ago

I need to debug you. Please run this file using python3 debug.py. If the LED blinks, capture a code. Then send me debug.txt.

akator70 commented 4 years ago

The only way I know of running the python script is from my python_scripts folder and the Developer Tools Call Service. (If there is a better way, please point me in the correct direction.) I didn't get a light on any of my Broadlink devices. There was no debug.txt but I copied this from the log.

2020-04-20 06:49:08 ERROR (SyncWorker_12) [homeassistant.components.python_script] Error loading script debug.py: Line 51: "_LOGGER" is an invalid variable name because it starts with "_", Line 51: "__name__" is an invalid variable name because it starts with "_", Line 160: "_LOGGER" is an invalid variable name because it starts with "_", Line 166: "_LOGGER" is an invalid variable name because it starts with "_", Line 180: "_LOGGER" is an invalid variable name because it starts with "_", Line 255: "_LOGGER" is an invalid variable name because it starts with "_", Line 259: "_LOGGER" is an invalid variable name because it starts with "_", Line 264: "_LOGGER" is an invalid variable name because it starts with "_", Line 270: "_LOGGER" is an invalid variable name because it starts with "_", Line 319: "_LOGGER" is an invalid variable name because it starts with "_", Line 328: "_LOGGER" is an invalid variable name because it starts with "_", Line 332: "_LOGGER" is an invalid variable name because it starts with "_", Line 339: "__init__" is an invalid attribute name because it starts with "_"., Line 403: "__init__" is an invalid attribute name because it starts with "_"., Line 412: "_encode" is an invalid attribute name because it starts with "_"., Line 414: "_decode" is an invalid attribute name because it starts with "_"., Line 433: "_encode" is an invalid attribute name because it starts with "_"., Line 435: "_decode" is an invalid attribute name because it starts with "_"., Line 437: "_encode" is an invalid variable name because it starts with "_", Line 458: "_decode" is an invalid variable name because it starts with "_", Line 470: "__init__" is an invalid attribute name because it starts with "_"., Line 481: "__init__" is an invalid attribute name because it starts with "_"., Line 547: "__init__" is an invalid attribute name because it starts with "_"., Line 627: "__init__" is an invalid attribute name because it starts with "_"., Line 629: "_request_header" is an invalid attribute name because it starts with "_"., Line 630: "_code_sending_header" is an invalid attribute name because it starts with "_"., Line 633: "_request_header" is an invalid attribute name because it starts with "_"., Line 640: "_request_header" is an invalid attribute name because it starts with "_"., Line 643: "_code_sending_header" is an invalid attribute name because it starts with "_"., Line 649: "_request_header" is an invalid attribute name because it starts with "_"., Line 654: "_request_header" is an invalid attribute name because it starts with "_"., Line 659: "_request_header" is an invalid attribute name because it starts with "_"., Line 664: "_request_header" is an invalid attribute name because it starts with "_"., Line 671: "_request_header" is an invalid attribute name because it starts with "_"., Line 676: "_request_header" is an invalid attribute name because it starts with "_"., Line 683: "_request_header" is an invalid attribute name because it starts with "_"., Line 688: "_request_header" is an invalid attribute name because it starts with "_"., Line 695: "_request_header" is an invalid attribute name because it starts with "_"., Line 705: "__init__" is an invalid attribute name because it starts with "_"., Line 707: "_request_header" is an invalid attribute name because it starts with "_"., Line 708: "_code_sending_header" is an invalid attribute name because it starts with "_"., Line 714: "__init__" is an invalid attribute name because it starts with "_"., Line 724: "__init__" is an invalid attribute name because it starts with "_"., Line 913: "__init__" is an invalid attribute name because it starts with "_"., Line 934: "_name" is an invalid variable name because it starts with "_", Line 935: "_order" is an invalid variable name because it starts with "_", Line 936: "_type" is an invalid variable name because it starts with "_", Line 937: "_serial" is an invalid variable name because it starts with "_", Line 939: "_type" is an invalid variable name because it starts with "_", Line 943: "_name" is an invalid variable name because it starts with "_", Line 945: "_order" is an invalid variable name because it starts with "_", Line 946: "_serial" is an invalid variable name because it starts with "_", Line 959: "__init__" is an invalid attribute name because it starts with "_"., Line 962: "_send" is an invalid variable name because it starts with "_", Line 978: "_send" is an invalid attribute name because it starts with "_"., Line 981: "_send" is an invalid attribute name because it starts with "_"., Line 984: "_send" is an invalid attribute name because it starts with "_"., Line 987: "_send" is an invalid attribute name because it starts with "_"., Line 1039: "__name__" is an invalid variable name because it starts with "_", Line 1045: "_LOGGER" is an invalid variable name because it starts with "_", Line 1048: "_LOGGER" is an invalid variable name because it starts with "_", Line 1055: "_LOGGER" is an invalid variable name because it starts with "_", Line 1056: "_LOGGER" is an invalid variable name because it starts with "_", Line 1057: "_LOGGER" is an invalid variable name because it starts with "_", Line 1058: "_LOGGER" is an invalid variable name because it starts with "_", Line 1060: "_LOGGER" is an invalid variable name because it starts with "_", Line 1062: "_LOGGER" is an invalid variable name because it starts with "_", Line 1067: "_LOGGER" is an invalid variable name because it starts with "_", Line 1077: "_LOGGER" is an invalid variable name because it starts with "_", Line 1079: "_LOGGER" is an invalid variable name because it starts with "_", Line 1081: "_LOGGER" is an invalid variable name because it starts with "_"
felipediel commented 4 years ago

You don't need to run the script on the server, you can run it on your computer's terminal. Open the terminal in the download folder and type python3 debug.py. If you don't have Python 3, you need to download it first.

boggiano commented 4 years ago

@felipediel I have the same problem: I am on HA 0.108.5 but I am using broadlink component, as custom_component, from 0.107 since a bug in the current version (issue #33879). Using service broadlink.learn in this situation I get always 'AAAAAAAAAAAAAAAA' as return code.

Switching to broadlink 0.108.5 component I get "no code received". Here the debug.txt. debug.txt

Thanks!

felipediel commented 4 years ago

@boggiano Your device is working ok. If your problem is https://github.com/home-assistant/core/issues/33879, it is already solved. Now you just have to wait for the next release - or, if you're in a hurry, you can manually update __init__.py in the library folder.

Please note that we do not solve issues related to custom_components/broadlink folder. Make sure to remove any code from there before testing. If you do and it works, please let me know.

boggiano commented 4 years ago

@felipediel thank you very much but #33879 should be related to sending command, not learning. As I said, learning is not working in 0.12 (my custom_component from .107) as I am getting always 'AAAAAAA', and in 0.13 (component of .108.5) as I am getting "not code received". Did I misunderstand ?

Thanks

felipediel commented 4 years ago

Please remove the legacy code from custom_components/broadlink folder and update the library to the latest version (0.13.2). Let me know if it worked.

felipediel commented 4 years ago

@boggiano @caalexis Would you mind checking if this solution solves your problems?

brianpierson2020 commented 4 years ago

@felipediel I see you're quite active with Broadlink devices :). I would like to get this to your attention: https://github.com/home-assistant/core/issues/25943#issuecomment-620917060

Maybe it is helpful :).

Andrew49 commented 4 years ago

Hi, Similar problem here, remote.learn not receiving any RF code. Using an RMPro+, purchased last year (I tried and tried without success, gave up, decided to try again now). It is found by Broadlink Manager (Windows) as "RM2 Pro Plus3". I'm running HA 0.110.2 as a generic Linux install in Docker, on an Intel NUC. I had the same issue previously with 109.x versions. This error comes up now in the homeassistant log when I try to learn an RF code using the remote.learn_command service: 2020-05-31 19:35:02 ERROR (MainThread) [homeassistant.components.broadlink.remote] Failed to learn 'Turn on/kitchen_blind': No code received RM2 Pro Plus3 is not listed as an available type in the HA Broadlink docs - so I have tried with RM2 Pro Plus2 and RM2 Pro Plus. Is it possible to add "RM2 Pro Plus3" as a working code, please?

felipediel commented 4 years ago

@Andrew49 RF is not yet supported. I will add this feature as soon as I finish implementing config entries.

Andrew49 commented 4 years ago

Ah, OK, thanks for the clarification. That explains it. Any feel for the probable timescale for the feature addition?

felipediel commented 4 years ago

It will take some time. We have a huge update on the way.

Andrew49 commented 4 years ago

Many thanks, felipediel, for your response. Good luck with the update! :-) Would it help if I were to add a separate issue for my RM2 Pro Plus3 problem, so that it doesn't get lost?

effelle commented 4 years ago

Seems a bit related to my issue. I have a RM Mini 3 (old device) working fine with broadlink/switch setup (110.4), but I can't get it working with the new remote:

entity_id: remote.rm_mini_3
device: television
command: Turn on
alternative: true
timeout: 30
Log Details (ERROR)
Logger: homeassistant.components.broadlink.remote
Source: components/broadlink/remote.py:306
Integration: broadlink (documentation, issues)
First occurred: 10:26:11 AM (2 occurrences)
Last logged: 10:38:19 AM

Failed to learn 'Turn on/television': Command not supported 

Seems I need to declare the device first in some way? And if true, how?

felipediel commented 4 years ago

@Andrew49 This is not necessary, we already have an open issue for that.

@effelle You need to specify the correct type in the config. Use type: rm_mini3_newblackbean.

effelle commented 4 years ago

Is already a rm_mini3_newblackbean

remote:
  - platform: broadlink
    host: 192.168.15.140
    mac: xx:xx:xx:xx:xx:xx
    type: rm_mini3_newblackbean
    name: "RM Mini 3"

Anyway problem solved, beside the possibility to learn multiple IR code at the same time I don't see a real advantage, since you need to add manually the YAML for the switches anyway. I'll continue to use broadlink.learn.

felipediel commented 4 years ago

@effelle broadlink.learn will be deprecated.

remote.learn_command has many advantages, including:

  1. Support for toggle commands.
  2. You can combine num_repeats and jinja templates to control volume.
  3. Real-time learning without the need for a restart.
  4. Learn more than 300 codes in less than 3 minutes.
  5. Isolate config file from codes, making the config more readable and shareable.

Read the docs for more information.

effelle commented 4 years ago

Felipe, I had read the doc and still is not working for me, showing the error above on both service call and script. Perhaps something is missing in the docs to explain better how it should be configured/work?

Edit: Omitting the type will trigger the service.

felipediel commented 4 years ago

If it worked without the type, your device is not the new Blackbean and you can omit the type. The configuration is the same as the switch. What works for one works for the other.

felipediel commented 4 years ago

Soon it will no longer be necessary to inform the type. I'm working on it.

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.