yllibed / Zigbee2MqttAssistant

GUI for Zigbee2Mqtt running in docker and HASS.IO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unable to connect to mqtt server

bluesailor45 opened this issue · comments

created docker-compse file for mqtt server, zigbee2mqtt and zigbee2mqttserverassistant. docker zigbee2mqtt is succesfully connected to mqtt server, but zigbee2mqttassistant does not connect to mqtt: Tried already different variants to Z2MA_Settings for mqttserver as eg. 127.0.0.1:1883 ,etc but nne did work. Please help.

this is docker-compose file:

version: '3'
services:
zigbee2mqtt:
container_name: zigbee2mqtt
image: koenkk/zigbee2mqtt
volumes:
- ./data:/app/data
- /run/udev:/run/udev:ro
devices:
- /dev/ttyACM0
privileged: true
environment:
- TZ=Europe/Amsterdam
- "homeassistant:true"
network_mode: host
mqtt:
container_name: mqtt-server
image: eclipse-mosquitto
ports:
#- "1883:1883"
- "9001:9001"

 zigbee2mqttAssistant:
   image: carldebilly/zigbee2mqttassistant
   container_name: assist
   environment:
     - Z2MA_SETTINGS__MQTTSERVER= mqtt-server
     #- Z2MA_SETTINGS__MQTTUSERNAME={MQTTUSERNAME}
     #- Z2MA_SETTINGS__MQTTPASSWORD={MQTTPASSWORD}
  # Set to your TimeZone when using on Linux https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  # Won't work if you're using the Windows version of the container
     - TZ=Europe/Amsterdam
   ports:
     - 8880:80
   restart: unless-stopped

this is (partial) log of zigbee2mqttassist:

Starting Zigbee2MqttAssistant v0.3.157+Branch.master.Sha.ea388c3bbc2d43c4c9c62f27bb6764911ba4acc9...
warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {97c39648-838d-4fed-950e-b75a1858763f} may be persisted to storage in unencrypted form.
Hosting environment: Production
Content root path: /app
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.
(base) kurt@kurt-VG086AA-UUZ-m9770ch ~/Documents/Docker/zigbee2mqtt $ docker logs assist
Starting Zigbee2MqttAssistant v0.3.157+Branch.master.Sha.ea388c3bbc2d43c4c9c62f27bb6764911ba4acc9...
warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
Storing keys in a directory '/root/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
No XML encryptor configured. Key {97c39648-838d-4fed-950e-b75a1858763f} may be persisted to storage in unencrypted form.
Hosting environment: Production
Content root path: /app
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.
warn: Zigbee2MqttAssistant.Services.MqttConnectionService[0]
Unable to connect to MQTT server mqtt-server.
MQTTnet.Exceptions.MqttCommunicationException: Resource temporarily unavailable
---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000001, 11): Resource temporarily unavailable
at System.Net.Dns.InternalGetHostByName(String hostName)
at System.Net.Dns.ResolveCallback(Object context)

I'm getting the same after the last Home Assistant update.

Here's my log

Starting Zigbee2MqttAssistant v0.3.157+Branch.master.Sha.ea388c3bbc2d43c4c9c62f27bb6764911ba4acc9...
warn: Zigbee2MqttAssistant.Services.SettingsService[0]
      Section 'settings' in configuration does not exists. Will use default settings instead.
Hosting environment: Production
Content root path: /app
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.
warn: Zigbee2MqttAssistant.Services.MqttConnectionService[0]
      Unable to connect to MQTT server mqtt.
MQTTnet.Exceptions.MqttCommunicationException: Name or service not known
 ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name or service not known
   at System.Net.Dns.InternalGetHostByName(String hostName)
   at System.Net.Dns.ResolveCallback(Object context)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)
   at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
   at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult)
   at System.Net.Sockets.Socket.DoDnsCallback(IAsyncResult result, MultipleAddressConnectAsyncResult context)
   at System.Net.Sockets.Socket.DnsCallback(IAsyncResult result)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.Sockets.Socket.<>c.<ConnectAsync>b__277_0(IAsyncResult iar)
--- End of stack trace from previous location where exception was thrown ---
   at MQTTnet.Implementations.MqttTcpChannel.ConnectAsync(CancellationToken cancellationToken)
   at MQTTnet.Internal.MqttTaskTimeout.WaitAsync(Func`2 action, TimeSpan timeout, CancellationToken cancellationToken)
   at MQTTnet.Adapter.MqttChannelAdapter.ConnectAsync(TimeSpan timeout, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at MQTTnet.Adapter.MqttChannelAdapter.WrapException(Exception exception)
   at MQTTnet.Adapter.MqttChannelAdapter.ConnectAsync(TimeSpan timeout, CancellationToken cancellationToken)
   at MQTTnet.Client.MqttClient.ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken)
   at MQTTnet.Client.MqttClient.ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken)
   at MQTTnet.Extensions.ManagedClient.ManagedMqttClient.ReconnectIfRequiredAsync()

Same issue here, and after clearing my cache, the config settings seem to be broken/missing
image

Same! Installed from HACS

Me too! Configuration is just at once completely empty, and I can not find a good example how it should look (i am running the hassio -?- add on). This is my log:

Starting Zigbee2MqttAssistant v0.3.157+Branch.master.Sha.ea388c3bbc2d43c4c9c62f27bb6764911ba4acc9...
warn: Zigbee2MqttAssistant.Services.SettingsService[0]
      Section 'settings' in configuration does not exists. Will use default settings instead.
Hosting environment: Production
Content root path: /app
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.
warn: Zigbee2MqttAssistant.Services.MqttConnectionService[0]
      Unable to connect to MQTT server mqtt.
MQTTnet.Exceptions.MqttCommunicationException: Name or service not known
 ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name or service not known
   at System.Net.Dns.InternalGetHostByName(String hostName)
   at System.Net.Dns.ResolveCallback(Object context)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)
   at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
   at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult)
   at System.Net.Sockets.Socket.DoDnsCallback(IAsyncResult result, MultipleAddressConnectAsyncResult context)
   at System.Net.Sockets.Socket.DnsCallback(IAsyncResult result)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(Exception source)
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.Sockets.Socket.<>c.<ConnectAsync>b__277_0(IAsyncResult iar)
--- End of stack trace from previous location where exception was thrown ---
   at MQTTnet.Implementations.MqttTcpChannel.ConnectAsync(CancellationToken cancellationToken)
   at MQTTnet.Internal.MqttTaskTimeout.WaitAsync(Func`2 action, TimeSpan timeout, CancellationToken cancellationToken)
   at MQTTnet.Adapter.MqttChannelAdapter.ConnectAsync(TimeSpan timeout, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at MQTTnet.Adapter.MqttChannelAdapter.WrapException(Exception exception)
   at MQTTnet.Adapter.MqttChannelAdapter.ConnectAsync(TimeSpan timeout, CancellationToken cancellationToken)
   at MQTTnet.Client.MqttClient.ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken)
   at MQTTnet.Client.MqttClient.ConnectAsync(IMqttClientOptions options, CancellationToken cancellationToken)
   at MQTTnet.Extensions.ManagedClient.ManagedMqttClient.ReconnectIfRequiredAsync()

if it helps some one:
i'm reinstalled addon
add this to configuration of addon and it works

settings:
mqttserver: ip adress of your mqtt server
mqttusername: your mqtt username
mqttpassword: your mqtt password

I was not able to save any configuration. After "save" it just disappears on refresh.
Uninstall and again install the addon seems to fix the issue.
Here is my example configuration after reinstalling the addon:

settings:
  mqttserver: addon_core_mosquitto
  mqttusername: 'username'
  mqttpassword: 'password'

That did the trick! Thanx!

Did not work for me :(

Reinstalling gave me this.

Removing the mqttport line and adding my username/password fixed it. It all loads again and my devices are now shown.

settings:
  mqttserver: addon_core_mosquitto
  mqttport: ''
  mqttusername: ''
  mqttpassword: ''
  mqttsecure: false
  basetopic: zigbee2mqtt
  homeassistantdiscoverybasetopic: homeassistant
  lowbatterythreshold: 30
  allowjointimeout: 20
  autosetlastseen: false
  devicespollingschedule: '*/12 * * * *'
  networkscanschedule: 0 */3 * * *