I have 2 projects running, which send their data from a ESP8266 via MQTT to Node-Red and from there it is sent to an Influx-DB. Later I can use this data for Grafana to visualize. The problem is, that all that is 2 years ago since installing. At the time I wrote my own code via Arduino-Software and PubSubClient.h and it works fine since then.
Now I installed a new small PV-plant in my garden and want to track the produced energy with a energymeter with S0-Connection. This time I used ESPEasy to get and send the data on the ESP8266. For testing I used a BME280-sensor. My problem is, that I do net get the data to Node-Red.
The following works:
ESPEasy on a ESP8266
sending data to broker.hivemq.com (for testing)
If I try to send the data to my own server (VServer, not local), I do not know where the data get lost.
Main problem is probably, that Node-Red-Frontend loses connection to the server all the time. Does anyone have a solution for that? At the moment I do not even see debug-messages for the other nodes, which work.
Is there also another option to show me incoming messages directly on mosquitto?
Is there a reason to use an Internet based MQTT Broker? Generally, it is much easer - and safer - to use a local broker. You can run Mosquitto along with Node-RED and many other things on a standard Pi so no reason not to.
Hey, of course it is easier, but this was not the question. The big advantage is, that I can access the data from everywhere and not only from the same Wifi. Also I can bundle sensors from several places and do not need a separate Raspberry for each different Wifi, where there is a sensor.
Mosquitto, Node-red and so on are just installed on a webserver instead of a Raspberry Pi, otherwise there is not so much difference.
could you draw a block diagran showing the path a sensor reading will take to get to the influx db. Include all the components it will go thru like your local WiFi device (since that is what the ESP8266 will be origianally talking to.)
As Said, if you install MQTT Explorer, you can connect it to broker.hivemq.com to make sure the data is getting there.
Hello, attached the 2 scenarions (real ans test with hivemq). At HiveMQ my data are received, so the local ESP8266 seems not to be the problem). When I switch the controller on the ESP8266 back to my server I do not see the data anywhere. I also need to develop a function to bring the data to a format I can write into the database. But in the first Step I just need to check if the data arrives at my Server. Here is where I struggle. I wrote it into a file in Node-Red, but there I do not see any data. Not sure if that was correct.
For a test I would create a small test flow with an inject node connected to an mqtt-out node and an mqtt-in node connected to a debug node. Use a topic that is different from the topic your sensors are using and run the test. Does a message come thru?
What version of NR, Node.js and mosquitto are you running on your Pi? You can open a terminal window and run
Have you configured Mosquitto to allow access from other devices? If not, then create a file called /etc/mosquitto/conf.d/mossy.conf (the name does not matter, provided it is in that folder with extension .conf)
In there put
I also add this which provides human readable timestamps in the mosquitto log