Closed
Description
Home Assistant release (hass --version
):
0.60.0
Python release (python3 --version
):
3.5.3
Component/platform:
switch/broadlink
Description of problem:
When the broadlink switch configuration is parsed the parser fails if the base64 string (generated by HA) is not padded to 4 characters:
2018-01-01 11:46:04 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform broadlink
Traceback (most recent call last):
File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 171, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=self.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 "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 153, in setup_platform
device_config.get(CONF_COMMAND_OFF)
File "/home/pi/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/broadlink.py", line 188, 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
The base64 strings are produced by the broadlink.learn_command
service.
Expected:
Problem-relevant configuration.yaml
entries and steps to reproduce:
irrelevant1:
friendly_name: "HDMI switcher Sky"
command_on: 'JgBQAAABLJMTEhMSExITEhMSExITEhMSEzcSNxM3EzcSNxM3EzcSNxMSEzcTEhM3ExISExITEhMSNxMSEzcTEhI2FDcTNxM3EgAFGQABKkkTAA0FAAAAAAAAAAA'
Add ===
to the end of the string and it is fine.
Additional info:
This has been fixed for the send_packet service by #7669