Page 1 of 3

Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Mon Feb 10, 2014 3:01 pm
by Bwired
Most of you know that i'm really a Windows guy for many years now.
I have a love hate relation with Windows but since Windows 2012 I started to dislike Windows more and more.
The step to go over to Linux started to interest me more and more with the birth of the Raspberry PI.
Also friends like Robert and Rene pushed me for years to make the turn :)
And since i got to know the Nodejs framework on Linux i had to make the switch.
And believe me; im loving every minute of it, what a relieve it is to program on Linux with Nodejs.

i have many Nodejs/MQTT/Websockets projects running now, but the first one who is presentable is the Node-js Iskra smartmeter solution.
I have a Raspberry connected to my smartmeter which sends the data via MQTT to the broker which is running on a Cubietruck http://blog.bwired.nl/?p=877
The Cubie is logging all the data to a mysql server which is also on the cubietruck and the Cubie is presenting this realtime smartmeter webpage with a realtime Graph
check out http://www.mijnsmartmeter.nl

A more detailed blog with sources can be found here http://blog.bwired.nl/?p=913
Later im panning also to open up a MQTT broker on my server so i can receive your MQTT messages as well!
Again special thanks goes out to Rene and Robert who turned me and helped me out with samples etc. during my Windows transition :)
Bwired smartmeter
Bwired smartmeter
smartmeter.jpg (180.7 KiB) Viewed 23261 times

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Mon Feb 10, 2014 4:28 pm
by Digit
Well done & looking very good! :D

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Mon Feb 10, 2014 9:05 pm
by Rene
[SMILING FACE WITH OPEN MOUTH AND SMILING EYES]

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Mon Feb 10, 2014 9:22 pm
by Phaeton
Looking forward to your blog !

Verstuurd vanaf mijn GT-I9300 met Tapatalk

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Tue Feb 11, 2014 8:13 am
by Esteban
Looks very good, I love that updating bar diagram, :)

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Fri Feb 14, 2014 12:05 pm
by Bwired
check out the detailed blog
http://blog.bwired.nl/?p=913

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Sat Feb 15, 2014 9:11 pm
by Kroonen
Hi,

I'm also trying to build it.

When I run node smartmeter.,js is get an error

Any idea what it wrong?

regards Richard

Code: Select all

root@raspberrypi:~# node smartmeter.js 
Starting Smart Meter
Received: /ISk5\2ME382-1003
Received: 
Received: 0-0:96.1.1(4B413650303035313534323830333133)
Received: 1-0:1.8.1(00257.944*kWh)
Received: 1-0:1.8.2(00124.951*kWh)
Received: 1-0:2.8.1(00000.000*kWh)
Received: 1-0:2.8.2(00000.000*kWh)
Received: 0-0:96.14.0(0001)
Received: 1-0:1.7.0(0000.26*kW)
Received: 1-0:2.7.0(0000.00*kW)
Received: 0-0:17.0.0(0999.00*kW)
Received: 0-0:96.3.10(1)
Received: 0-0:96.13.1()
Received: 0-0:96.13.0()
Received: 0-1:24.1.0(3)
Received: 0-1:96.1.0(4730303135353631303133333035303133)
Received: 0-1:24.3.0(140215200000)(00)(60)(1)(0-1:24.2.1)(m3)
Received: (00232.296)
Received: 0-1:24.4.0(1)
Received: !

/root/smartmeter.js:158
            sendSdata(btelegram);
            ^
ReferenceError: sendSdata is not defined
    at SerialPort.<anonymous> (/root/smartmeter.js:158:13)
    at SerialPort.EventEmitter.emit (events.js:95:17)
    at /root/node_modules/serialport/parsers.js:24:17
    at Array.forEach (native)
    at Object.parser (/root/node_modules/serialport/parsers.js:23:13)
    at Object.SerialPort.options.dataCallback (/root/node_modules/serialport/serialport.js:136:15)
    at SerialPortFactory.SerialPort._emitData (/root/node_modules/serialport/serialport.js:305:20)
    at afterRead (/root/node_modules/serialport/serialport.js:283:18)
    at /root/node_modules/serialport/serialport.js:297:9
    at Object.wrapper [as oncomplete] (fs.js:454:17)
root@raspberrypi:~#

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Sat Feb 15, 2014 10:58 pm
by Rene
You are calling a function sendSdata which is unknown.

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Sat Feb 15, 2014 11:18 pm
by Kroonen
I grabbed the script from the blog

http://blog.bwired.nl/?p=913

So what should it be?

regards Richard

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Sat Feb 15, 2014 11:28 pm
by Digit
Drop it. I think I know where Pieter uses it for. so I assume and you won't need it.

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Sat Feb 15, 2014 11:51 pm
by Kroonen
Robert,

Thats it.
Now its working , nice stuff

regards Richard

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Sun Feb 16, 2014 12:07 am
by Bwired
Hi Guys
Robert is right...as always :)

i adjusted the script on the blog also
I use this to send the data also to my old Home automation software, forgot to remove these 2 lines in the blog!

Code: Select all

var btelegram = telegram.join();
sendSdata(btelegram);
keep me posted if all is working an if i need to adjust some more
thanks Pieter

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Sun Feb 16, 2014 12:57 am
by kylix
Hi all!

Could anybody give me a hint about modifying the code in order to get the values to be displayed from an MySQL database instead of getting them through the serial port?

Thanks

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Sun Feb 16, 2014 2:49 am
by Bwired
my next blog is telling how to log this to mysql via MQTT, so you have to wait :)

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Posted: Sun Feb 16, 2014 11:18 am
by kylix
I hope you're posting on the blog every day :D