Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Forum about Questions, discussions and announcements regarding the Bwired website owned by Pieter Knuvers
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post 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 22806 times
http://www.bwired.nl Online Home, Domotica, Home Automation. Weblog. http://blog.bwired.nl
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by Digit »

Well done & looking very good! :D
User avatar
Rene
Global Moderator
Global Moderator
Posts: 1689
Joined: Wed Oct 08, 2008 3:54 pm
Location: Netherlands

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by Rene »

[SMILING FACE WITH OPEN MOUTH AND SMILING EYES]
Rene.
User avatar
Phaeton
Advanced Member
Advanced Member
Posts: 573
Joined: Wed May 19, 2010 12:44 pm
Location: Wassenaar
Contact:

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by Phaeton »

Looking forward to your blog !

Verstuurd vanaf mijn GT-I9300 met Tapatalk
groeten,
Harry
Esteban
Forum Moderator
Forum Moderator
Posts: 677
Joined: Sun Jan 13, 2008 6:39 pm
Location: Netherlands

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by Esteban »

Looks very good, I love that updating bar diagram, :)
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by Bwired »

check out the detailed blog
http://blog.bwired.nl/?p=913
Kroonen
Member
Member
Posts: 302
Joined: Mon Oct 01, 2007 6:38 pm
Location: Netherlands

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post 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:~#
User avatar
Rene
Global Moderator
Global Moderator
Posts: 1689
Joined: Wed Oct 08, 2008 3:54 pm
Location: Netherlands

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by Rene »

You are calling a function sendSdata which is unknown.
Rene.
Kroonen
Member
Member
Posts: 302
Joined: Mon Oct 01, 2007 6:38 pm
Location: Netherlands

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by Kroonen »

I grabbed the script from the blog

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

So what should it be?

regards Richard
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by Digit »

Drop it. I think I know where Pieter uses it for. so I assume and you won't need it.
Kroonen
Member
Member
Posts: 302
Joined: Mon Oct 01, 2007 6:38 pm
Location: Netherlands

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by Kroonen »

Robert,

Thats it.
Now its working , nice stuff

regards Richard
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post 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
kylix
Starting Member
Starting Member
Posts: 2
Joined: Sun Feb 16, 2014 12:54 am

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post 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
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by Bwired »

my next blog is telling how to log this to mysql via MQTT, so you have to wait :)
kylix
Starting Member
Starting Member
Posts: 2
Joined: Sun Feb 16, 2014 12:54 am

Re: Bwired Nodejs, MQTT, Websockets Iskra Smartmeter solution

Post by kylix »

I hope you're posting on the blog every day :D
Post Reply

Return to “Bwired Forum”