Skip to content
Little home automation project to turn on/off several appliances I've in my home
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
models
routes
.dockerignore
.eslintignore
.eslintrc
.gitignore
.gitlab-ci.yml
CHANGELOG.md
CODE_OF_CONDUCT.md
Dockerfile
LICENSE
README.md
constants.js.dist
docker-compose.yml
index.js
logger.js
package.json
yarn.lock

README.md

Home Automation

Docker Pulls

Little home automation (since the very fancy project name) to turn on/off several appliances I've in my home.

Some examples include HTPC, AVR, TV, lights.

Each appliance has a subclass of Appliance class that permits status change via dedicated methods and emits events on status change.

Expanding is easily, it's just a matter of a subclass!

Interaction

Appliance interaction is handled via a natural language API available on /api/natural accepting x-www-form-urlencoded HTTP POST.

Message format

curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-d 'token=[TOKEN]&text=home turn tv off and radio on&trigger_word=home' \
"http://localhost:3000/api/natural"

Parameters

  • token is a (secret) token to check request validity
  • text is the natural language sentence
  • trigger_word is the (optional) word that triggered recognition and message. It'll be removed from text if present

Permitted combinations

As you can see, multiple appliances and statuses are present in the same sentence allowing to control multiple appliances with a single message. Possibilities are:

  • One appliance and one status: changes selected appliance status
  • Multiple appliances and one status: changes status of all appliances
  • Multiple appliances and as many statuses: changes status of respective appliance

Slack integration

Slack integration is very deep and allows two-way communication with your home appliances (each of them have a customizable icon).

Outgoing Webhook

Message format is fully compatible with Outgoing Webhook so it's very easy to use the exposed HTTP endpoint with Slack and have a bot in no time.

As bonus, endpoint answer is in the Slack accepted format so your bot will answer you!

Incoming Webhook

Since logging is done via winston it's very trivial to use the (already present) slack-winston transport to be notified of appliances status changes using Incoming Webhook

How do I get set up?

You've several way to get homeautomation running:

  • You can use docker:

    Create a constants file (just the first time) cp constants.js{.dist,}

    Create and start the container docker-compose up -d.

  • Or manually:

    npm i --production

    cp constants.js{.dist,}

    npm start

    homeautomation will be available on port 3000.

You can’t perform that action at this time.