yllibed / Zigbee2MqttAssistant

GUI for Zigbee2Mqtt running in docker and HASS.IO
449 stars 42 forks source link

Support mqtt:// server syntax #20

Closed pedrogense closed 5 years ago

pedrogense commented 5 years ago

Hello there,

What am i doing wrong, it says it cannot connect with my mqtt server. This is log file,

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://core-mosquitto. MQTTnet.Exceptions.MqttCommunicationException: No such device or address ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: No such device or address 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.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.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.Sockets.Socket.<>c.b__274_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()

This is my config:,

{ "settings": { "basetopic": "zigbee2mqtt", "HomeAssistantDiscoveryBaseTopic": "homeassistant", "MqttSecure": "false", "Mqttserver": "mqtt://core-mosquitto", "MqttPort": "1883", "Mqttusername": "mqtt user", "Mqttpassword": "mqtt password", "LowBatteryThreshold": "20" } }

carldebilly commented 5 years ago

The setting Mqttserver is not designed to receive an url-like connection string.

Use that instead:

"Mqttserver": "core-mosquitto",
timdonovanuk commented 4 years ago

Could it be changed to..though? :) Literally every other hass.io plugin functions this way, in fact many of the mqtt related ones default the server address to mqtt://core-mosquitto..

carldebilly commented 4 years ago

It could.