ironsheep / RPi-Reporter-MQTT2HA-Daemon

Linux service to collect and transfer Raspberry Pi data via MQTT to Home Assistant (for RPi Monitoring)
GNU General Public License v3.0
475 stars 64 forks source link

MQTT connection error. Please check your settings in the configuration file "config.ini" #60

Closed dumi7ru closed 1 year ago

dumi7ru commented 2 years ago

Dear Stephen,

Could you please advise how to confiure config.ini, so that RPI Reporter can connect to my Mosquitto docker container?

bert269 commented 1 year ago

I apologize for jumping in on this thread - do not want to take it over and do not want to create another with the same error message.

I get the same connection error message on a Rpi4. I have HASS.Agent running on a Windows machine and it uses the same config settings, and that works fine - reports to MQTT in HA. I can supply my RPi-Reporter-MQTT2HA-Daemon config.ini file if needed and the values setup in HA.

Any ideas what could be wrong?

Thanks

StanDaMan0505 commented 1 year ago

I have the same message. If I use the debug flag, I get the following output

[2023-01-31 05:59:19] - (DBG): rpi_filesystem_space=[8GB]
[2023-01-31 05:59:19] - (DBG): rpi_filesystem_percent=[27]
[2023-01-31 05:59:19] - (DBG): rpi_filesystem=[[('8', '27', '/', '/dev/root')]]
[2023-01-31 05:59:19] - Connecting to MQTT broker ...
[2023-01-31 05:59:19] MQTT connection error. Please check your settings in the configuration file "config.ini"

So it seems, that this Raspberry (with pivpn and pihole on it) can't connect to the other Raspberry (with HA and MQTT Broker on it).

Config.ini looks like this:

# The hostname or IP address of the MQTT broker to connect to (Default: localhost)
# Also read from the MQTT_HOSTNAME environment variable
hostname = 192.168.0.xxx # IP address of  the Raspberry with HA and MQTT Broker

# The TCP port the MQTT broker is listening on (Default: 1883)
# Also read from the MQTT_PORT environment variable
port = 1883

Network configuration in MQTT in HA is also listening to 1883.

What am I missing.

Thanks for any help.

I might have found a solution.

Apparently one of these services have to run

systemctl is-enabled NetworkManager-wait-online.service systemd-networkd-wait-online.service
bert269 commented 1 year ago

ok Thanks.

The problem was that I had coded: Hostname - https://192.168.1.xxx https://192.168.1.xxx instead of Hostname = 192.168.1.xxx. After I fixed this, it worked for multiple devices.

Thank you.

On Mon, Jan 30, 2023 at 11:07 PM StanDaMan0505 @.***> wrote:

I have the same message. If I use the debug flag, I get the following output

[2023-01-31 05:59:19] - (DBG): rpi_filesystem_space=[8GB] [2023-01-31 05:59:19] - (DBG): rpi_filesystem_percent=[27] [2023-01-31 05:59:19] - (DBG): rpi_filesystem=[[('8', '27', '/', '/dev/root')]] [2023-01-31 05:59:19] - Connecting to MQTT broker ... [2023-01-31 05:59:19] MQTT connection error. Please check your settings in the configuration file "config.ini"

So it seems, that this Raspberry (with pivpn and pihole on it) can't connect to the other Raspberry (with HA and MQTT Broker on it).

Config.ini looks like this: The hostname or IP address of the MQTT broker to connect to (Default: localhost) Also read from the MQTT_HOSTNAME environment variable

hostname = 192.168.0.xxx # IP address of the Raspberry with HA and MQTT Broker The TCP port the MQTT broker is listening on (Default: 1883) Also read from the MQTT_PORT environment variable

port = 1883

Network configuration in MQTT in HA is also listening to 1883.

What am I missing.

Thanks for any help.

— Reply to this email directly, view it on GitHub https://github.com/ironsheep/RPi-Reporter-MQTT2HA-Daemon/issues/60#issuecomment-1409820610, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEN5KABTQBWSO23FTPZDNW3WVCTZ3ANCNFSM5YRUA5OQ . You are receiving this because you commented.Message ID: @.***>