Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT - many, many "reconnecting" messages in pm2-out.log #67

Open
spitzlbergerj opened this issue Dec 4, 2023 · 4 comments
Open

MQTT - many, many "reconnecting" messages in pm2-out.log #67

spitzlbergerj opened this issue Dec 4, 2023 · 4 comments

Comments

@spitzlbergerj
Copy link

spitzlbergerj commented Dec 4, 2023

Hi,
I have moved my MQTT broker to HiveMQ in the cloud. However, I now have an infinite number of "reconnecting" messages in the pm2-out.log. However, I think that subscribed MQTT messages are still read and processed.

Here is my config
`
module: 'MMM-MQTT',

	position: 'top_right',

	header: 'Solarpanels',

	config: {

		logging: false,

		useWildcards: false,

		mqttServers: [

			{

				address: 'blabla.s1.eu.hivemq.cloud',  // Server address or IP address

				port: '8883',          // Port number if other than default

				user: 'StarTrekHiveMQTT',

				password: 'blablabla',

				clientId: 'mirror-mqtt-solarpanels',

				subscriptions: [

....
`

And here are the log entries
`
[04.12.2023 14:47.26.719] [LOG] MMM-MQTT: Starting client for blabla.s1.eu.hivemq.cloud:8883 user StarTrekHiveMQTT

[04.12.2023 14:47.26.726] [LOG] MMM-MQTT: Connecting to mqtt://blabla.s1.eu.hivemq.cloud:8883

[04.12.2023 14:47.36.216] [LOG] MMM-MQTT: blabla.s1.eu.hivemq.cloud:8883StarTrekHiveMQTT reconnecting

[04.12.2023 14:47.41.047] [LOG] MMM-MQTT: blabla.s1.eu.hivemq.cloud:8883StarTrekHiveMQTT reconnecting

[04.12.2023 14:47.43.546] [LOG] MMM-MQTT: blabla.s1.eu.hivemq.cloud:8883StarTrekHiveMQTT reconnecting

....
`

How can I track down the cause?

Could it be because HiveMQ requires the login with TLS?

Greetings and thanks
Sepp

@ottopaulsen
Copy link
Owner

Are you sure your connection data works? Have you tried using another tool?

@spitzlbergerj
Copy link
Author

Hi,
I have now tried different cloud MQTT brokers. The connection cannot be established with any of the services, as all cloud brokers require a TLS connection. Can I activate TLS in the module? Unfortunately, I haven't found anything about this.

I log in to NodeRED like this and it works:

noderedMQTTBrokerVerbindung noderedMQTTBrokerSicherheit

Thank you very much
Greetings
Sepp

@ottopaulsen
Copy link
Owner

If you look at the config, there is config for using a certificate file. You can try that. I am not too familiar with this myself, as it was developed by someone else.

@stevemason
Copy link
Contributor

If the problem is indeed related to TLS, then potentially all you need to do is modify your config file to look something like:

mqttServers: [
{
address: 'mqtts://blabla.s1.eu.hivemq.cloud', // Server address or IP address
port: '8883', // Port number if other than default
user: 'StarTrekHiveMQTT',
password: 'blablabla',
ca: '/path/to/ca/cert.crt', // Path to trusted CA certificate file
clientId: 'mirror-mqtt-solarpanels',

It has been a while since I worked on this. Maybe just adding mqtts:// to the address will fix it, or you may also need to add the CA certificate file line.

Looks like hivemq uses LetsEncrypt, so this page may help you identify the correct ca file to use: https://letsencrypt.org/certificates/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants