PowerShell_Scripts/HomeAssistant/Start-HA_Addon.ps1

24 lines
727 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 start $a.slug
Get-HA_Addon -InspectContainer -NoPatternMatch -AddOnSlug $a.slug |
Select-Object @{
L='result';E={$invocation.result}
},@{
L='data';E={$invocation.data}
},*
}
}
}
end{}