I have googled this forum and wider - but nothing helps!
Node-Red portal is there - but when I configure it , to get the MQTT feed that is already on the box (the emon topic) - the graphical interface is stuff saying ‘connecting’.
Probably some simple thing I;m over-looking… but I’m a good googler and found nothing. I did find out of date stuff on node-red on OEM (eg that it comes with a default working config)
I want to have a play with Node-red talking to my emonPi (with a view to later adding feeds from some IoT things - Shelly
I have a fresh emonPi set up on OEM-purchased hardware - with 4 emonTH. All work fine.
I installed node-red on the same Pi. From the upstream node-red resources.
the portal works =-I can drag MQTT things into it - but it never connects.
The MQTT is on local host -the same box.
I can access the portal from my laptop (ubuntu 20)'s browser.
Maybe there is a firewall thing… preventing node=-red talking to the local=host MQTT…
That’s a bad idea. The EmonSD is optimised for emoncms and adding other things is prone to break stuff.
On the MQTT connection settings in Node-Red, have you added the user and password? Better to use the IP as well -more reliable that ‘localhost’.
I’d agree generally, but I’ve been running EmonCMS and NodeRed on a Pi2 for for years and not had any real issues (until last week, but that was probably power related).
As for MQTT in/out of EmonCMS/NodeRed, it works great, I have dozens of things flying in/out of NR code. Adding to @borpin suggestions, do you have the the correct MQTT topic name? Like “emon/emontx/power1”. You could try a general topic like “emon/#” with just a subscribe and debug node, which should show all the messages.
This popped up on “Latest” because of @JustPlaying’s reply and I noticed this:
If you connect to localhost (or 127.0.0.1), it should work unless something really nasty happens to the hosts file or other basic device configuration, and then you probably have bigger problems (such as a corrupt filesystem).
If you use the LAN IP address, the connection may fail if the network connection is down temporarily (for some values of down, including if the device usually gets its IP from a dhcp server which I think is the default in emonCMS’s Setup: WiFi). I don’t know how quick Node-Red is at recovering failed connections when the network returns.
If you move Node-Red off to its own server, you’ll need to change the settings not to use localhost (unless you move the MQTT server with it), but how else could “localhost” be less reliable than using the LAN IP address?