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
Failed to connect to MQTT broker #17
Comments
And you're sure you have an MQTT broker running on 192.168.2.222? |
Yes, MQTT broker is working on 192.168.2.222. I have my electric meters also in the same broker and I get values. I can also publish and subscribe manually from HA to broker using mosquitto_sub and pub.
|
Installed mosquitto broker as add-on. Service is now found by the script. [16:08:01] INFO: MQTT service found, using service config |
Not sure why it doesn't work, feels like there's something wrong with your setup if even the Mosquitto addon doesn't work. |
@tomrosenback any ideas here? |
I tried installing the Mosquitto addon and everything worked out of the box 🤔
|
Seems like there is some limitations within the system as the addon aswell is not working |
Yeah I just updated the addon to 1.3.0 and noticed that it needed a minor fix in order to start at all, so I published 1.3.1 a few minutes ago. |
I update the addon, but still same issue appears, the MQTT Mosquitto broker version is 6.2.0 . s6-rc: info: service s6rc-oneshot-runner: starting |
btw how to specify the device? Now I'm using the default value /dev/ttyUSB0 |
You need to check the correct path from Home Assistant's "system overview" page. It's somewhere under settings. ttyUSB0 is fine until you have more than onr USB serial device. |
Any ideas how to continue or what I should try next find a solution to this problem? |
Does it work if you restart the eda-modbus-bridge addon? |
No it doesn't help, I reinstall both Mosquitto MQTT broker and eda-modbus-addon. Last row in the log is the same, Failed to connect to MQTT broker: Timed out. I'm running HassOS and all services are running in HA. |
You can use the HTTP API to query data from the ventilation unit. First you need to enable it in the addon configuration, then browse to x.x.x.x:yyyy where x.x.x.x is your Home Assistant IP address and yyyy is the HTTP port specified in the addon configuration. |
Now you need to give more details, how to get data out of HTTP API? |
@Jar1H do you see anything in the Mosquitto addon logs when the timeout occurs? |
In debug mode the log is a bit messy but these lines shows up when starting the add-on: |
Looks like normal "background noise", no trace of a connection from any client |
@Jar1H can you post your Mosquitto addon configuration? |
Here is the configurations: logins: [] And Network config: The MQTT broker is working properly |
Is there something basic misunderstanding what I do wrong during the installation? Yesterday I try the clean HA installation on my laptop (inside wm), and same problem occured. |
There's nothing special to do, it should just work. I haven't been able to reproduce this myself. |
how does this add-on behave if there is a fault on the Enervent side? |
It will fail to publish any readings to the MQTT broker |
Here is my Enervent addon configuration
The addon will not care as such if the Modbus communication is working or not, at least not in regards of the ability to connect to the MQTT broker. In my config you see in the mqtt > host section "ip-of-your-MQTT-broker", the IP to enter here you can find at the bottom of https://my.home-assistant.io/redirect/network page in the Network adapter section Please check your configuration and test out. |
Thanks, but unfortunately the problem is still there. In the Log-file there is always same text: Connecting to MQTT broker at mqtt://core-mosquitto:1883, even I specified the host manually? |
Yeah, unfortunately it's not possible to specify an external broker as long as the Mosquitto addon is installed, see #18 |
I set up external MQTT broker, now log file looks like that: |
I can't really help anymore without being able to reproduce this :/ What kind of device do you run Home Assistant on? |
I'm running HassOS in Rasberry PI4, |
Does the Pi use ethernet or wifi? |
Ethernet connection only |
Were you able to verify that the software is able to comnunicate with the ventilation unit? I'm wondering if a Modbus "connect" could end up blocking the event loop so badly that the MQTT client refuses to connect. |
I could not get a tested connection to the ventilation device. It is beyond my knowledge and I need a bit more specific advice how to do it. |
advice how to test the connection? |
I had at first Raspberry pi 2 where this problem occurred first time. Then I made modbus config to the HA config file and modbus worked for me. Then I change Raspberry to x86 platform and try with this and got same problem. So it is not HW problem. I think it's more like authentication problem. |
@visa69 do you have any ideas what would be next step to try to fix this? I'm using mosquitto MQTT broker on default config and same for the Enervent EDA Modbus Bridge. I created own user for mqtt in HA. |
Should help debug whether the "Timed out" messages reported in Jalle19/home-assistant-addon-repository#17 are from the MQTT client or the Modbus client
@visa69 @Jar1H can you update your addon version to 1.3.2 (click the triple dot menu and then Check for updates in the addon store if you don't see the update), it has some changes to error messages and logging which should highlight what's actually going on here. I believe the "Timed out" message is not actually from connecting to the broker but from trying to read values from Modbus. Please post new logs once you've updated to 1.3.2. |
Hi, here is the log after the update: s6-rc: info: service s6rc-oneshot-runner: starting |
Okay, the error trace is apparently still missing but it seems like the "timed out" comes from the Modbus client. You need to doublecheck your connection to the ventilation unit. |
Done, is there any ways to test the connection manually? |
Yes, you can add individual Modbus registers as sensors in Home Assistant. There's probably some good guides on it if you search around. There's a register list as a PDF in this repository. Although to be honest, if you connect it correctly to a supported ventilation unit it should just work 🤷 Perhaps you could try a different RS-485 adapter? |
Cheap RS485 connectors can be tricky, some work, some don't. Have you tried swapping A/B wires? |
@tomrosenback i will try this... when I changed the A/B wires and it works! I have checked the connection several times, changed the wire and now when I changed the wires to a cross it started to work. Feel bit stupid, but I Blindly trusted the RS-485 adapter and its markings, apparently they are crossed? |
It's a common source of confusion since the correct way to connect TX and RX is in a crossover - TX to RX and vice versa. Some adapters use A and B instead which makes it hard to know which is which. Glad you got it working, I'll close this issue now 👍 |
I added a troubleshooting section: Jalle19/eda-modbus-bridge@dfd3803 @visa69 please let us know if swapping your A and B data cables works for you too. |
Both, localhost and external broker fails.
[17:25:44] INFO: No internal MQTT service found, using addon config
Opening serial connection to /dev/serial0, slave ID 1
Connecting to MQTT broker at mqtt://localhost:{"host":"localhost","ssl":false,"port":1883,"username":"","password":"*","publish_interval":5}
Using MQTT broker authentication
Failed to connect to MQTT broker: connect ECONNREFUSED 127.0.0.1:1883
[17:31:48] INFO: No internal MQTT service found, using addon config
Opening serial connection to /dev/serial0, slave ID 1
Connecting to MQTT broker at mqtt://192.168.2.222:{"host":"192.168.2.222","ssl":false,"port":1883,"username":"","password":"*","publish_interval":5}
Using MQTT broker authentication
Failed to connect to MQTT broker: Timed out
The text was updated successfully, but these errors were encountered: