API Specification¶
-
class
lirc.
Lirc
(socket_path: str = '/var/run/lirc/lircd', socket: socket.socket = <socket.socket fd=3, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>, socket_timeout: int = 5)¶ Bases:
object
Communicate with the lircd daemon.
-
DEFAULT_SOCKET_PATH
= '/var/run/lirc/lircd'¶
-
ENCODING
= 'utf-8'¶
-
list_remote_keys
(remote: str) → lirc.response.LircResponse¶ List all the keys for a specific remote.
Parameters: remote – The remote to list the keys of. Returns: The response of the command.
-
list_remotes
() → lirc.response.LircResponse¶ List all the remotes in LIRC
Returns: The response of the command.
-
send_once
(key: str, remote: str, repeat_count: int = 1) → Union[lirc.response.LircResponse, List[lirc.response.LircResponse]]¶ Send an LIRC SEND_ONCE command.
- Structure of the command:
- SEND_ONCE <remote-name> <key-name-from-remote-file> [repeat-count]
Parameters: - key – The name of the key to send.
- remote – The remote to use keys from.
- repeat_count – The number of times to press this key.
Returns: a response from the command or a list of those responses if repeat_count > 1.
-
send_start
(key: str, remote: str) → lirc.response.LircResponse¶ Send an LIRC SEND_START command.
- Structure of the command:
- SEND_START <remote-name> <key-name-from-remote-file>
Parameters: - key – The name of the key to start sending.
- remote – The remote to use keys from.
Returns: The response of the command.
-
send_stop
(key: str, remote: str) → lirc.response.LircResponse¶ Send an LIRC SEND_STOP command.
- Structure of the command:
- SEND_STOP <remote-name> <key-name-from-remote-file>
Parameters: - key – The name of the key to start sending.
- remote – The remote to use keys from.
Returns: The response of the command.
-
set_inputlog
(path: str) → lirc.response.LircResponse¶ Set the path to log all lircd received data to.
Returns: The response of the command.
-
stop_inputlog
() → lirc.response.LircResponse¶ Stop logging to the inputlog path from set_inputlog.
Returns: The response of the command.
-
version
() → lirc.response.LircResponse¶ Retrieve the version of LIRC
Returns: The response of the command with the version in the data field.
-
-
class
lirc.
LircResponse
(command: str, success: bool, data: list)¶ Bases:
object
A response from the LIRC daemon. Stores the command that had been sent, whether or not it was successful, and the parsed reply packet data.
-
exception
lirc.
LircError
¶ Bases:
Exception
A generic error that comes from this package.
-
exception
lirc.
LircSocketError
¶ Bases:
lirc.exceptions.LircError
For when a generic error occurs with the lircd socket
-
exception
lirc.
LircSocketTimeoutError
¶ Bases:
lirc.exceptions.LircSocketError
For when a timeout error occurs with the socket. This can happen when recv does not find any data for a given amount of time.
-
exception
lirc.
InvalidReplyPacketFormatError
¶ Bases:
lirc.exceptions.LircError
The reply packet from LIRC was in an invalid format.