WebIR

An HTTP interface to an infra-red (IR) actuator

Languages

Python

Frameworks and tools

FlaskOAuth2KeycloakLIRC

Platforms

Raspberry PiOracle cloud

WebIR is a web server that exposes a REST-like API in order to send commands to a local LIRC daemon. LIRC is an old, but quite usefull package that allows you to decode and send infra-red signals of many commonly used remote controls. WebIR is just an HTTP interface around the LIRC daemon.

This means that, with WebIR, you can control almost any IR device, like TVs, fans, air conditioners, etc. remotely via HTTP. In my case, I have installed it on a Raspberry Pi with Ansible, and set it up to control my kitchen TV. In order to avoid any random person to be able to turn on or off my TV, which would not be ideal, the whole API is protected with authentication and authorization checks, using the OAuth2 protocol.

Here are some examples of endpoints exposed by WebIR:

  • Send a single code:
    GET /remote/send/codes/KEY_POWER
  • Send a single code repeated 3 times:
    GET /remote/send/codes/KEY_POWER?count=3
  • Send multiple codes in a single request:
    GET /remote/send/codes/KEY_POWER,KEY_CHANNELUP
  • Send an integer that is translated into the corresponding code:
    GET /remote/send/integer/2
  • In case of controlling a TV, we can even send the name of a channel:
    GET /remote/send/channel/telemadrid