Skip to content

Commit

Permalink
minor tweaks for mqtt port
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyeao committed Dec 18, 2023
1 parent e90dcd5 commit 9c6ad7d
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,17 @@ public MainWindow()
#endregion Public Constructors

#region Public Methods
public static List<string> GetEntityNames()
{
// Example: return a list of entity names based on the sensors and switches
return new List<string>
{
"Teams Mute Switch",
"Teams Video Switch",
"Teams Hand Raised Sensor",
// Add more entities as per your application's functionality
};
}
//public static List<string> GetEntityNames()
//{
// // Example: return a list of entity names based on the sensors and switches
// return new List<string>
// {
// "Teams Mute Switch",
// "Teams Video Switch",
// "Teams Hand Raised Sensor",
// // Add more entities as per your application's functionality
// };
//}
public async Task InitializeConnections()
{
await InitializeMQTTConnection();
Expand Down Expand Up @@ -903,24 +903,24 @@ private async Task PublishConfigurations(MeetingUpdate meetingUpdate, AppSetting

}

private async Task PublishDiscoveryMessages()
{
var muteSwitchConfig = new
{
name = "Teams Mute",
unique_id = "TEAMS2HA_mute",
state_topic = "TEAMS2HA/TEAMS/mute",
command_topic = "TEAMS2HA/TEAMS/mute/set",
payload_on = "true",
payload_off = "false",
device = new { identifiers = new[] { "TEAMS2HA" }, name = "Teams Integration", manufacturer = "Your Company" }
};

string muteConfigTopic = "homeassistant/switch/TEAMS2HA/mute/config";
await mqttClientWrapper.PublishAsync(muteConfigTopic, JsonConvert.SerializeObject(muteSwitchConfig));

// Repeat for other entities like video
}
//private async Task PublishDiscoveryMessages()
//{
// var muteSwitchConfig = new
// {
// name = "Teams Mute",
// unique_id = "TEAMS2HA_mute",
// state_topic = "TEAMS2HA/TEAMS/mute",
// command_topic = "TEAMS2HA/TEAMS/mute/set",
// payload_on = "true",
// payload_off = "false",
// device = new { identifiers = new[] { "TEAMS2HA" }, name = "Teams Integration", manufacturer = "Your Company" }
// };

// string muteConfigTopic = "homeassistant/switch/TEAMS2HA/mute/config";
// await mqttClientWrapper.PublishAsync(muteConfigTopic, JsonConvert.SerializeObject(muteSwitchConfig));

// // Repeat for other entities like video
//}

private bool SaveSettings()
{
Expand Down Expand Up @@ -991,6 +991,8 @@ private async void SetupMqttSensors()

// Call PublishConfigurations with the dummy MeetingUpdate
await PublishConfigurations(dummyMeetingUpdate, _settings);


}

private async void TeamsClient_TeamsUpdateReceived(object sender, WebSocketClient.TeamsUpdateEventArgs e)
Expand Down

0 comments on commit 9c6ad7d

Please sign in to comment.