/piir

Generic lightweight tool to send any infrared signals from high performant C code

Primary LanguageCMIT LicenseMIT

PIIR

PIIR is a command line tool to transmit IR-signals like remote controls do. PIIR is created as a generic tool that supports configuration and transmission of any signal, eg. including long aircondition signals.

alt text

Examples:

piir --remote tv_sony --feature action=TURN_ON

piir --remote hvac_panasonic --feature temperature=21 --feature mode=HEAT

Table of contents

Features

  • Send infrared commands to control aircondition etc.
  • Transmit any IR signal using any protocol.
  • Integration to home automation and other systems.
  • Customization by configuration and plugins.

IR-protocol

To control an IR-receiver you need to know the IR-signals to transmit to it. Either, you can:

Supported systems

The tool is developed in C to support deployment on any platform.

Supported hardware

The tool supports IR transmission by:

  • Raspberry PI using GPIO
  • more platforms to come

Prerequisites

To be able to transmit IR signal you need an IR led, either:

Getting Started

You need to identify a device you want to control by IR-signals, e.g. an airconditioner, a TV or similar.

Compilation

Update package list:

sudo apt update

PIIR uses the library PIGPIO which you can install by:

sudo apt install -y pigpio

Install Autotools to enable compilation

sudo apt-get install -y autoconf automake libtool

Download and extract latest released PIIR software:

curl -s https://api.github.com/repos/mortenmathiasen/piir/releases/latest | sed -n 's/.*tarball_url":\s"\(.*\)".*/\1 -O piir.tar/p' | xargs wget
mkdir piir
tar xf piir.tar -C ./piir
mv ./piir/*/* ./piir

Now compile it:

cd piir
./autogen.sh
./configure
make

Installation

After compilation you can install the PIIR tool by:

sudo make install

Running the tests

After compilation you can test the PIIR tool by:

make check

Deployment

You can deploy the PIIR tool to any live system. Either you can compile the sourced code directly on the live system as explained above or you can compile it on another development system and then move the execution file to your live system.

How to use

You kan get command line help running:

piir --help

Output will be like:

Available configuration files in /home/pi/piir/conf/remotes/:
    hvac_panasonic
    ...
Available configuration files in /usr/local/share/piir/conf/remotes/:
    hvac_panasonic
    ...

usage:      piir
            --remote, -r CONFIGFILE
            [--feature, -f NAME=VALUE]
            [--verbose, -v (TRACE|DEBUG|INFO|WARN|ERROR|FATAL|NOTHING)]
            [--help, -h]

examples:   piir --help
            piir --remote hvac_panasonic --help
            piir --remote hvac_panasonic --feature temperature=21
            piir --remote tv_sony --feature action=TURN_ON

Specific help on available features for a particular remote can be achieved by:

piir --remote hvac_panasonic --help

Output will be like:

Features in config file /home/pi/piir/conf/remotes/hvac_panasonic.json:
       temperature:
              8
              10
              16
              17
              18
              19
              20
              21
              22
              23
              24
              25
              26
              27
              28
              29
              30
       mode:
              AUTO
              HEAT
              COOL
              FAN
              OFF
       option:
              AUTO
              QUIET
              POWERFUL
       fan:
              AUTO
              VERYSLOW
              SLOW
              MEDIUM
              FAST
              VERYFAST
       updown:
              AUTO
              VERYLOW
              LOW
              MIDDLE
              HIGH
              VERYHIGH
       leftright:
              AUTO
              VERYLEFT
              LEFT
              MIDDLE
              RIGHT
              VERYRIGHT

usage:      piir
            --remote, -r CONFIGFILE
            [--feature, -f NAME=VALUE]
            [--verbose, -v (TRACE|DEBUG|INFO|WARN|ERROR|FATAL|NOTHING)]
            [--help, -h]

examples:   piir --help
            piir --remote hvac_panasonic --help
            piir --remote hvac_panasonic --feature temperature=21
            piir --remote tv_sony --feature action=TURN_ON

A working example combining more features into the IR signal:

sudo piir --remote hvac_panasonic --feature temperature=21 --feature mode=HEAT --feature option=AUTO --feature fan=AUTO --feature updown=HIGH --feature leftright=MIDDLE --verbose=DEBUG

If everything goes well output from the command will be like this:

gpioWaveTxSend OK: 15897

Contributing

Contribution to implement more transmitters is welcome.

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments