Switches not showing up anymore

Hey!
I’ve finally managed to get everything working. After it worked, I turned off the raspberry and later on again. Then I was only able to open the interface via my mobile app. Safari just loaded the whole time without actually showing the page. I turned it off again, waited a day and now it works again.
Only problem is that it doesn’t show the switches anymore (also didn’t on mobile yesterday). Any ideas how to fix this?

This is my config for the switches:

#Broadlink
switch:
platform: broadlink
host: 192.168.0.6
mac: ‘the mac address’
timeout: 15
switches:
tv:
friendly_name: “Hisense TV”
command_on: ‘JgBoAB4aHRo4HRscHBwcHBwcGxwcNx4aOBwcAAsNGxweGjgcHBwcHBwcGxwcHBw3Hho3HRwACwwcHBwbOB0cGxwcHBwcHBwbHDccHDgdGwALDRwcGxw4HRscHBwcHBwcGxwcNxwcOBwcAA0F’
command_off: ‘JgBoAB4aHRo4HRscHBwcHBwcGxwcNx4aOBwcAAsNGxweGjgcHBwcHBwcGxwcHBw3Hho3HRwACwwcHBwbOB0cGxwcHBwcHBwbHDccHDgdGwALDRwcGxw4HRscHBwcHBwcGxwcNxwcOBwcAA0F’
channel_1:
friendly_name: “Channel 1”
command_on: ‘JgA4AB4aHhk6Gx4ZHhoeGh4aHhoeGR4aHhoeNR4ACvIeGh4aORseGh4ZHxkeGh4aHhoeGR4aHjUeAA0F’
channel_2:
friendly_name: “ZDF”
command_on: ‘JgAaAB8ZHho6Gh4aHhoeGh4aHhkeGh4aHjU6AA0FAAAAAAAAAAAAAAAAAAA’
channel_3:
friendly_name: “Sat 1”
command_on: ‘JgBUAB4aHhk6Gx4ZHhoeGh4aHhoeGR4aHjUeGh4ACvIeGh4aOhoeGh4aHhoeGR4aHhoeGh41HhoeAAryHhoeGjkbHhoeGR4aHhoeGh4aHhkeNR4aHgANBQAAAAA=’
channel_4:
friendly_name: “RTL”
command_on: ‘JgBOAB4aOhseGR4aHhoeGh4aHhkeGh41OhoeAAsRHho6Gh8ZHhoeGh4aHhkeGh4aHjU6Gh4ACxEeGjkbHhoeGR4aHhoeGh4aHhkeNTobHgANBQAAAAAAAAAAAAA=’
channel_5:
friendly_name: “RTL2”
command_on: ‘JgA0AB4aOhoeGh4aHhoeGR8ZHhoeGh41OjUeAArzHho6Gh4aHhoeGh4ZHxkeGh4aHjU6NR4ADQUAAAAA’
channel_6:
friendly_name: “VOX”
command_on: ‘JgBOAB8aORseGh4ZHhoeGh4aHhoeGR41Hho6AAsPHho6Gx4ZHhoeGh4aHhoeGR4aHjUeGjoACw8eGjobHhkeGh4aHhoeGR4aHhoeNR4aOgANBQAAAAAAAAAAAAA=’
channel_7:
friendly_name: “Pro 7”
command_on: ‘JgA4AB8ZHho6Gh4aHhoeGh4ZHxkeGh41HhoeGR8ACvIeGh4aOhoeGh4aHhkeGh4aHhoeMiEZHxkeAA0F’
channel_8:
friendly_name: “ZDF Neo”
command_on: ‘JgAaAB4aHho6Gh4aHhkfGR4aHhoeNToaHhoeAA0FAAAAAAAAAAAAAAAAAAA=’
channel_9:
friendly_name: “kabel eins”
command_on: ‘JgA0AB8ZHxk6Gx4ZHhoeGh4aHhkfNDobHjUeAArxHhoeGjoaHhoeGh4aHhodGh41OhofNB8ADQUAAAAA’
light:
friendly_name: “Light”
command_on: ‘sg4yAAsXChcUDgsYChgLGBQOFA4KFwsXFQ4KGBQOFA4LGAoXCxgKGR4AAQcVDhQOCxcKGAoYAAAAAAAA’
command_off: ‘sg4yAAsXChcUDgsYChgLGBQOFA4KFwsXFQ4KGBQOFA4LGAoXCxgKGR4AAQcVDhQOCxcKGAoYAAAAAAAA’
color_switch:
friendly_name: “Color Switch”
command_on: ‘sgYyAAsXChcVDQsYChgKGBUOFA4LFwsXFA4KGBQOFA4UDgoYFA4LGB8AAQcVDhQOCxcLGAoYAAAAAAAA’
light_bulb:
friendly_name: “Light Bulb”
command_on: ‘sg0yAAoYCxcUDgsXCxgKGBQOFA4KFwsXFA0LGBQOFA4UDhQOChgKGR4AAQcVDhQOChgKGAoYAAAAAAAA’
command_off: ‘sg0yAAoYCxcUDgsXCxgKGBQOFA4KFwsXFA0LGBQOFA4UDhQOChgKGR4AAQcVDhQOChgKGAoYAAAAAAAA’

The logfile says this after restarting:

Thu Aug 09 2018 13:14:35 GMT+0200 (CEST)
Error while setting up platform broadlink
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 129, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/switch/broadlink.py”, line 157, in setup_platform
device_config.get(CONF_COMMAND_OFF)
File “/usr/local/lib/python3.6/site-packages/homeassistant/components/switch/broadlink.py”, line 193, in init
self._command_on = b64decode(command_on) if command_on else None
File “/usr/local/lib/python3.6/base64.py”, line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

First off your config is damn hard to read without formatting correctly.

I would say the issue you have is you have no command_off on some switches, which according to the docs is required.


If i recall when i was using broadlink (using Harmony now) just adding command_off: is enough

sorry for that! I copied it like that directly and when I click on Edit it all looks good.

I tried to add command_off with the same code as in command_on , but it’s still not shown in the overview. I also can’t access it with Alexa

Is the log any different after adding command_off?

Maybe check the basics.

Can you control broadlink from the broadlink app?
Double check the broadlink IP hasn’t changed

This error usually means the switches are not divisible by 4, so add == to the end of each switch line until they are divisible by 4.

So that means I should write it like this?

switches:
  tv:
    friendly_name: “Hisense TV”
    command_on: ‘JgBoAB4aHRo4HRscHBwcHBwcGxwcNx4aOBwcAAsNGxweGjgcHBwcHBwcGxwcHBw3Hho3HRwACwwcHBwbOB0cGxwcHBwcHBwbHDccHDgdGwALDRwcGxw4HRscHBwcHBwcGxwcNxwcOBwcAA0F’
    command_off: ‘JgBoAB4aHRo4HRscHBwcHBwcGxwcNx4aOBwcAAsNGxweGjgcHBwcHBwcGxwcHBw3Hho3HRwACwwcHBwbOB0cGxwcHBwcHBwbHDccHDgdGwALDRwcGxw4HRscHBwcHBwcGxwcNxwcOBwcAA0F’
    ==
  channel_1:

No you should count the number of of characters for e.g. your command_on (the string starting with JgB) and then divide it by 4. If you get a nice round number you’re good. If not, you should add 1, 2 or 3 equal signs (=) at the end of the string. Add as many as needed to be able to divide by 4. The ='s should be inside the quotes.

I usually copy my string to Word because it has a feature for counting characters.

1 Like

Thanks! That was the magic. Added the == and now it’s showing up again :slight_smile:

This burnt me as well just now. This is really unreasonable. I used the packet generated by the broadlink switch and that is invalid without the == added. Why doesnt the broadlink switch(homeassistant component code) do this automatically? Is it just a matter of a PR waiting to be made?