Skip to content
/ ha-cli Public

Home automation CLI - wrapper for IFTTT to control SONOFF devices via cli

License

Notifications You must be signed in to change notification settings

Kyczan/ha-cli

Repository files navigation

ha-cli

home automation CLI

App

what

This project is a simple wrapper for IFTTT which connects to SONOFF devices and allows to control them via CLI.

There also exists dmenu version of this app: ha-cli-dmenu.

why

To control SONOFF devices there is only app for phone (eWeLink). This project allows you to control via CLI.

how

prerequisites

  1. First create account on IFTTT.

  2. Next turn on webhooks in IFTTT.

  3. Then configure your applets in IFTTT. Search for webhooks when creating this statement and search ewelink when creating that statement (in my case I selected "Turn 1 Channel Switch on or off").

  4. To obtain webhook url go to IFTTT webhooks and click Documentation.

  5. Test connection with presented url and as {event} use event name created in step 4. You should be able to switch on/off the light when executing this url.

installation

Clone repository and cd into:

git clone https://github.com/Kyczan/ha-cli.git
cd ha-cli

Next grab your API key here. Save this in .env file in root directory of this project (or use existing .env.example file):

API_KEY="your_api_key"

Then adjust src/config.ts file accordingly to your {events} values.

And finally install this package globally by typing in terminal:

sudo npm install -g

Now you have command ha-cli available across all terminals.

usage

Open terminal, type ha-cli, and follow instructions.