In the discussion on nicely designed gauges the request was raised to go beyond single-FLM installations.
If you have more than one FLM installed, you instantly get yourself the question on how to control them together.
Current scripts deal with a single instance only; but as we know Bart, there is already a solution: each FLM advertises its service(s) via Bonjour.
Thus the idea to enhance the single-instance persistence and visualization services with an appropriate FLM discovery; that is: integrate Bonjour into the persistence and visualization services to deal with "any number" of publishing sensor nodes...
This will be the story of this thread, so stay tuned for experiences gained and implementations provided...
The solution is already just a tiny step away... Using the multicast DNS service discovery module for node.js (
install npm mdns
) the discovery is as easy asprovides in my case for the Fluksometer following object
So the address(es) can easily be obtained and listened at.
Integration into the panel and chart will follow.
...to be continued...
The expert sees it instantly, it should have been
npm install mdns
, of course. Put the first code block with a text editor into a file, for example mdns_test.js, and run it with nodenode mdns_test.js
- et voila, surprise :-)I knew you'd scratch this itch sooner rather than later. I once made a Firefox demo using the DNSSD plugin to have FLM LAN auto-discovery in the browser. Got the demo working, but since not all OS'es have a bonjour daemon running, and even less browsers support mDNS (as evidenced on the former URL) it was only good for a demo. For M-to-M it's merely an npm install away.
Happy coding!
/Bart
nice... :-)
I was just about to post a step by step "copy paste how-to" in its own thread. It's based on the single flm code at https://github.com/gebhardm/flmdisplay
Should I hold off for a day or 2 (if this integration is close) or post ASAP with the hope that more eyes = more input.
cheers,
P
The panel - as a first shot - has now automatic service discovery capabilities (currently tested with one FLM only; will test with a second on the weekend); see https://github.com/gebhardm/flmdisplay/tree/master/panel for the update - and perform a
git pull
in your cloned flmdisplay folder to get the updated version. Easier as I thought (still not really used to non-blocking programming); 'persist' to follow, 'chart' remains unchanged...As I forgot - you have to install another node module:
npm install mdns
as described in the READMEIt's working with 3 Fluksometer on the network & finds all 9 gauge and displays.
:-D
I had to
sudo apt-get install build-essential
as well as maybe some other things that might not have been necessary. (I got lazy and used a fire hose when a watering can might have been fine.)also, I chose to do...
git fetch --all
git reset --hard origin/master
In the panel directory as the pull would not overwrite the files without committing my changes. Careful though, the above will nuke the dir and replace everything.
If you did changes you may have done a
git stash
before thegit pull
to send them into the "git nirvana", but still get a change to "somehow" retrieve them again...Noticed you made the updates to persist. Tested and working on fresh install. I updated my How-To to reflect the changes to the scripts and the new requirements due to MDNS. (Also, less logging in and out of mysql) thanks for the tip.
Also, though the discovery works, I get the following warnings. If you are building and running on a mac you might not be getting them.
I suspect that if you made the changes they suggest you would then get warnings on your mac... or maybe the isue is something deeper in mdns and not even worth bringing up... if so, please disregard. :-)
Note: The warnings are coming from the mdns modules, not my code; I experienced the same when using the scripts on a RasPi and also have issues in correctly determining the ip address (the many unresolved issues in the mdns github show what I experience with a lot of open source stuff: maintenance is not guaranteed - THIS ALSO AS A WORD OF WARNING TO CERTAIN PEOPLE EXPECTING OFF-THE-SHELF SOFTWARE WITH WARRENTY FOR NOTHING). I started to look for an alternative to using 'mdns', but didn't find such so far. So any hint is welcome.
If you experience issues, change back to the manually assigned IP address version (git checkout a5f0b21042); I'll see to set a tag on this version for easier retrieval...
FYI - I split the manual and automated IP-address-determination versions of the scripts into different branches: 'master' will be the main path of evolution, thus hold the "automated" variant; 'manual-ip' will be the path of the manually set, single IP-address version of the scripts.
So, if you
git clone http://github.com/gebhardm/flmdisplay
by default you are in 'master'; withgit checkout manual-ip
you may switch to the original version with the little need to manually adapt the scripts to your FLM's local IP address.