This commit is contained in:
Gal Szkolnik 2021-08-10 15:51:11 +00:00
commit 1b3a16806a
6 changed files with 26 additions and 9 deletions

View File

@ -1,6 +1,9 @@
if( $HAConfigPath ) { return $HAConfigPath }
@(
$(
@($HAConfigPath,'/srv/ha/current/homeassistant','/usr/share/hassio/homeassistant') | Where-Object { Test-Path -Type Container $_ } | Select-Object -First 1
), '/srv/ha/current/homeassistant'
) | Where-Object { $_ } | Select-Object -First 1 -OutVariable HAConfigPath
@($HAConfigPath,'/srv/ha/current/homeassistant','/usr/share/hassio/homeassistant') |
Where-Object { $_ } |
Where-Object { Test-Path -Type Container $_ } |
Select-Object -First 1
), $HAConfigPath, '/srv/ha/current/homeassistant'
) | Where-Object { $_ } |
Select-Object -First 1 -OutVariable HAConfigPath

View File

@ -18,12 +18,20 @@ $Count = [ordered]@{
})
}
# make sure the variable exist
if( -not (Test-Path variable:HAPreserveEntities) ) {
$HAPreserveEntities = [ordered]@{
Platforms = @( 'zha' )
Names = @()
}
}
$entities = $(Get-Content ./core.entity_registry | ConvertFrom-Json -Depth 10)
$Count.Entities.BeforeData = $entities.data.entities
$Count.Entities.Before = $entities.data.entities.count
$entities.data.entities = $entities.data.entities |
Where-Object {
( $_.platform -match 'zha' ) -or ($_.Original_name -in $HAPreserveEntities)
( $_.platform -match $HAPreserveEntities.Platforms ) -or ($_.Original_name -in $HAPreserveEntities.Names)
}
$Count.Entities.AfterData = $entities.data.entities

View File

@ -32,7 +32,7 @@ if( $MatchName ) {
}
if( $MatchAny ) {
$result = $result | Where-Object { $_ | Out-String | Where-Object { $_ -match $($MatchAny -join '|') } }
$result = $result | Where-Object { $_ | Format-Table -Wrap -HideTableHeaders | Out-String | Where-Object { $_ -match $($MatchAny -join '|') } }
}
if( $OrderBy ) {

View File

@ -15,8 +15,10 @@ if [[ "$SZ_SKIP_DEFAULT_SHELL" != "1" ]]; then
echo 'Starting PowerShell SZcripts...'
echo "pwsh" >> /tmp/default_shell
pwsh
if [[ ! -f /tmp/keep_shell_after_pwsh ]]; then
exit
fi
fi
fi
echo "continue" >> /tmp/default_shell
export SZ_SKIP_DEFAULT_SHELL=1

View File

@ -15,8 +15,10 @@ if [[ "$SZ_SKIP_DEFAULT_SHELL" != "1" ]]; then
echo 'Starting PowerShell SZcripts...'
echo "pwsh" >> /tmp/default_shell
pwsh
if [[ ! -f /tmp/keep_shell_after_pwsh ]]; then
exit
fi
fi
fi
echo "continue" >> /tmp/default_shell
export SZ_SKIP_DEFAULT_SHELL=1

View File

@ -15,9 +15,11 @@ if [[ "$SZ_SKIP_DEFAULT_SHELL" != "1" ]]; then
echo 'Starting PowerShell SZcripts...'
echo "pwsh" >> /tmp/default_shell
pwsh
if [[ ! -f /tmp/keep_shell_after_pwsh ]]; then
exit
fi
fi
fi
echo "continue" >> /tmp/default_shell
export SZ_SKIP_DEFAULT_SHELL=1