Skip to content

Updated SmartPlug commands - set_power() and check_power() - #16

Merged
mjg59 merged 2 commits into
mjg59:masterfrom
PeWu:smartplug
Nov 20, 2016
Merged

Updated SmartPlug commands - set_power() and check_power()#16
mjg59 merged 2 commits into
mjg59:masterfrom
PeWu:smartplug

Conversation

@PeWu

@PeWu PeWu commented Nov 18, 2016

Copy link
Copy Markdown
Contributor

AES complains if the packet size is not a multiple of 16.

Commands tested on a SmartPlug that identifies itself with the code 0x2728.

@eddyyanto

Copy link
Copy Markdown

I got the same 16 length value error (traceback below). Tested this patch and it seems to fix the error.

[Traceback (most recent call last):<broadlink.sp2 instance at 0x036C1418>, <broadlink.device instance at 0x033FF3F0>]

  File "C:\Users\Eddy\Downloads\python-broadlink-master\test.py", line 7, in <module>
    devices[0].set_power(1)
  File "C:\Users\Eddy\Downloads\python-broadlink-master\broadlink\__init__.py", line 242, in set_power
    self.send_packet(0x6a, packet)
  File "C:\Users\Eddy\Downloads\python-broadlink-master\broadlink\__init__.py", line 204, in send_packet
    payload = aes.encrypt(str(payload))
  File "c:\users\eddy\appdata\local\temp\easy_install-t6ivxq\pycrypto-2.6.1-py2.7-win32.egg.tmp\Crypto\Cipher\blockalgo.py", line 244, in encrypt
ValueError: Input strings must be a multiple of 16 in length
[Finished in 1.3s]

@mjg59
mjg59 merged commit 7ac243b into mjg59:master Nov 20, 2016
@mjg59

mjg59 commented Nov 20, 2016

Copy link
Copy Markdown
Owner

Brilliant, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants