MQTT Server (within emonCMS / emonPi)

I am having a struggle getting a Shelly device to send MQTT messages to my MQTT server, which is within my emonPi. Looking within the MQTT section in emonCMS on a browser, it says Version 1.4.10, Host localhost: 1883 (127.0.0.1)

Question: what does the 127.0.0.1 mean, as as far as I thought, the IP of the emonPi was 192.168.2.50, and the MQTT port was :1883.

I have checked on an emonTx MQTT dashboard, and that communicates fine to 192.168.2.50:1883.

TIA

If you are using the MQTT broker on the same device (i.e. emonhub using the broker on the same emonPi) you can use 127.0.0.1. This IP address always points to the local device.

If you want to access the broker from a different machine, use that machines IP Address. Port is the same but you must supply user/password as well as anonymous access is disabled.

There is no such thing as the emonTX does not have a webUI and does not communicate via MQTT.

Thanks @borpin - that is now understood.

I should have referred to the MQTT section within the espwifi UI.

I wonder whether the lack of anywhere to tick / untick anonymous access in the Shelly dashboard is the issue? (In the example below, I have tried QoS at 0, 1 & 2)

No, it is a broker setting - the broker decides if it allows it.

Try the server without the port (or does it tell you to do that).

Otherwise, if it is connected to your network, and it is on the same subnet it should work.

1 Like

You can edit the MQTT config on the emonPi to enable anonymous access if necessary - I had to do that to support a bit of kit that didn’t provide for authentication details.

1 Like

Hi,

looks like the password you are using is a bit short, it is not your normal logon password but one specific for MQTT

John

1 Like

Thanks all - not quite sure how or why - I changed the settings so many times I can’t recall which did the trick, but it is now working. :crazy_face:

3 posts were split to a new topic: Connect a Shelly to Emoncms