Broadlink RM-PRO and A1 sensor

Check you logs after you have started HA.

I think this is the error it is throwing:

17-01-29 21:42:03 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform broadlink
Traceback (most recent call last):
  File "/home/ubuntu/ha/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/ubuntu/ha/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 115, in setup_platform
    device_config.get(CONF_COMMAND_OFF)
  File "/home/ubuntu/ha/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 141, in __init__
    self._command_on = b64decode(command_on) if command_on else None
  File "/home/ubuntu/ha/lib/python3.5/base64.py", line 88, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

Something is wrong with your code. binascii.Error: Incorrect padding
Try to relearn that code.
The same problem have been discussed several times before in the forum

Thanks, you are right. I re-learnt them using call service. I guess i wasnt expecting them to be parsed before being sent out.

Just a bit strange losing the switch interface as a symptom. Still new to HA, so thanks for helping out so quickly.

I can’t see it! Any suggestion? Thanks for everything

Where are the other sensors you have?
The first configuration.yaml that comes with the fresh install has already a sensor instance… have you created another one or erased that?

First check you only have ONE place written “sensor:” in your yaml file.
If you have already one, you must join them, or create a “sensor 2:”

Try exactly like this (with same indentation as well):

sensor:
  - platform: broadlink
    name: "Room"
    update_interval: 60
    host: 192.168.0.77
    mac: 'b4:43:0d:fb:f6:38'
    monitored_conditions:
      - temperature
      - humidity
      - air_quality
      - light
      - noise

changing of course the IP and MAC with those you got from E-Control and your DHCP router config (assign a fixed DHCP based on the MAC on router)

1 Like

thanks for some reason this works

Do you know how to fix this?

Fix what? It looks correct to me

Hi I followed oliverdog steps to capture the codes for my RF plugs, the components page has been updated with them:

My config is just standard:

forget it! Just a mistake. Thanks for your help. Regards

This function would be perfect for me as I could then control some out of sight devices within an activity from my Harmony.

hello ppl i need help, my switch dont show me on HA.

configuration.yaml
switch: !include switches.yaml

Groups.
family_info:
name: Família
entities:
- sensor.rodolfo
- sensor.phone_battery
- script.backup
- sensor.ultimoboot
- switch.broadlink_switch

switches.yaml

  • platform: broadlink
    host: 192.168.1.66
    mac: ‘b4:44:0d:f9:1d:04’
    switches:
    name:
    friendly_name: ‘reciever’
    command_on: ‘JgBUAFATExQnEyYUJxMUEyYUFBMnExQTExQTExQAAx5NFBIVJhQmFCcTFBMnExMUJxMTFBMTExQUAAMeTRQSFCcTJxQnExMUJhQSFSYUExMTFBQTFAANBQAAAAA=’
    command_off: ‘JgBUAFATExQnEyYUJxMUEyYUFBMnExQTExQTExQAAx5NFBIVJhQmFCcTFBMnExMUJxMTFBMTExQUAAMeTRQSFCcTJxQnExMUJhQSFSYUExMTFBQTFAANBQAAAAA=’

what is wrong??

thanks

SOLVED: change switch.broadlink_switch to switch.reciever

Hi, new to all this and installed HA in Docker for Windows and an RM Pro a few days ago initially to control a bunch of RF sockets.

After first set up I used the call service to learn the on and off code for one of the sockets so I had something to play with. It learnt the codes perfectly and all was good. Now I’m happy with the basics I wanted to learn a few more sockets.

Now however, the call service doesn’t trigger the RM Pro until the third press, and it’s always the third, and then the returned code is always is always the same non working code regardless of which button on the remote is pressed…

AivhDjieV35vEc5tpYREXQsfCx8gCwsfCx8fCwAAAAAAAAAA

… but sometimes with more or less As on the end. I have checked the remote and the RM Pro through the remote app and it learns the codes perfectly first time.

Any ideas gratefully received.

I got those error when learning some codes long time ago…
I think you should just restart HA every time you start getting those wrong codes until you get all you need. After that it will works fine.

1 Like

Thanks for the reply. Should just restarting through the call service in the front end be ok or should it be some more elaborate method?

In my cases, a simple restart through front end was enough most times, but sometimes a hardware Pi reset was necessary.

1 Like

Sorry to be going back in time on this thread but was just reading through this thread and noticed your comments about not being able to detect IR state. I have been grappling with this for a day or so and have this work around. Involves adding a physical switch to the device but I feel its warranted.
This is how I solved my stateless IR problem. Issue I had was IR based devices - e.g. a fan, doesn’t always represent a true state in HA. If we restart HA the state is reset to off. By adding a real switch like an Orvibo S20 or Broadlink SP mini to the power socket and running an automation to check the state of that switch with triggered actions to send the IR codes to actually turn the fan on we can have a true know state at any time. Only exception of course is if we use IR via a non HA device to turn it off. With this approach we know that turning it off is a guaranteed state and then the turn on will also be a guaranteed know state.

automation:
trigger:
platform: template
value_template: “{% if is_state(‘switch.bedroom_fan’, ‘on’) %}true{% endif %}”
action:
- delay: 00:00:03
- service: switch.turn_on
entity_id:
- switch.bedroom_fan_power
- switch.bedroom_fan_light

You’re right, restarted more than a dozen times while fiddling with the config and it suddenly started properly working again.

Thanks for saving me from thinking I’d broken something and starting over!

Hey guys ive been struggling with this for days now I have an RM pro plus and Im trying to get it to connect to HA.
I’m hoping its just something wrong with my yaml but i have tried about every possible config and I havent even been able to get the broadlink service to pop up under dev services tab to even learn codes.
This is my config maybe theres something wrong with it?

switch:

  • platform: broadlink
    host: 10.0.0.4
    mac: ‘B4.43.0D.EE.F7.1F’
    switches:
    reciever:
    command_on: ‘switch_packet on’
    command_off: ‘switch_packet off’

Do i need to make up the 64 code to get it to show up in the first place or should it just work since the platform is there?