Skip to content

Commit

Permalink
fixed ignore availability and round options not working for satellite…
Browse files Browse the repository at this point in the history
… service
  • Loading branch information
amadeo-alex committed Jun 26, 2024
1 parent be6a48c commit c3ef887
Show file tree
Hide file tree
Showing 6 changed files with 386 additions and 356 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ public static ConfiguredSensor ConvertToConfiguredSensor(this RpcConfiguredServe
EntityName = rpcConfiguredSensor.EntityName,
Name = rpcConfiguredSensor.Name,
AdvancedSettings = rpcConfiguredSensor.AdvancedSettings,
IgnoreAvailability = rpcConfiguredSensor.IgnoreAvailability,
ApplyRounding = rpcConfiguredSensor.ApplyRounding,
Round = rpcConfiguredSensor.RoundValue,
};

return configuredSensor;
Expand Down Expand Up @@ -152,6 +155,9 @@ public static RpcConfiguredServerSensor ConvertToRpcConfiguredSensor(this Config
Name = configuredSensor.Name ?? string.Empty,
EntityName = configuredSensor?.EntityName ?? string.Empty,
AdvancedSettings = configuredSensor?.AdvancedSettings ?? string.Empty,
IgnoreAvailability = configuredSensor?.IgnoreAvailability ?? false,
ApplyRounding = configuredSensor?.ApplyRounding ?? false,
RoundValue = configuredSensor?.Round ?? 0,
};

return configuredRpcSensor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ message RpcConfiguredServerSensor {
string name = 10;
string entityName = 11;
string advancedSettings = 12;
bool applyRounding = 13;
int32 roundValue = 14;
bool ignoreAvailability = 15;
}

message RpcConfiguredServerCommand {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ await Task.Run(delegate
break;
}

if (abstractSensor != null)
abstractSensor.IgnoreAvailability = sensor.IgnoreAvailability;

return abstractSensor;
}

Expand Down Expand Up @@ -231,6 +234,7 @@ internal static ConfiguredSensor ConvertAbstractSingleValueToConfigured(Abstract
Name = wmiSensor.Name,
Type = type,
UpdateInterval = wmiSensor.UpdateIntervalSeconds,
IgnoreAvailability = wmiSensor.IgnoreAvailability,
Scope = wmiSensor.Scope,
Query = wmiSensor.Query,
ApplyRounding = wmiSensor.ApplyRounding,
Expand All @@ -249,6 +253,7 @@ internal static ConfiguredSensor ConvertAbstractSingleValueToConfigured(Abstract
Name = namedWindowSensor.EntityName,
Type = type,
UpdateInterval = namedWindowSensor.UpdateIntervalSeconds,
IgnoreAvailability = namedWindowSensor.IgnoreAvailability,
WindowName = namedWindowSensor.WindowName,
AdvancedSettings = namedWindowSensor.AdvancedSettings
};
Expand All @@ -264,6 +269,7 @@ internal static ConfiguredSensor ConvertAbstractSingleValueToConfigured(Abstract
Name = performanceCounterSensor.EntityName,
Type = type,
UpdateInterval = performanceCounterSensor.UpdateIntervalSeconds,
IgnoreAvailability = performanceCounterSensor.IgnoreAvailability,
Category = performanceCounterSensor.CategoryName,
Counter = performanceCounterSensor.CounterName,
Instance = performanceCounterSensor.InstanceName,
Expand All @@ -283,6 +289,7 @@ internal static ConfiguredSensor ConvertAbstractSingleValueToConfigured(Abstract
Name = processActiveSensor.EntityName,
Type = type,
UpdateInterval = processActiveSensor.UpdateIntervalSeconds,
IgnoreAvailability = processActiveSensor.IgnoreAvailability,
Query = processActiveSensor.ProcessName,
AdvancedSettings = processActiveSensor.AdvancedSettings
};
Expand All @@ -298,6 +305,7 @@ internal static ConfiguredSensor ConvertAbstractSingleValueToConfigured(Abstract
Name = serviceStateSensor.EntityName,
Type = type,
UpdateInterval = serviceStateSensor.UpdateIntervalSeconds,
IgnoreAvailability = serviceStateSensor.IgnoreAvailability,
Query = serviceStateSensor.ServiceName,
AdvancedSettings = serviceStateSensor.AdvancedSettings
};
Expand All @@ -313,6 +321,7 @@ internal static ConfiguredSensor ConvertAbstractSingleValueToConfigured(Abstract
Name = powershellSensor.EntityName,
Type = type,
UpdateInterval = powershellSensor.UpdateIntervalSeconds,
IgnoreAvailability = powershellSensor.IgnoreAvailability,
Query = powershellSensor.Command,
ApplyRounding = powershellSensor.ApplyRounding,
Round = powershellSensor.Round,
Expand All @@ -330,6 +339,7 @@ internal static ConfiguredSensor ConvertAbstractSingleValueToConfigured(Abstract
Name = windowStateSensor.EntityName,
Type = type,
UpdateInterval = windowStateSensor.UpdateIntervalSeconds,
IgnoreAvailability = windowStateSensor.IgnoreAvailability,
Query = windowStateSensor.ProcessName,
AdvancedSettings = windowStateSensor.AdvancedSettings
};
Expand All @@ -345,6 +355,7 @@ internal static ConfiguredSensor ConvertAbstractSingleValueToConfigured(Abstract
Name = sensor.EntityName,
Type = type,
UpdateInterval = sensor.UpdateIntervalSeconds,
IgnoreAvailability = sensor.IgnoreAvailability,
AdvancedSettings = sensor.AdvancedSettings
};
}
Expand Down
6 changes: 6 additions & 0 deletions src/HASS.Agent/HASS.Agent/Extensions/RpcExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public static ConfiguredSensor ConvertToConfiguredSensor(this RpcConfiguredServe
EntityName = rpcConfiguredSensor.EntityName,
Name = rpcConfiguredSensor.Name,
AdvancedSettings = rpcConfiguredSensor.AdvancedSettings,
IgnoreAvailability = rpcConfiguredSensor.IgnoreAvailability,
ApplyRounding = rpcConfiguredSensor.ApplyRounding,
Round = rpcConfiguredSensor.RoundValue,
};

return configuredSensor;
Expand Down Expand Up @@ -153,6 +156,9 @@ public static RpcConfiguredServerSensor ConvertToRpcConfiguredSensor(this Config
Name = configuredSensor.Name ?? string.Empty,
EntityName = configuredSensor.EntityName ?? string.Empty,
AdvancedSettings = configuredSensor?.AdvancedSettings ?? string.Empty,
IgnoreAvailability = configuredSensor?.IgnoreAvailability ?? false,
ApplyRounding = configuredSensor?.ApplyRounding ?? false,
RoundValue = configuredSensor?.Round ?? 0,
};

return configuredRpcSensor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ message RpcConfiguredServerSensor {
string name = 10;
string entityName = 11;
string advancedSettings = 12;
bool applyRounding = 13;
int32 roundValue = 14;
bool ignoreAvailability = 15;
}

message RpcConfiguredServerCommand {
Expand Down
Loading

0 comments on commit c3ef887

Please sign in to comment.