PowerShell_Scripts/HomeAssistant/Stop-HA_Addon.ps1

24 lines
726 B
PowerShell

[CmdletBinding(SupportsShouldProcess)]param(
[Parameter(ValueFromPipeline,ValueFromPipelineByPropertyName)]
[Alias('Slug')]
[string[]]$AddOnSlug,
[switch]$NoPatternMatch
)
begin{}
process{
foreach( $slug in $AddOnSlug ) {
Get-HA_Addon 'Running' -AddOnSlug:$slug -NoPatternMatch:$NoPatternMatch | ForEach-Object {
$local:a = $_
$local:invocation = Invoke-HomeAssistantCli addons stop $a.slug
Get-HA_Addon -InspectContainer -NoPatternMatch -AddOnSlug $a.slug |
Select-Object @{
L='result';E={$invocation.result}
},@{
L='data';E={$invocation.data}
},*
}
}
}
end{}