Skip to content

Commit

Permalink
Merge pull request #29 from jimmyeao/dev
Browse files Browse the repository at this point in the history
Fixes for MQTT connectivity in #10
  • Loading branch information
jimmyeao authored Feb 20, 2024
2 parents d59fb39 + 3b286d2 commit 9279ec2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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

0 comments on commit 9279ec2

Please sign in to comment.