home automation CLI
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.
To control SONOFF devices there is only app for phone (eWeLink). This project allows you to control via CLI.
-
First create account on IFTTT.
-
Next turn on webhooks in IFTTT.
-
Then configure your applets in IFTTT. Search for
webhooks
when creatingthis
statement and searchewelink
when creatingthat
statement (in my case I selected "Turn 1 Channel Switch on or off"). -
To obtain webhook url go to IFTTT webhooks and click
Documentation
. -
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.
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.
Open terminal, type ha-cli
, and follow instructions.