There appears to be a bug in the SendCommand class in client.py for the python bindings (I'm using python 3 if it matters).
The entire class is (around line 600 or so):
class SendCommand(Command):
''' Send given key, see SEND_ONCE in lircd(8) manpage. '''
def __init__(self, connection: AbstractConnection, remote: str, keys: str):
if not len(keys):
raise ValueError('No keys to send given')
cmd = 'SEND_ONCE %s %s\n' % (remote, ' '.join(keys))
Command.__init__(self, cmd, connection)
Notice the "keys" argument is a string. However, it's used as the argument to "join", which results in each character of the supplied value between split with spaces inbetween each character. When trying to use this to, for instance, send the key "KEY_POWER", it results in an error from LIRC: unknown command: "K"
The man page for lircd doesn't indicate multple buttons may be provided with SEND_ONCE, so it seems the simple fix is to remove the use of "join" and just provide "keys" directly.
Also, there's no way to specify "repeats" so perhaps another, optional argument could be added for that.
First some facts:
man irsendsaysirsend [options] send_once <remote> <code> [code...], so it does send several commands,So clarifying the documentation ("should be called with an array of strings (or Iterable over strings)") would be alternative.
Finally, let me remark that I, with some cooperation with Alec, have written "Lirconian", a pure Python implementation of
irsend, usable as API and as command line program. (It supports repeats, but not multiple commands.) It is available on PyPi and on Github. Please try it out. Why invoke compiled, architecture dependent libraries for what you can do with pure Python?The
' '.join(keys)indicates that it is a list. Also, the parameter is calledkeysand notkey.Also when you look at lirctool.py, it's a clearly a list there. I think the documentation string and type hint is wrong.
Fix in commit ae278ac63b6ec4c322752ca6631645465a6c41e9