diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 9870fa4..bb3ba8d 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -464,6 +464,7 @@ private async void ReestablishConnections()
if (!mqttClientWrapper.IsConnected)
{
await mqttClientWrapper.ConnectAsync();
+ await mqttClientWrapper.SubscribeAsync("homeassistant/switch/+/set", MqttQualityOfServiceLevel.AtLeastOnce);
SetupMqttSensors();
}
if (!_teamsClient.IsConnected)
@@ -588,6 +589,7 @@ private async void CheckMqttConnection()
{
Log.Debug("CheckMqttConnection: MQTT Client Not Connected. Attempting reconnection.");
await mqttClientWrapper.ConnectAsync();
+ await mqttClientWrapper.SubscribeAsync("homeassistant/switch/+/set", MqttQualityOfServiceLevel.AtLeastOnce);
UpdateConnectionStatus();
}
}
@@ -1076,6 +1078,7 @@ private async void TestMQTTConnection_Click(object sender, RoutedEventArgs e)
}
UpdateStatusMenuItems();
Log.Debug("TestMQTTConnection_Click: MQTT Client Connected in TestMQTTConnection_Click");
+ await mqttClientWrapper.SubscribeAsync("homeassistant/switch/+/set", MqttQualityOfServiceLevel.AtLeastOnce);
return; // Exit the method if connected
}
catch (Exception ex)
diff --git a/TEAMS2HA.csproj b/TEAMS2HA.csproj
index 5459bd0..ea5f5c3 100644
--- a/TEAMS2HA.csproj
+++ b/TEAMS2HA.csproj
@@ -5,8 +5,8 @@