Commit bb3300e4 authored by Vassilis Panos's avatar Vassilis Panos
Browse files

Fixes Broadlink commands sequence #481

parent f1953904
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__)

DOMAIN = 'smartir'
VERSION = '1.13.1'
VERSION = '1.13.2'
MANIFEST_URL = (
    "https://raw.githubusercontent.com/"
    "smartHomeHub/SmartIR/{}/"
+28 −20
Original line number Diff line number Diff line
@@ -74,28 +74,36 @@ class BroadlinkController(AbstractController):

    async def send(self, command):
        """Send a command."""
        commands = []

        if not isinstance(command, list): 
            command = [command]

        for _command in command:
            if self._encoding == ENC_HEX:
                try:
                command = binascii.unhexlify(command)
                command = b64encode(command).decode('utf-8')
                    _command = binascii.unhexlify(_command)
                    _command = b64encode(_command).decode('utf-8')
                except:
                    raise Exception("Error while converting "
                                    "Hex to Base64 encoding")

            if self._encoding == ENC_PRONTO:
                try:
                command = command.replace(' ', '')
                command = bytearray.fromhex(command)
                command = Helper.pronto2lirc(command)
                command = Helper.lirc2broadlink(command)
                command = b64encode(command).decode('utf-8')
                    _command = _command.replace(' ', '')
                    _command = bytearray.fromhex(_command)
                    _command = Helper.pronto2lirc(_command)
                    _command = Helper.lirc2broadlink(_command)
                    _command = b64encode(_command).decode('utf-8')
                except:
                    raise Exception("Error while converting "
                                    "Pronto to Base64 encoding")

            commands.append('b64:' + _command)

        service_data = {
            ATTR_ENTITY_ID: self._controller_data,
            'command':  'b64:' + command
            'command':  commands
        }

        await self.hass.services.async_call(
+2 −2
Original line number Diff line number Diff line
@@ -7,8 +7,8 @@
  "requirements": ["aiofiles==0.5.0"],
  "homeassistant": "0.115.0",
  "updater": {
    "version": "1.13.1",
    "releaseNotes": "-- Adds support for the new Broadlink integration (Breaking change!)",
    "version": "1.13.2",
    "releaseNotes": "-- Fixes Broadlink commands sequence #481",
    "files": [
      "__init__.py",
      "climate.py",
+1 −1
Original line number Diff line number Diff line
{
  "name": "SmartIR",
  "homeassistant": "0.115.0b0",
  "homeassistant": "0.115.0",
  "persistent_directory": "codes"
}