Skip to content

Commit

Permalink
2022.11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
LAB02 Research committed Apr 23, 2022
1 parent 76f8813 commit 6ff107c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/HASS.Agent/Commands/CommandsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ internal static async Task<bool> StoreAsync(List<ConfiguredCommand> commands, Li

// existing, update and re-register
var currentCommandIndex = Variables.Commands.FindIndex(x => x.Id == abstractCommand.Id);
if (Variables.Commands[currentCommandIndex].Name != abstractCommand.Name)
if (Variables.Commands[currentCommandIndex].Name != abstractCommand.Name || Variables.Commands[currentCommandIndex].EntityType != abstractCommand.EntityType)
{
// name changed, unregister and resubscribe on new mqtt channel
Log.Information("[COMMANDS] Command changed name, re-registering as new entity: {old} to {new}", Variables.Commands[currentCommandIndex].Name, abstractCommand.Name);
// command changed, unregister and resubscribe on new mqtt channel
Log.Information("[COMMANDS] Command changed, re-registering as new entity: {old} to {new}", Variables.Commands[currentCommandIndex].Name, abstractCommand.Name);

await Variables.Commands[currentCommandIndex].UnPublishAutoDiscoveryConfigAsync();
await Variables.MqttManager.UnubscribeAsync(Variables.Commands[currentCommandIndex]);
Expand Down

0 comments on commit 6ff107c

Please sign in to comment.