Rukenshia
Posts: 2
Joined: Tue Nov 11, 2014 4:18 pm

Another Home Automation - goHome (Open Source)

Sat Mar 28, 2015 6:45 pm

Soo, this is a project i've been working on for some days.
It is written in 'Go' by Google (golang.org).

What is this about?
Basically, this program allows you to remotely toggle your outputs or read input states of the things connected to your Pi. I plan to support built in entity linking, meaning 'when Input my_sensor goes high, it executes command X', but thats just planned.
The application listens on port 4200(UDP) default and requests are send as json encoded string.
I also made a small tool using node that listens on 8080 and allows you to simply execute commands via the web browser of your choice.

Pebble? Pebble!
I also created a simple Pebble app that allows me to execute all the commands:
Image
I didnt put the code of that application to bitbucket yet.

How does it look like?
Here's a simple example: I have this in my config:

Code: Select all

{
  "Board": 3,
  "Entities": [
    {
      "Name": "desk_light",
      "FriendlyName": "Desk Light",
      "Pin": 1,
      "Type": "Output"
    }
  ]
}
Then, i just type this in my web browser: http://192.168.178.39/desk_light/state/1. This sets the state of the desk_light to 1. The result is this:
Image

I can also toggle it (/desk_light/toggle) or set the output low (/desk_light/state/0). As a note, my desk light is connected to a relay card of course :)

How can I do that and what do I need?
First, let's talk about what you actually need.

As I do not provide executables, you need to install it on your own. This results in the list of following dependencies:
  • Go installed and set up
    node.js
    wiringPi (wiringpi.com)
The source code can be found here:
Node Application
Main Program

Configuration
You have to customize the 'config.json' file.
Board (integer): the board revision. 1 is RPi 1 rev 1, 2 is RPi 1 rev 2 and 3 is RPi 2.
Entities (array of objects): the entities (inputs and outputs) you have connected. Example:

Code: Select all

  "Entities": [
    {
      "Name": "desk_light",
      "FriendlyName": "Desk Light",
      "Pin": 1,
      "Type": "Output"
    }
  ]
If you have an input, just put "Input" instead of "Output" at the Type key. The Pin number has to be conform to the wiringPi pin layout.

Any Questions?
Feel free to ask questions or just point out mistakes in the code.

With best regards,
Jan

Return to “Automation, sensing and robotics”