Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including hs100tomqtt with all npm packages installed. Try it out:

var hs100tomqtt = require("hs100tomqtt")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

hs100tomqtt v0.0.5

In order to use automatic device discovery, you have to run docker with `--net=host` or equivalent configuration.

Usage

npm install -g hs100tomqtt
hs100tomqtt --help

Using with Docker

In order to use automatic device discovery, you have to run docker with --net=host or equivalent configuration.

If your system doesn't work with --net=host (see Docker for Mac issue), use a pre-defined device table instead, see option --device-table.

docker run

docker run -d --net=host dersimn/hs100tomqtt -m mqtt://MQTT_IP

or

docker run -d dersimn/hs100tomqtt -m mqtt://MQTT_IP --device-table /node/exampleDeviceTable.json

Run docker run --rm dersimn/hs100tomqtt --help to list all options.

docker-compose service

hs100tomqtt:
  image: dersimn/hs100tomqtt
  environment:
    - HS100TOMQTT_MQTT_URL="mqtt://MQTT_IP"
  network_mode: "host"

or

hs100tomqtt:
  image: dersimn/hs100tomqtt
  volumes:
    - ~/deviceTable.json:/node/deviceTable.json:ro
  environment:
    - HS100TOMQTT_MQTT_URL=mqtt://MQTT_IP
    - HS100TOMQTT_DEVICE_TABLE=/node/deviceTable.json

Debug

Show debugging output

For some reason Ctrl-C is not working, workaround with named container:

docker run --rm -it --name=hs100tomqtt dersimn/hs100tomqtt --mqtt-retain=false -m mqtt://MQTT_IP -v debug
Ctrl-P Ctrl-Q
docker stop hs100tomqtt

Manually build

docker build -t username/hs100tomqtt .

Credits

This project follows Oliver "owagner" Wagner's architectural proposal for an mqtt-smarthome.
Built by copy-pasting together Sebastian "hobbyquaker" Raff's mqtt-smarthome scripts and Patrick "plasticrake" Seal's hs100-api.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free