I downloaded the getBroadlinkSharedData.py file and add these lines; import base64 to the top and then code = base64.b64encode(code+code) below code = ''.join('%02x' % (i & 0xff) for i in jsonIrCodeData[i]['code'])
OK. I have revert it back to the original version but with modified line 148
But what I am confuse on is how to get the base64 code you are getting. Based on your original getBroadlinkSharedData.py, let say from there the hex code I got is…
thanks but it is still not working. actually I am unsure of one thing in the documentation. The device MAC address I need to put in is the MAC address of my RM Pro which can be obtained from the router, right?
homeassistant.core: Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/lib/python3.4/asyncio/tasks.py", line 233, in _step
result = coro.throw(exc)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/core.py", line 1049, in _event_to_service_call
yield from service_handler.func(service_call)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/switch/__init__.py", line 87, in async_handle_switch_service
yield from switch.async_turn_on()
File "/usr/local/lib/python3.4/dist-packages/homeassistant/helpers/entity.py", line 353, in async_turn_on
None, ft.partial(self.turn_on, **kwargs))
File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
value = future.result()
File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
raise self._exception
File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/switch/broadlink.py", line 134, in turn_on
if self._sendpacket(self._command_on):
File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/switch/broadlink.py", line 148, in _sendpacket
self._device.send_data(binascii.unhexlify(packet))
File "/home/pi/.homeassistant/deps/broadlink/__init__.py", line 450, in send_data
self.send_packet(0x6a, packet)
File "/home/pi/.homeassistant/deps/broadlink/__init__.py", line 229, in send_packet
payload = aes.encrypt(bytes(payload))
File "/home/pi/.homeassistant/deps/Crypto/Cipher/blockalgo.py", line 244, in encrypt
return self._cipher.encrypt(plaintext)
ValueError: Input strings must be a multiple of 16 in length