hsakoh / switchbot-mqtt

SwitchBot MQTT Home Assistant add-on
MIT License
41 stars 1 forks source link

Start Async failed / MQTT Core Service has not started #15

Closed Londonlad95 closed 7 months ago

Londonlad95 commented 7 months ago

Hi All,

When trying to set this up, I entered my MQTT broker details that work in other things, such as zigbee2MQTT:

AutoConfig: false Host: mqtt://192.168.[redacted].[redacted] Port: "1883" (If I had it as 1883 then it shows as RED, so hence, I leave the "" around it) Id: [redacted] Pw: [redacted] Tls: false

I think it's something with the port number, but it is the correct port; I just don't get why its showing up as red and I get the following errors:

00:53:21 fail: SwitchBotMqttApp.Services.MqttCoreService[0] StartAsync failed. System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request). at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode() at System.Net.Http.Json.HttpClientJsonExtensions.GetFromJsonAsyncCore[T](Task`1 taskResponse, JsonSerializerOptions options, CancellationToken cancellationToken) at HomeAssistantAddOn.Mqtt.SupervisorApi.GetServicesMqtt() in C:\github\hsakoh\switchbot-mqtt\src\HomeAssistant\HomeAssistantAddOn.Mqtt\SupervisorApi.cs:line 16 at HomeAssistantAddOn.Mqtt.MqttService.StartAsync() in C:\github\hsakoh\switchbot-mqtt\src\HomeAssistant\HomeAssistantAddOn.Mqtt\MqttService.cs:line 46 at SwitchBotMqttApp.Services.MqttCoreService.StartAsync(CancellationToken cancellationToken) in C:\github\hsakoh\switchbot-mqtt\src\SwitchBotMqttApp\Services\MqttCoreService.cs:line 46 00:53:21 warn: SwitchBotMqttApp.Services.PollingService[0] MqttCoreService has not started

Any ideas as to what is wrong? Is it something I'm doing?

Edit: I'm using a standalone MQTT broker on a VM hosted on Proxmox.

hsakoh commented 7 months ago

Thank you for the feedback.

The error occurred when attempting to automatically read the configuration using the Supervisor API, resulting in a 400 BadRequest response and a failure to start the MqttCoreService.

The program was trying to read Mqtt.UseAutoConfig internally, but the addon configuration was actually under Mqtt.AutoConfig.

I have released v1.0.10, which has been modified to read Mqtt.AutoConfig. Please check and confirm the functionality on your end.

hsakoh commented 7 months ago

Additional information: Please enter the addon configuration as follows. (It is normal for the numerical values of the port numbers to be displayed in a reddish color.) image