Overview
Gomotics is a small program written in Go that aims offering easy to consume Rest API endpoints to Niko Home Control and act as interface between Niko Home Control and Jeedom. It can be used to solely link NHC to Jeedom or to build an UI to perform simple, day to day operations.
Features
- NHC zero conf: automatically discovers the Niko Home Control
- NHC switches
- NHC dimmers
- Interface with Jeedom (matches NHC/Jeedom on name and location)
- Automatically create NHC rooms, switches and dimmers in Jeedom
Demo
Installation
Navigate to the gomotics releases page. Select the latest version and download the gomotics executable for your platform. Unzip and save the executable file.
A docker image is automatically build with Travis-CI. It is available on docker hub.
Configuration
Gomotics can run with minimal configuration. It will automatically discover the NHC controller on the LAN and populate other parameters with default value. If you want gomotics to connect to Jeedom, you can either edit a config file in TOML or set the parameters as env variables. More detailed information on the GitHub repository
Running
Binary
Gomotics only takes one optional parameter: the config file. As explained in the configuration section, all the parameters can also be setup as env variables.
gomotics -conf path_to_config.file
Docker
A docker image is automatically build with Travis-CI. It is available on Docker Hub
docker run -d -P --net host --name gomotics \ -e JEE_URL=http://jeedom-host/core/api/jeeApi.php \ -e JEE_APIKEY=abcdegf1234 \ -e LOG_PATH=stdout \ mch1307/gomotics
API
Gomotics offers the following http endpoints:
/health (GET)
Returns a simple JSON if up and running:
{"alive":true}
/api/v1/nhc (GET)
Returns a JSON list of registered items
[{"provider":"NHC","id":1,"name":"Light","location":"Kitchen","state":100",value2":0,"value3":0,"JeedomID":"","JeedomUpdState":"","JeedomSubType":""},{"provider":"NHC","id":2,"name":"Light","location":"Office","state":100,"value2":0,"value3":0,"JeedomID":"","JeedomUpdState":"","JeedomSubType":""}]
/api/v1/nhc/{id} (GET)
Return a JSON containing the item id provided in the url
{"provider":"NHC","id":1,"name":"Light","location":"Kitchen","state":100,"value2":0,"value3":0,"JeedomID":"","JeedomUpdState":"","JeedomSubType":""}
/api/v1/nhc/{id}/{value} (POST)
Send an action to NHC controller (switch, dimmer):
/api/v1/nhc/1/100
/api/v1/jeedom/{id}/{value} (GET)
Endpoint to be called from Jeedom in order to drive Niko device. id is the Jeedom equipment id and value is the desired state
/api/v1/jeedom/1/100
/events
Websocket endpoints. Provides a JSON message each time an item is updated:
{"provider":"NHC","id":30,"name":"Light","location":"Kitchen","state":0,"value2":0,"value3":0,"JeedomID":"","JeedomUpdState":"","JeedomSubType":""}