Coder Social home page Coder Social logo

node-velbus-client's Introduction

node-velbus-client

This project should be used in combination with a server, such as node-velbus-server.

Supported modules

Installation on Raspberry Pi

Using Raspbian Jessie Lite (download, installation, expand filesystem, update, static IP address)

Install node (LTS version)

# add nodejs repository
echo 'deb https://deb.nodesource.com/node_4.x jessie main' | sudo tee --append /etc/apt/sources.list.d/nodesource.list
# add nodejs repository key
wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
# enable https repositories
sudo apt-get install apt-transport-https
# update installation sources
sudo apt-get update
# install nodejs
sudo apt-get install nodejs

Install node-velbus-client

# update installation sources
sudo apt-get update
# install git
sudo apt-get install git
# clone this project
git clone https://github.com/pdpotter/node-velbus-client.git
# install dependencies
$(cd node-velbus-client; npm install)
# install initial config
$(cd node-velbus-client/server; cp config.sample.js config.js)

Update node-velbus-client

If node-velbus-client is running as a daemon (see below), stop the daemon before updating and start it again after updating.

# update node-velbus-client
$(cd node-velbus-client; git pull)
# update dependencies
$(cd node-velbus-client; npm install)

Configure node-velbus-client

The client can be configured by editing the settings in node-velbus-client/server/config.js. The default settings are:

(function() {
  exports.server = {
    port: 8080
  };

  exports.layout = {
    'living-room': {
      name: 'Living room',
      components: [
        {
          name: 'Lights',
          address: '01',
          channel: '1',
          module: 'VMB4RYNO'
        }, {
          name: 'Fan',
          address: '01',
          channel: '2',
          module: 'VMB4RYNO'
        }
      ]
    },
    kitchen: {
      name: 'Kitchen',
      components: [
        {
          name: 'Lights',
          address: '01',
          channel: '3',
          module: 'VMB4RYNO'
        }, {
          name: 'Fan',
          address: '01',
          channel: '4',
          module: 'VMB4RYNO'
        }
      ]
    }
  };

}).call(this);

Server port

The port at which the client will be reachable is can be changed by editing the server.port setting (the default value is 8080).

Components

The available components can be defined by editing the layout setting.

The components must be organized in categories, which are identified by a machine name, that will be used as a url path. Each category must have a (human readable) name and components.

Each component must have a (human readable) name, an address (the address on the bus) and a module (the Velbus module type). If a module has multiple channels, a channel must be defined as well.

Websocket server

The server that will receive the commands from the node-velbus-client and transform them to Velbus commands can be configured by editing node-velbus-client/public/js/config.js. The default settings are:

var node_velbus_client_config = {
    server: {
        protocol: 'ws',
        host: '127.0.0.1',
        port: 8001
    }
};

The server.host setting should be changed to the IP address op the Raspberry, which can be obtained by executing

ifconfig eth0 | grep "inet addr:"

The IP address consists of the four decimal numbers (with dots) following inet addr:.

Run node-velbus-client as a daemon

(based on init-script-template)

If node-velbus-client was not installed in the home directory of the pi user, update the dir setting on line 12 in node-velbus-client/daemon/node-velbus-client accordingly.

# copy daemon file
sudo cp node-velbus-client/daemon/node-velbus-client /etc/init.d
# make it executable
sudo chmod 755 /etc/init.d/node-velbus-client

To start the daemon, execute

sudo /etc/init.d/node-velbus-client start

To stop the daemon, execute

sudo /etc/init.d/node-velbus-client stop

To run the daemon on startup, execute

sudo update-rc.d node-velbus-client defaults

node-velbus-client's People

Contributors

jgrgt avatar pdpotter avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

jgrgt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.