In another forum post (https://www.flukso.net/content/first-time-install-problems) user "jgysenbergs" raised following question "Do you know if there exists a fancy web interface with nicely designed gauges?"
On this behalf (and on Bart's request :-)) I'd like to introduce this dedicated thread, reposting my reply for an open and fruitful discussion:
"Nicely designed gauges" are like "electronics in cases"; it takes an hour to solder a solution and weeks (if not years) to finally pack it into a nice box... Yesterday I actually started to get into the MQTT stuff again (the actual data collector runs smoothly on a RaspPi for some while) - I experimented with http://www.flotcharts.org/ but am not convinced yet; Jean-Claude Wippler (please continue your blog on www.jeelabs.org) proposes http://dygraphs.com/ - I am looking forward to continuing during winter vacation starting Friday... There "should" be some MQTT ready solutions that generically display readings, but I did not do any research yet.
I think, I will report progress in https://github.com/gebhardm/energyhacks/tree/master/RaspberryPi - there my "quickly hacked" python-to-html solution is available that has a lot of room for improvement...
All you hackers, tinkerers, nerds, and freaks out there - share your insights, as I am getting too old (means too lazy) to again and again and again program stuff that should be already feasibly solved in the 21st century ;-) (I know why I studied math and not computer science)
Best regards
Markus
Just as a "final" statement: For now I regard the nicely designed gauges topic "conveniently covered" - I made two implementations, one displaying how many ever sensor gauges using a little node.js script serving a panel --> https://github.com/gebhardm/energyhacks/tree/master/RaspberryPi/panel
And I made a time series display using a persistence service also based on node.js --> https://github.com/gebhardm/energyhacks/tree/master/RaspberryPi chart and persist; both script may be combined; I use it for quite some while now and am still quite pleased with the result; see a current screen shot and some accompanying discussion on results in http://energyhacks.wordpress.com/
Whomever wants to try it out, please do so and report experience; if you have questions, just let me know... (all working fine on a first version (256MB) RasPi, working for months in my basement now without any hickup)
@gebhardm
Thank you for taking this to the next steps. We are so close to having an easily installable and attractive solution to archiving, manipulating and presenting flukso data on our own. As excited as i am to see and implement your work, I am having some issues. I'm still plugging away but I thought I would share my experience in the hopes that it might helps others if they come to the same pitfalls as I am having. Also any insight into my issues below are appreciated.
My system is running Ubuntu 14.4 server edition (LEMP) nginx/mysql/php/node.js
(not that it maters but I'm running it on an old eeePC 701)
node.js:
I installed via
sudo apt-get nodejs nodejs-legacy npm
and then usednpm install mqtt socket.io
to install the required pieces. At first I used the --global flag for the npm install but the scripts could not find a path to MQTT. So then I ran it as shown above in the same folders as your scripts that call for them as required modules eg:var mqtt = require('mqtt');
nodejs-legacy is required because there is a conflicting package on Ubuntu called node.
Panel:
Page loads but does not present any data. I thought nginx might be conflicting but still nothing with that service stopped.
mosquitto_sub -h <FLM LAN address> -v -t /sensor/#
does present data. is there customization to the node script other than replacing my local FLM address? Comparing it to other scripts i seeio.set('log level', 0)
does not have an ending ";" when it does in your chart script... don't know if it matters or not.Persist:
If the user has not yet made flm entry in mySQL replace line 6&7 in"set_up_mysql.txt" with
When I run persist.sh, line #73
+ ' INDEX idx_time (timestamp)
presents the errorSyntaxError: Unexpected token ILLEGAL
I know nothing about js but is there some sort of punctuation issue there or the following line?
Chart:
Haven't experimented with this yet as it seems it needs "persist" up and running first.
feature request: have all this work with multiple Flukso on the network.
Anyway, thanks again for all your work. I'll let you know if/when I get things sorted out.
-p
Wow, Pietro, that's a work - thanks!
Actually I installed node.js not via apt-get, but via github directly and configured and made it compliant to my environment; so I can always upgrade to the latest stable release (currently 0.10.29) as I experienced the apt-get version rather old...
With the node_module folder I also had my issues; it's directly in my home directory, so in the path to find it...
Panel: In the panel server script indeed the ; was missing behind the io.set - curiously didn't experience an issue.
Persist: Added the note to create the database flm - thanks for the hint.
I must admit, the INDEX line came late and is untested in the creation of the table in the script; I created the index (required for somehow performant charting) manually via CREATE INDEX idx_flmdata_time ON flmdata(timestamp); so you may delete this line for now - will have a look as I THOUGHT the SQL syntax would be just that (docu, docu, magic)
With respect to the feature request; well don't have a real clue on how to achieve that - naively I would propose to have a central MQTT broker that repeats all FLM's messages to not have to access each single FLM separately. Will see if I get a better idea; I have a spare FLM around...
So, thanks again, heads up and kind regards
Markus - more feedback welcome...
INDEX line - idiot I, there is just a ' missing in the end to close the string part...
Github up do date on feedback :-)...
Maybe another hint: The panel does not work using http://localhost:1080, but with http://:1080 - if you explain why, I'll spend you a beer next elektro:camp...
I HATE this forum editor eating up angle brackets!!!! It is http://"actual IP address":1080, so in my case http://192.168.0.25:1080 when the panel runs on my Mac; there is no other configuration than changing the FLM's IP address
success with persist! persist_mqtt.js now showing data being dumped into mysql
small typo in "set_up_mysql.txt" line 15 should be mysql
I'll give "chart" a shot in a bit...
haven't figured out my problems with "panel" not displaying any info yet
I'm going to the panel using a full ip address. 192.168.0.120:1080 for me
however one difference in our setups is that all of this is set up on my server (192.168.0.120) and then I'm accessing it from a separate computer. (192.168.0.111)
Do I have to be looking at the panel from the device that it is running on?
No, the panel should be accessible through the network "as a normal device";
Just made a rebuild of node on v0.10.29, reinstalled mqtt and socket.io - and the panel is NOT working anymore; io.set("log level",0) was refused, so there were some incompatible changes - grrrrrr
As such the panel is straight forward, no specialties - so I have to get a closer look what kind of changes prevent the running - it is still working on my RasPi running node.js v0.10.26 - never change a running system :-/
Well, at least that's a step towards understanding and making this more universally compatible.
FWIW, my previous comments were based on v0.10.25 and now after installing v0.10.28 with no change
The all but official node ppa for ubuntu is this one below. (nodejs-legacy and npm are now included in nodejs)
ATTENTION: The node module socket.io changed incompatibly between v0.9 and v1.0 - my implementation is based on v0.9, but you get v1.0 if you install node.js and socket.io newly... I adapted the panel implementation into a '_new' version that is running on node.js v0.10.29-release with npm-installed socket.io.
This is, why you can't take open source normally as is - welcome to computer science in the 21st century - grmph
chart needs to follow - so for now you have to see for yourself how you get socket.io v0.9 installed on node :-/
OK - repository cleanup
http://github.com/gebhardm/energyhacks/RaspberryPi/ stays on the "old" version node.js v0.10.28-release w/ socket.io v0.9
http://github.com/gebhardm/flmdisplay/ will evolve with the socket.io v1.0 - panel is working again, chart "should" also be working, but currently untested... (just good that it was full moon and I could not sleep well)
First link/"old" repo: https://github.com/gebhardm/energyhacks/tree/master/RaspberryPi
Bart, I like own posts editable, please :-) (also to delete own answers to people not worth the answer; sorry for being annoyed)
I guess, we should close this thread and move on, as this one gets unhandy...
Hmmm, i just getting interested in using a RPI too :D
But now i don't know exactly how to use the github sources.
I'm become a little lazy when using the Ubuntu software centre or just use the command sudo apt-get install xxx
One of you should make a complete how-to, to use a Flukso panel in Linux (or some other Debian derivative).
Markus, you make surely a fantastic job with the files in github, but that's seems what complicated if i have to compile things ...
There is nothing to compile except if you choose to make node.js yourself; and even that is "simple and stupid"; By the way, RasPi is a learning platform to learn just that...
If you want off-the-shelf software, then you'll owe me 800Eur a day - and that is just our internal (sic) consulting price... (I already spent nearly this complete day to consolidate stuff in a single repo)
With respect to certain expectations formulated I must admit that I start to regard myself in the wrong story - "we can feed you, but you must swallow yourself"...
Note: RasPi is a Debian derivative; so everything discribed works also in an Ubuntu (even a Mac) environment; take an example from Pietro Spina - he uses another Linux environment and described pretty well what he alternatively to my description did - the only thing to do is "read" (grmph!)
@FLUC - what about you consolidating the given facts in a nice, compact format? That I would regard a nice contribution beyond a 100 Ohm resistor...
Markus, perhaps you read it in a other topic, but i made the temperature sensor working on a standard Flukso and publish the pcb board and schematics here in the forum, but nobody was very interested i think... works for me for months now.
You can see it working in the same dash view than gas, so in winter i see what the heating is doing.
Sorry for going off-topic ;-)
@Pietro Spina @gebhardm Regarding the rendering of sensor data from multiple FLM's in a single network, I would suggest you use Bonjour as a service discovery protocol. On Linux you'll be looking for the Avahi library. The FLM advertises the its 'services' via Bonjour. Have a look at the /etc/avahi/services/mqtt.service file on the FLM. It should just be an sudo-apt get install avahi on a Raspi. You will need to connect to the Avahi daemon and filter on the _mqtt._tcp service type. Getting the data via D-bus might also be an option.
There also seems to be a corresponding node.js module - https://github.com/agnat/node_mdns - so I'll have a look into this "some fine day"...
As this is a next topic to deal with, please close this thread as I do not await further insight at the moment...
Multiple FLM discovery will be dealt with in https://www.flukso.net/content/multiple-flm-discovery
<eot>