A voice-controlled universal remote using Amazon AVS and Raspberry Pi.
- About the project
- Getting started
- Usage
- Running the tests
- Build
- Version
- Authors
- License
- Acknowledgements
As mentioned, the general idea behind this project consists in an interface between an infrared remote controller (the circuit) and any desired client. This client may be a user using the CLI, a third party entity by using the API, or an Alexa Skill. These features are implemented using the different "modes" of operation of the current tool.
In the below section, you may find a brief description of each of the available modes.
This mode is created as an interactive interface to use your lirc
commands directly from your bash console. The device should be configured properly in lirc
in order for it to work. You may use raw commands (as defined in lirc
) by starting your command with raw
, or composite commands, which let you interact in a more user-friendly way (e.g. POWER
, CHANNEL 15
, etc.).
A REST API to interact with the CLI wirelessly. Review mode may be used to interact with the CLI without sending actual commands.
This mode creates the lirc
configuration for a new device. You may use this option or do it by yourself. Please remember to move your configuration file to the corresponding lirc
directory.
An API to interact with Alexa Voice Service. This API uses the flask-ask
library to parse AVS requests and send the corresponding commands using lirc
. You may find the skill interaction model under resources/alexa
.
This project was implemented using Python 3 (3.5.3) and it is designed for it. You will need to have this installed prior to usage, all tools needed are listed here:
- Python 3.5.3 with pip
- lircd
To install all the project dependencies, use the following command:
pip3 install -r requirements.txt
To install lircd
for Linux:
sudo apt-get install lirc
If you need more information about the necessary installation/setup process for lircd
, please refer to our CHANGELOG.
To use our ARC, use the following command:
python3 cli.py MODE [OPTIONS]
MODE
is used to specify the mode of operation, current modes arecli
,api
,alexa
andtraining
.
Some available options are:
-d
or--device
: the name of the device, configured withlirc
, necessary forcli
,api
,alexa
andtraining
modes.-r
or--review_mode
: option that doesn't execute the commands, just for testing if everything is working properly and simulations.
NOTE: Please note that it is necessary to have the lirc
configuration for your device prior to using any of the modes. To create this configuration, you can use the training
mode and copy the generated conf
file to /etc/lirc/lircd.conf.d/
.
You may see an execution example below for the CLI:
For this project, we used the unittest
framework to create our unit tests. In order to run them, run the following command:
python3 -m unittest discover -s tests -t tests -p *_test.py
Some example of unit tests are:
These tests were created to assert that all shell commands were generated correctly by the IRSender
. These commands should be tested because they involve a shell execution sensitive to the syntax.
Here is an example of one of the tests for the KEY_POWER
raw command:
def test_send_raw_power_command(self):
command = 'KEY_POWER'
expected = ['irsend SEND_ONCE {} {}'.format(self.__device, command)]
result = self.__ir_sender.send_raw(command)
self.assertEqual(expected, result)
These tests were created in order to assert the validation of existing commands. Since users are prompted a command that will be executed through the shell, it is important to validate that the command is registered, existent and properly written. This is for both functionality and security purposes.
Here is an example of one of the tests for the POWER
command:
def test_validate_valid_power_command(self):
command = 'POWER'
result = self.__command_validator.validate(command, None)
self.assertTrue(result)
This project was built using:
- Python 3.5.3 under Pipenv.
This repository stores v1.0 of the our AVS Remote Controller.
Copyright © 2019, Sebastián Pérez, Cesar Torres and Erick Durán. CETYS Universidad.
Released under the MIT License.