Hi Gebhard,
I've been playing with your excellent mqtt scripts trying to get the combined to work from https://github.com/gebhardm/flmdisplay , but with no luck.
I have the following displayed when starting the node:
- www:combined vk2him$ node serve_flmdata.js
- Database flm successfully connected
- Detected MQTT service on: 192.168.1.73:1883
- Create/connect to config table successful...
- Create/connect to data table successful...
However when I navigate to localhost:1080 I get the following displayed
- Latest MQTT message: no message received
The mysql table is also empty.
I can connect fine with mosquito with no problem as you can see:
- www:combined vk2him$ mosquitto_sub -h 192.168.1.73 -p 1883 -v -t /sensor/#
- /sensor/c7c90d029e018769b5fb26380c369845/counter [1428230773,924264,"Wh"]
- /sensor/c7c90d029e018769b5fb26380c369845/gauge [1428230775,590,"W"]
- /sensor/c7c90d029e018769b5fb26380c369845/gauge [1428230776,586,"W"]
- /sensor/c7c90d029e018769b5fb26380c369845/gauge [1428230777,596,"W"]
- /sensor/c7c90d029e018769b5fb26380c369845/gauge [1428230778,588,"W"]
- /sensor/c7c90d029e018769b5fb26380c369845/counter [1428230779,924265,"Wh"]
As well as the latest versions, I have even tried installing an older 0.9 version of socket.io but it fails too:
- npm install socket.io@"~0.9.1"
I have tried your other older scripts by using the 0.9 version of socket.io but I always get this:
- Latest MQTT message: no message received
So I was wondering if I have done something wrong, or if my FLM needs something else to make it work? I am running Version 2.32
Thanks
Ian
There was an issue with the MQTT version that was "incompatible" with the one I used; I changed that yesterday; try will a "git pull".
Sorry, I'm only new to this - how do I do a git pull please?
Thanks
How did you get the software in the first place?
If you used
git http://github.com/gebhardm/flmdisplay
then change into the created folder./flmdisplay
and just performgit pull
- this updates the received code to the current state; if you downloaded the software from a release as .zip then delete the complete flmdisplay folderrm -r flmdisplay
and get it via git again as above described.By the way, the socket.io was not the problem, but the mqtt module...
Thanks for your help, I downloaded the .zip file however I still have the same Latest MQTT message: no message received problem.
I tried also loading older versions of mqtt with same problem.
I'm running mqtt version 1.1.2 - which one do you use?
P.S.
Other than read.me changes, I couldn't see any changes to the files you did yesterday?
Git is a code management system based on continuous commits... Help yourself to read the pretty good documentation...
If not denoted otherwise, all shall work with a current
npm install
.I assume that it is your
localhost:1080
; why so ever there are computers that point this to127.0.0.1
and not the machine's IP address; thus, try with<machine's IP address>:1080
- in both documentations, on Ubuntu AND RasPi there was never a word of localhost, buthttp://"local IP address":1080
(but documentation seems for the ... these days - sorry).Thanks anyway - I tried localhost, 127.0.0.1 and even the ip of the system itself - also tried to connect to it from another computer across the lan but always Latest MQTT message: no message received problem.
i'm running it on a Mac Mini running Yosemite.
By the way, there are two different things:
1)
node serve_flmdata.sh &
had an issue with the current mqtt module; after fetching the current version of the "combined script" this should resolve in database entries - better use "git" instead of .zip download.2)
http://<ip address>:1080>
relies on correct socket assignment, which partly seems an issue when localhost does not point to the machine's IP address, but "home"; as an alternative the corresponding web server advertises itself as "FLM data processor" in Bonjour, so you may also take this endpoint.So, progress step by step; if the database gets readings the first half is reached...
As a test, try https://github.com/gebhardm/energyhacks/tree/master/Graph with changing "serve_mqtt.js" on your fluksometer's address
This works on my iMac also with "localhost:1080" - if that doesn't work out of the box then something "deeper" in your machine is not working...
No luck with Graph - I just tried on two Macs - when I connect to localhost:1080 it displays the same page without any graphs - it looks just like running graph.html ... Can you please confirm Flukso Version 2.32 is enough to run this? Thanks
I wonder too if this is a Yosemite issue - Is your iMac on Yosemite?
It works also on an FLM v232 (there are no changes on the MQTT handling) and yes, my Mac runs Yosemite - just did a complete renewal of node.js and its modules to v0.10.38-release and plain "npm update" - thus, everything up-to-date.
By the way: What browser do you use? JavaScript switched on in the settings? - just tested on FF 37.0.1 and Safari 8.0.4.
In the browser right-click:element information >> does the console show errors (except for missing .ico)
Folder access rights set correctly for finding the js-libraries? (see also the "symbolic link" issue)
Thanks for staying with me ... I just reloaded node.js and modules then npm update .... tried in Safari and Chrome ... no problem with finding js-libraries and links etc.
Looking at you code I saw a comment :
// gauge length 2 is sent from Arduino sensors (in my case)
I'm not sure if this might be an issue, I have one flukso clamp connected - is this a Arduino sensor and is teh gauge length also 2?
Thanks
No, this something different wäre I enrich sensor data without time, no changes for FLM...
All messages received are passed on to the socket; function handle_sensor just stores the FLM messages and enriches messages without timestamp.
You may put a console.log into this function to see if the mqtt client works at all:
As written, it "should" work as it does on my Mac (or RasPi)...
I added the console.log to a few other lines to diagnose further like this
This displays the following output with nothing else:
i did some more testing ... I installed node.js onto a windows machine and tried the Graph script with the same problem.
I then tried changing the mqttbroker to a IP address that isn't the FLM and it now says it connects to that IP address which is impossible:
Connected to 192.168.1.173:1883
So somehow these lines of code isn't working for me on Mac and Windows?
As I do nothing special than using available open source stuff, to narrow the source of better switch over to what JP Mens elaborated on MQTT; it maked IMHO no sense to fiddle around with my scripts when the basic stuff is not working. So, reduce to the minimum to get MQTT working on the node.js level - see http://jpmens.net/2015/02/13/mqtt-article-series/ and other stuff on http://jpmens.net
Yes you're right - I'll try to get mqtt working by itself - thanks for your help!
The
if (mqttclient) console.log("...
is misleading as a real connect is not indicated by a non-null mqttclient but amqttclient.on("connect", function() {});
event - I changed that in the code and assume that your mqttclient never really connected; what network segments do you use? As the mdns detects it, well, I have no clue what happens...Thus I would recommend to strip everything down to the minimum (actually the serve_mqtt.js cannot do much less) and take a closer look at the mqtt connect or error?!? (there is also a
mqttclient.on("error", function(){});
event)Thanks Gebhard, I'll try those functions to further fault-find. I have a very simple network - an ADSL router/wifi modem with the FLM connected via wireless. the only change I've made to the FLM is to disabled the firewall so I can connect via wireless.
If your WLAN is in another IP-area than the LAN (for example 192.168.1.x versus 192.168.0.y) then the network mask might prevent a connect from a LAN attached computer if it is set to 255.255.255.0; then it should be 255.255.254.0 to allow reaching n.m.0.x and n.m.1.y - but this is just a guess as even the simplest network installation may have its surprises :-) (when I plug in a WLAN-router "tp-link tl-wr702n" to gain WLAN access for a tablet exactly this prevents reaching my FLM if the router is not "just an access point" to the LAN) - but this is computer "science": Why simple if it can be complicated; we do it not because we have to but we can (I hate theses guys)
Thanks - all my devices are on the same sub-net - 192.168.1.xxx - the FLM is .73 and the MacMini is .79 ... I'm still running checks, it's very strange that the mosquito command
mosquitto_sub -h 192.168.1.73 -p 1883 -v -t /sensor/#
works fine ..."Was lange währt wird endlich gut" - I guess I fixed it...
With the new version of the mqtt module the payload format changed to BUFFER; this makes the payload handling a bit more tricky than beforehand and what seemed to have caused problems with a fresh
npm install
.At least on my Raspberry Pi after a
npm update
node all node modules (mqtt, mysql, mdns, socket.io) are on the current release and FLM messages (and Arduino messages) are "still" shown in the graph...Thus, in contrary to the "never change a running system" you may now check again (hopefully the last time) and enjoy a working combined visualization.
I will never understand why people change public interfaces... (and sorry for any inconveniences)
https://github.com/gebhardm/flmdisplay
I am sorry Gebhard, I have updated to your latest combined version and performed again
npm install mqtt mdns socket.io mysql
but I still getLatest MQTT message: no message received
.This is very strange as your code successfully finds my FLM from the following, so it's nearly working:
I've done further testing by inserting console.logs at various points in serve_flmdata.js .. all seems OK until this line as it never displays anything:
...so actually there is never received a message... No clue what's going on within the mqtt module...
Corresponding to your post from 02:06 you didn't even get a connect, so here starts the search: