8000 Broadlink base64 padding causes switch error on startup · Issue #11408 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Broadlink base64 padding causes switch error on startup #11408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
molexx opened this issue Jan 1, 2018 · 2 comments
Closed

Broadlink base64 padding causes switch error on startup #11408

molexx opened this issue Jan 1, 2018 · 2 comments

Comments

@molexx
Copy link
molexx commented Jan 1, 2018

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

@balloobbot
Copy link

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 👍

@balloobbot
Copy link

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍

7104

@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants
0