yllibed / Zigbee2MqttAssistant

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

[BUG] #357

Open MileBuurmeijer opened 3 years ago

MileBuurmeijer commented 3 years ago

Describe the bug

The UI is a really good addition to the excellent Zigbee2Mqtt. The only issue I found is this. The docker run command line shown in readme fails when MQTT password contains special characters like !#@.

To Reproduce

Steps to reproduce the behavior:

  1. docker run -p 8880:80 -e "Z2MA_SETTINGSMQTTSERVER=192.168.1.12" -e "Z2MA_SETTINGS__MQTTUSERNAME=user1" -e "Z2MA_SETTINGSMQTTPASSWORD=!@#$pwd" --restart unless-stopped carldebilly/zigbee2mqttassistant

Expected behavior It was expected that the container would start Z2MA and connect to the MQTT broker

Steps I took to try resolve the problem

I succeeded by going into the Z2MA docker container and configure appconfiguration.json to reflect the right MQTT password. Then the container would run OK.

Installation

Pertinent logs

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., Hosting environment: Production, Content root path: /app, Now listening on: http://[::]:80, Application started. Press Ctrl+C to shut down., Application is shutting down..., 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., Hosting environment: Production, Content root path: /app, Now listening on: http://[::]:80, Application started. Press Ctrl+C to shut down., fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1], An unhandled exception has occurred while executing the request., System.InvalidOperationException: Another remove in progress for this device., at Zigbee2MqttAssistant.Services.MqttConnectionService.RemoveDeviceAndWait(String deviceFriendlyName, Boolean forceRemove) in d:\a\1\s\Zigbee2MqttAssistant\Services\MqttConnectionService.cs:line 744, at Zigbee2MqttAssistant.Services.BrigeOperationService.RemoveDeviceById(String deviceId, Boolean forceRemove) in d:\a\1\s\Zigbee2MqttAssistant\Services\BrigeOperationService.cs:line 27, at Zigbee2MqttAssistant.Controllers.HomeController.RemoveDevice(String id, Boolean forceRemove) in d:\a\1\s\Zigbee2MqttAssistant\Controllers\HomeController.cs:line 110, at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments), at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask), at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted), at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context), at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted), at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync(), --- End of stack trace from previous location where exception was thrown ---, at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted), at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context), at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted), at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync(), --- End of stack trace from previous location where exception was thrown ---, at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope), at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger), at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.gAwaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task), Application is shutting down..., warn: Zigbee2MqttAssistant.Services.MqttConnectionService[0], Disconnected from MQTT server 192.168.68.64., System.Threading.Tasks.TaskCanceledException: A task was canceled., at MQTTnet.Client.MqttClient.TrySendKeepAliveMessagesAsync(CancellationToken cancellationToken),

==> after applying the work around the logs shows this and app works excellent 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., Hosting environment: Production, Content root path: /app, Now listening on: http://[::]:80, Application started. Press Ctrl+C to shut down.,

gelse commented 3 years ago

this is not a bug but a restriction of docker. did you even google that one ? https://superuser.com/questions/775173/how-to-escape-and-in-dockers-environment-varibles