Coder Social home page Coder Social logo

j-vizcaino / ir-remotes Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 75 KB

Tools for managing IR remotes with Broadlink RM Mini

License: GNU General Public License v3.0

Go 78.84% Makefile 1.26% HTML 19.90%
golang broadlink-rm cli rest-api broadlink-ir-blaster ir-remotes broadlink-rm-mini ir-remote

ir-remotes's Introduction

Broadlink IR blaster tool

Build badge GoReport badge

ir-remotes provides a command line tool for managing Broadlink devices, recording infra-red codes, then, providing a way to replay those, using a REST API endpoint.

Getting started

Disclaimer: the following code has been tested on Linux, using a Broadlink RM Mini IR blaster. While it may support other Broadlink devices, this has not been tested. Contributions are welcome.

Installation

To build from source, Go >= 1.11 is required, since the repository uses Go modules.

# Clone the repository anywhere you want
$ git clone https://github.com/j-vizcaino/ir-remotes.git
$ cd ir-remotes
$ go build

Discovering devices

The first step is to discover and save the Broadlink devices living in your local network.

$ ir-remotes devices discover

By default, the devices information get stored in devices.json but this can be configured using the --devices-file option.

When devices.json exist, the command preserves its content. It is safe to run the discover command many times without loosing previously discovered devices.

Capturing IR codes

Once device list is ready, it's time to capture some IR codes. Using this mode, the Broadlink device will wait for IR code and record it.

# Example: record the power, vol_up, vol_down and mute buttons from the TV remote
$ ir-remotes capture -n tv power vol_up vol_down mute

The capture command

  • stores the raw IR codes in the remotes.json file (configurable with --remotes-file option)
  • captures the IR codes sequentially, asking the user to press the IR remote button when ready
  • skips already captured IR codes that may exist in the remotes file

REST endpoint

With device list and a couple of IR codes saved to disk, the REST service can be started.

$ ir-remotes server

The following endpoints are provided by the service:

  • GET /api/devices: list of Broadlink devices available and listed in the devices.json
  • GET /api/devices/:name: get information for the device with name
  • GET /api/remotes: list of remote names, loaded from remotes.json
  • GET /api/remotes/:name: get the list of IR codes for the remote with name
  • POST /api/remotes/:name/:code: send the IR code named code

All-in-one REST server and web frontend

The server command allows for serving static content from disk. By default, accessing localhost:8080 redirects to localhost:8080/ui/ where the application serves the UI asset content, located in assets/ui.

In order to improve installation and distribution, a binary can be compiled, embedding both the UI files as well as the remotes.json and devices.json located in assets/config directory.

To build this version of the binary

$ GO_BUILD_TAGS=embedded make build

The resulting ir-remotes binary can now be copied anywhere without any additional file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.