ned-kelly / docker-epever-homeassistant

A Docker based Home Assistant interface via MQTT for the EPEver MPPT Charge Controllers
GNU General Public License v3.0
19 stars 7 forks source link

Unable to connect to mqtt broker #5

Open Vininski opened 2 years ago

Vininski commented 2 years ago

the bushrangers/ha-epever-mqtt container is repeatedly restarting, my knowledge on this is very limited but I gather there's a connection issue to the broker based on the following logs:

`Starting MQTT Client... Epever Tracer Poller for Home Assistant.Creating sensor: manufacturer PHP Fatal error: Uncaught PhpMqtt\Client\Exceptions\ConnectingToBrokerFailedException: [6] Establishing a connection to the MQTT broker failed: Connection refused: Not authorized. in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php:376 Stack trace:

0 /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php(147): PhpMqtt\Client\MQTTClient->performConnectionHandshake(NULL, NULL, false)

1 /opt/epever/client(166): PhpMqtt\Client\MQTTClient->connect()

2 /opt/epever/client(55): registerHATopic('manufacturer', '', 'solar-power')

3 /opt/epever/client(35): registerTopics()

4 {main}

thrown in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php on line 376 Starting MQTT Client... Epever Tracer Poller for Home Assistant.Creating sensor: manufacturer PHP Fatal error: Uncaught PhpMqtt\Client\Exceptions\ConnectingToBrokerFailedException: [6] Establishing a connection to the MQTT broker failed: Connection refused: Not authorized. in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php:376 Stack trace:

0 /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php(147): PhpMqtt\Client\MQTTClient->performConnectionHandshake(NULL, NULL, false)

1 /opt/epever/client(166): PhpMqtt\Client\MQTTClient->connect()

2 /opt/epever/client(55): registerHATopic('manufacturer', '', 'solar-power')

3 /opt/epever/client(35): registerTopics()

4 {main}

thrown in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php on line 376 Starting MQTT Client... Epever Tracer Poller for Home Assistant.Creating sensor: manufacturer PHP Fatal error: Uncaught PhpMqtt\Client\Exceptions\ConnectingToBrokerFailedException: [6] Establishing a connection to the MQTT broker failed: Connection refused: Not authorized. in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php:376 Stack trace:

0 /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php(147): PhpMqtt\Client\MQTTClient->performConnectionHandshake(NULL, NULL, false)

1 /opt/epever/client(166): PhpMqtt\Client\MQTTClient->connect()

2 /opt/epever/client(55): registerHATopic('manufacturer', '', 'solar-power')

3 /opt/epever/client(35): registerTopics()

4 {main}

thrown in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php on line 376 Starting MQTT Client... Epever Tracer Poller for Home Assistant.Creating sensor: manufacturer PHP Fatal error: Uncaught PhpMqtt\Client\Exceptions\ConnectingToBrokerFailedException: [6] Establishing a connection to the MQTT broker failed: Connection refused: Not authorized. in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php:376 Stack trace:

0 /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php(147): PhpMqtt\Client\MQTTClient->performConnectionHandshake(NULL, NULL, false)

1 /opt/epever/client(166): PhpMqtt\Client\MQTTClient->connect()

2 /opt/epever/client(55): registerHATopic('manufacturer', '', 'solar-power')

3 /opt/epever/client(35): registerTopics()

4 {main}

thrown in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php on line 376 Starting MQTT Client... Epever Tracer Poller for Home Assistant.Creating sensor: manufacturer PHP Fatal error: Uncaught PhpMqtt\Client\Exceptions\ConnectingToBrokerFailedException: [6] Establishing a connection to the MQTT broker failed: Connection refused: Not authorized. in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php:376 Stack trace:

0 /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php(147): PhpMqtt\Client\MQTTClient->performConnectionHandshake(NULL, NULL, false)

1 /opt/epever/client(166): PhpMqtt\Client\MQTTClient->connect()

2 /opt/epever/client(55): registerHATopic('manufacturer', '', 'solar-power')

3 /opt/epever/client(35): registerTopics()

4 {main}

thrown in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php on line 376 Starting MQTT Client... Epever Tracer Poller for Home Assistant.Creating sensor: manufacturer PHP Fatal error: Uncaught PhpMqtt\Client\Exceptions\ConnectingToBrokerFailedException: [6] Establishing a connection to the MQTT broker failed: Connection refused: Not authorized. in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php:376 Stack trace:

0 /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php(147): PhpMqtt\Client\MQTTClient->performConnectionHandshake(NULL, NULL, false)

1 /opt/epever/client(166): PhpMqtt\Client\MQTTClient->connect()

2 /opt/epever/client(55): registerHATopic('manufacturer', '', 'solar-power')

3 /opt/epever/client(35): registerTopics()

4 {main}

thrown in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php on line 376 Starting MQTT Client... Epever Tracer Poller for Home Assistant.Creating sensor: manufacturer PHP Fatal error: Uncaught PhpMqtt\Client\Exceptions\ConnectingToBrokerFailedException: [6] Establishing a connection to the MQTT broker failed: Connection refused: Not authorized. in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php:376 Stack trace:

0 /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php(147): PhpMqtt\Client\MQTTClient->performConnectionHandshake(NULL, NULL, false)

1 /opt/epever/client(166): PhpMqtt\Client\MQTTClient->connect()

2 /opt/epever/client(55): registerHATopic('manufacturer', '', 'solar-power')

3 /opt/epever/client(35): registerTopics()

4 {main}

thrown in /opt/epever/vendor/php-mqtt/client/src/MQTTClient.php on line 376 Starting MQTT Client... `

The mqtt broker is working for Frigate (installed HASS addon) and when testing using the mqtt explorer app. Is there somewhere I need to enter the user name and password for the broker in the config?

rizalafif commented 2 years ago

I have similar problem. Do you manage to solve this in config,yml?

Vininski commented 2 years ago

I have similar problem. Do you manage to solve this in config,yml?

Unfortunately I never figured it out. Just recently though I stumbled upon the modbus module in ESPHome so I might give that a go since I have a few esp devices setup already. Would use less battery power too. It does seem to require a TTL to modbus convertor board though. https://www.esphome.io/components/modbus_controller.html

rizalafif commented 2 years ago

Thanks a lot! I found another way too.. was thinking to use this script + mosquitto_pub to send selected data from the output to HA. https://github.com/rosswarren/epevermodbus

jiannis1453 commented 2 years ago

I have the same issue. I believe it has to do with Mosquitto Broker not accepting anonymous login's any more. I added the credentials in the config.yml but with no effect. In the past I had the same issue with the "docker-voltronic-homeassistant" but ned-kelly fixed it and still runs perfectly. Maybe docker-epever-homeassistant also needs updating to be able to use username and password to connect to Mosquitto broker.

sdacheson78 commented 2 years ago

I also have the same issue. How do I add username and password. Just add those to the config file?

antorob commented 1 year ago

my solution for this error was: docker-compose build but now have other problem, with php versionof my raspberry....