Broadlink switch configuration

Hello ppl!
Sorry for stupid question, but I’m a bit confused with configuration.yaml and Broadlink switch.
so I got my basic configuration like this:

switch:
  - platform: broadlink
    host: 192.168.0.105
    mac: '78:0F:77:00:DE:18'
    timeout: 10
    switches:
      tv_lg:
        friendly_name: "LGTV"
        command_on: 'JgBgAAABKZMTEhQRFDYUEhMSExIUERQSEzcTNxMSEzcUNhQ2FDYUNhMTExITEhM3FRETEhMSExIUNhQ3EjgTEhQ2EjgUNhM3FAAFHwABKUkTAAxgAAEpSRMADF8AASlJEwANBQAAAAAAAAAA'
        command_off: 'JgBgAAABKZMTEhQRFDYUEhMSExIUERQSEzcTNxMSEzcUNhQ2FDYUNhMTExITEhM3FRETEhMSExIUNhQ3EjgTEhQ2EjgUNhM3FAAFHwABKUkTAAxgAAEpSRMADF8AASlJEwANBQAAAAAAAAAA'
      tv_lg_hdmi1_hdmi2:
        friendly_name: "LG TV HDMI12"
        command_on: 'JgBIAAABIZMRExITEjYSExMRERURExEUEDkRNxEUEjYSNhM3ETcSNxITETgSNhI2ExMQExE4ETYSNxIUERMSExE4ETcRFBETEQANBQ=='
        command_off: 'JgBQAAABJJMSEhISETgSEhITEBMSEhMSETcSNxMREjcSNxI3EjcSOBETERITNhM2EhITERM2EzcRNxI3ExISEhI3EjcRExETEgAFLQABJEoRAA0FAAAAAAAAAAA='
      tv_lg_hdmi3:
        friendly_name: "LG TV HDMI3"
        command_on: 'JgBIAAABIZMSFBISETgRExEUERQQFBETEjcTNhMSETgRNxE3EjcROBM2ERMSFBE4ERMSNxM2EjUSFBE2ETgRExM2ExITEhATEwANBQ=='      

Thats what I get:

But than I add my dumb fan controlled by infrared remote

    switch:
  - platform: broadlink
    host: 192.168.0.105
    mac: '78:0F:77:00:DE:18'
    timeout: 10
    switches:
      tv_lg:
        friendly_name: "LGTV"
        command_on: 'JgBgAAABKZMTEhQRFDYUEhMSExIUERQSEzcTNxMSEzcUNhQ2FDYUNhMTExITEhM3FRETEhMSExIUNhQ3EjgTEhQ2EjgUNhM3FAAFHwABKUkTAAxgAAEpSRMADF8AASlJEwANBQAAAAAAAAAA'
        command_off: 'JgBgAAABKZMTEhQRFDYUEhMSExIUERQSEzcTNxMSEzcUNhQ2FDYUNhMTExITEhM3FRETEhMSExIUNhQ3EjgTEhQ2EjgUNhM3FAAFHwABKUkTAAxgAAEpSRMADF8AASlJEwANBQAAAAAAAAAA'
      tv_lg_hdmi1_hdmi2:
        friendly_name: "LG TV HDMI12"
        command_on: 'JgBIAAABIZMRExITEjYSExMRERURExEUEDkRNxEUEjYSNhM3ETcSNxITETgSNhI2ExMQExE4ETYSNxIUERMSExE4ETcRFBETEQANBQ=='
        command_off: 'JgBQAAABJJMSEhISETgSEhITEBMSEhMSETcSNxMREjcSNxI3EjcSOBETERITNhM2EhITERM2EzcRNxI3ExISEhI3EjcRExETEgAFLQABJEoRAA0FAAAAAAAAAAA='
      tv_lg_hdmi3:
        friendly_name: "LG TV HDMI3"
        command_on: 'JgBIAAABIZMSFBISETgRExEUERQQFBETEjcTNhMSETgRNxE3EjcROBM2ERMSFBE4ERMSNxM2EjUSFBE2ETgRExM2ExITEhATEwANBQ=='      
      fan:
        friendly_name: "fan"
        command_on: 'gA4ASsOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDygrDQ8AAQYqDioNDikqDykODikOKQ8oDykPKCsODgABBioOKg4OKCsOKQ4OKQ4pDykOKQ8pKg0PAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDg4AAQYrDikODikqDSsNDikPKQ4pDygPKSoODgABBisOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDikrDQ4AAQcqDSsNDikqDioNDykOKQ4pDykOKSsNDgABByoOKg4OKCsOKQ4OKQ4pDykOKQ8pKg4OAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDQ8AAQYrDikODikqDSsNDygPKQ4pDygPKSsMDwANBQ=='
        command_off: 'JgA4ASsOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDygrDQ8AAQYqDioNDikqDykODikOKQ8oDykPKCsODgABBioOKg4OKCsOKQ4OKQ4pDykOKQ8pKg0PAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDg4AAQYrDikODikqDSsNDikPKQ4pDygPKSoODgABBisOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDikrDQ4AAQcqDSsNDikqDioNDykOKQ4pDykOKSsNDgABByoOKg4OKCsOKQ4OKQ4pDykOKQ8pKg4OAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDQ8AAQYrDikODikqDSsNDygPKQ4pDygPKSsMDwANBQ=='

As a result I get this:

homeassistant.log

    2018-08-06 16:34:41 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform broadlink
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, 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 "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 157, in setup_platform
    device_config.get(CONF_COMMAND_OFF)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 193, in __init__
    self._command_on = b64decode(command_on) if command_on else None
  File "/usr/lib/python3.5/base64.py", line 88, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

Also I would like to know how to change icons of the diveces I cotrol via broadlink and if it is possible to make turn on and off toggle at Home Assistant Overview instead buttons for on and offPreformatted text

Please use code blocks and syntax highlighting as indicated on top of this page.

Thank you, edited

    switch:
  - platform: broadlink

Should be

switch:
  - platform: broadlink

Just edited, but nothing happend problem is not about it

Are you sure? did you reload the configuration?

checked it twice, got this mistakes at home-assistant.log

2018-08-06 17:45:17 WARNING (MainThread) [homeassistant.components.http] You have been advised to set http.api_password.
2018-08-06 17:45:22 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform broadlink
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, 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 "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 157, in setup_platform
    device_config.get(CONF_COMMAND_OFF)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 193, in __init__
    self._command_on = b64decode(command_on) if command_on else None
  File "/usr/lib/python3.5/base64.py", line 88, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

From the docs;

command_off (Required)

the thing is that all the devices controlled by broadlink disappear write after adding

fan:
    friendly_name: "fan"
    command_on: 'gA4ASsOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDygrDQ8AAQYqDioNDikqDykODikOKQ8oDykPKCsODgABBioOKg4OKCsOKQ4OKQ4pDykOKQ8pKg0PAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDg4AAQYrDikODikqDSsNDikPKQ4pDygPKSoODgABBisOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDikrDQ4AAQcqDSsNDikqDioNDykOKQ4pDykOKSsNDgABByoOKg4OKCsOKQ4OKQ4pDykOKQ8pKg4OAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDQ8AAQYrDikODikqDSsNDygPKQ4pDygPKSsMDwANBQ=='
    command_off: 'JgA4ASsOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDygrDQ8AAQYqDioNDikqDykODikOKQ8oDykPKCsODgABBioOKg4OKCsOKQ4OKQ4pDykOKQ8pKg0PAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDg4AAQYrDikODikqDSsNDikPKQ4pDygPKSoODgABBisOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDikrDQ4AAQcqDSsNDikqDioNDykOKQ4pDykOKSsNDgABByoOKg4OKCsOKQ4OKQ4pDykOKQ8pKg4OAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDQ8AAQYrDikODikqDSsNDygPKQ4pDygPKSsMDwANBQ=='
        indent preformatted text by 4 spaces

HDMI works well without turn off command.

Just tried like this:

switch:
  - platform: broadlink
    host: 192.168.0.105
    mac: '78:0F:77:00:DE:18'
    timeout: 10
    switches:
      tv_lg:
        friendly_name: "LGTV"
        command_on: 'JgBgAAABKZMTEhQRFDYUEhMSExIUERQSEzcTNxMSEzcUNhQ2FDYUNhMTExITEhM3FRETEhMSExIUNhQ3EjgTEhQ2EjgUNhM3FAAFHwABKUkTAAxgAAEpSRMADF8AASlJEwANBQAAAAAAAAAA'
        command_off: 'JgBgAAABKZMTEhQRFDYUEhMSExIUERQSEzcTNxMSEzcUNhQ2FDYUNhMTExITEhM3FRETEhMSExIUNhQ3EjgTEhQ2EjgUNhM3FAAFHwABKUkTAAxgAAEpSRMADF8AASlJEwANBQAAAAAAAAAA'
      fan:
        friendly_name: "fan"
        command_on: 'gA4ASsOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDygrDQ8AAQYqDioNDikqDykODikOKQ8oDykPKCsODgABBioOKg4OKCsOKQ4OKQ4pDykOKQ8pKg0PAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDg4AAQYrDikODikqDSsNDikPKQ4pDygPKSoODgABBisOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDikrDQ4AAQcqDSsNDikqDioNDykOKQ4pDykOKSsNDgABByoOKg4OKCsOKQ4OKQ4pDykOKQ8pKg4OAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDQ8AAQYrDikODikqDSsNDygPKQ4pDygPKSsMDwANBQ=='
        command_off: 'JgA4ASsOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDygrDQ8AAQYqDioNDikqDykODikOKQ8oDykPKCsODgABBioOKg4OKCsOKQ4OKQ4pDykOKQ8pKg0PAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDg4AAQYrDikODikqDSsNDikPKQ4pDygPKSoODgABBisOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDikrDQ4AAQcqDSsNDikqDioNDykOKQ4pDykOKSsNDgABByoOKg4OKCsOKQ4OKQ4pDykOKQ8pKg4OAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDQ8AAQYrDikODikqDSsNDygPKQ4pDygPKSsMDwANBQ=='

Anyway, Switch box disappeares after restart and home-assistant.log shows mistakes:

2018-08-06 18:10:41 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform broadlink
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 129, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, 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 "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 157, in setup_platform
    device_config.get(CONF_COMMAND_OFF)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 193, in __init__
    self._command_on = b64decode(command_on) if command_on else None
  File "/usr/lib/python3.5/base64.py", line 88, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

I believe you can no longer have friendly names in the config. Try removing all the friendly names and restart home assistant.

If that works you can configure friendly names in customize.yaml or maybe even in the front end with the new feature added in 0.75.1

unfortunely, didnt work for me, just tried deleting friendly names, but as soon as I add my fan everything disapear

 switch:
  - platform: broadlink
    host: 192.168.0.105
    mac: '78:0F:77:00:DE:18'
    timeout: 10
    switches:
      tv_lg:
        command_on: 'JgBgAAABKZMTEhQRFDYUEhMSExIUERQSEzcTNxMSEzcUNhQ2FDYUNhMTExITEhM3FRETEhMSExIUNhQ3EjgTEhQ2EjgUNhM3FAAFHwABKUkTAAxgAAEpSRMADF8AASlJEwANBQAAAAAAAAAA'
        command_off: 'JgBgAAABKZMTEhQRFDYUEhMSExIUERQSEzcTNxMSEzcUNhQ2FDYUNhMTExITEhM3FRETEhMSExIUNhQ3EjgTEhQ2EjgUNhM3FAAFHwABKUkTAAxgAAEpSRMADF8AASlJEwANBQAAAAAAAAAA'
      fan:
        command_on: 'gA4ASsOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDygrDQ8AAQYqDioNDikqDykODikOKQ8oDykPKCsODgABBioOKg4OKCsOKQ4OKQ4pDykOKQ8pKg0PAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDg4AAQYrDikODikqDSsNDikPKQ4pDygPKSoODgABBisOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDikrDQ4AAQcqDSsNDikqDioNDykOKQ4pDykOKSsNDgABByoOKg4OKCsOKQ4OKQ4pDykOKQ8pKg4OAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDQ8AAQYrDikODikqDSsNDygPKQ4pDygPKSsMDwANBQ=='
        command_off: 'JgA4ASsOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDygrDQ8AAQYqDioNDikqDykODikOKQ8oDykPKCsODgABBioOKg4OKCsOKQ4OKQ4pDykOKQ8pKg0PAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDg4AAQYrDikODikqDSsNDikPKQ4pDygPKSoODgABBisOKQ4OKSoNKw0PKA8pDikPKQ4pKg4OAAEHKg4pDg4pKg4qDg4oDykOKQ8pDikrDQ4AAQcqDSsNDikqDioNDykOKQ4pDykOKSsNDgABByoOKg4OKCsOKQ4OKQ4pDykOKQ8pKg4OAAEGKw0qDg4pKg4pDg4pDygPKQ8oDykqDQ8AAQYrDikODikqDSsNDygPKQ4pDygPKSsMDwANBQ=='

I think this means that the command is not divisible by 4 so keep adding == to the end of the command till it’s divisible by 4.

1 Like

Thanks you! It works now!

Any idea about my second question? I suppose, there must be manuals I didnt find, yet

“I would like to know how to change icons of the diveces I cotrol via broadlink and if it is possible to make turn on and off toggle at Home Assistant Overview instead buttons for on and off”

I believe you can use customize to change the mdi: icons for the switches to whatever you like provided they are mdi icons or jpg’s…

You may be able to change the behavior to toggles but I honestly don’t know, maybe someone else will chime in for that.

1 Like