Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for MQTT connectivity in #10 #29

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions TEAMS2HA.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<AssemblyVersion>1.1.0.280</AssemblyVersion>
<FileVersion>1.1.0.280</FileVersion>
<AssemblyVersion>1.1.0.282</AssemblyVersion>
<FileVersion>1.1.0.282</FileVersion>
<ApplicationIcon>Assets\Square150x150Logo.scale-200.ico</ApplicationIcon>
<Title>Teams2HA</Title>
<PackageIcon>Square150x150Logo.scale-200.png</PackageIcon>
Expand Down