Skip to content

Web application that shows live readouts from Modbus enabled kWh meters (using Websockets) and logs them.

License

Notifications You must be signed in to change notification settings

OverSoft/kWhToWeb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kWhToWeb

Synopsis

Web application that shows live readouts from Modbus enabled kWh meters (using Websockets) and logs them. Includes default support for the Eastron SDM630 (because that's what i have ;)) The default setup includes power generation data for use in solar power installations. Runs fine on a raspberry pi (raspbian).

Screenshots

Screenshot 1

Requirements

  • Any linux version
  • node.js v6+
  • A USB to RS485 adapter with drivers for your platform
  • A Modbus enabled kWh meter

Installation

  • Check that you can access the RS485 adapter (usually it's available at /dev/ttyUSB0)
  • Install node.js (use a precompiled binary if installing on a Raspberry Pi)
  • Extract this repository or git clone it.
  • Run "npm install" to install the required libraries
  • Run "node server.js" to start serving and logging (it's available at IP:3000 by default)

Changing default settings

  • If you want to change the serial settings (like baudrate, stopbits, etc...) edit main.js.
  • If you want to change the modbus device address (it's 1 by default) edit sdm630.js.
  • If you want to change the modbus register mapping for your device, feel free to edit sdm630.js or make a copy and edit that.
  • It's very much made for my installation, so if you want to add, remove or change any gauges on the main page, feel free to edit public/index.html

Used libraries

node.js:

  • express
  • socket.io
  • modbusrtu
  • moment
  • node-cleanup

index.html

Running on boot

If you want to run this program on boot, just add the following lines to /etc/rc.local

  • cd /path/to/app
  • nohup node server.js &

In some weird cases, the serial port settings don't stick the first time "stty" set them. In that case, remove the -e from the hashbang of rc.local and run the stty command before the node command above. For example:

  • stty -F /dev/ttyUSB0 "0:0:8be:0:0:0:0:0:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0" (This sets the serial port to 19200 baud, 8n1, hardware flow control)

Support

No, not really, i made this just for fun.

License

This piece of software is available under the GNU GPL. This basically means that you can do whatever you want with it: modify it, sell it, whatever, as long as you mention me as an author and provide the source code to any changes to my code.

About

Web application that shows live readouts from Modbus enabled kWh meters (using Websockets) and logs them.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published