Hey there!
I have created a custom xml sensor which should have different "LimitMaxError" values depending on a condition. The sample below should illustrate what I am trying.
$hour = (get-date).Hour if($hour -lt 9){ $limit = 5 } else{ $limit = 15 } $xml += "<?xml version=""1.0"" encoding=""Windows-1252"" ?>" $xml += "<prtg>" $xml += "<result>" $xml += "<Channel>Hour</Channel>" $xml += "<Value>$hour</Value>" $xml += "<Unit>Custom</Unit>" $xml += "<CustomUnit>#</CustomUnit>" $xml += "<LimitMaxError>$limit</LimitMaxError>" $xml += "<LimitMode>1</LimitMode>" $xml += "</result>" $xml += "</prtg>" $xml
If $hour < 9, $limit = 5 and if $hour > 9, $limit = 15. When I run this script in PowerShell ISE the value of $limit is correctly changing dependig on the condition but when the sensor is created the value of <LimitMaxError> does not change. The Value $hour is updated correctly.
Is there any way to realize this or can't limits of a channel be updated during script runtime?
Thanks in advance Kind Regards
Add comment