Added Home-Assistant package.
This commit is contained in:
parent
60825c92c8
commit
b410ec839d
|
@ -0,0 +1,47 @@
|
|||
Push-Location /srv/ha/current/homeassistant/.storage
|
||||
|
||||
$Count = [ordered]@{
|
||||
Devices=[PSCustomObject]([ordered]@{
|
||||
Before = -1
|
||||
After = -1
|
||||
Removed = -1
|
||||
})
|
||||
Entities=[PSCustomObject]([ordered]@{
|
||||
Before = -1
|
||||
After = -1
|
||||
Removed = -1
|
||||
})
|
||||
}
|
||||
$devices = $(Get-Content ./core.device_registry | ConvertFrom-Json -Depth 10)
|
||||
$Count.Devices.Before = $devices.data.devices.count
|
||||
$devices.data.devices = $devices.data.devices |
|
||||
# Where-Object identifiers -notmatch 'zwave'
|
||||
Where-Object {$_.identifiers[0] -eq 'zha'}
|
||||
$entities = $(Get-Content ./core.entity_registry | ConvertFrom-Json -Depth 10)
|
||||
$Count.Entities.Before = $entities.data.entities.count
|
||||
$entities.data.entities = $entities.data.entities |
|
||||
Where-Object platform -match 'zha'
|
||||
# Where-Object platform -notmatch zwave |
|
||||
# Where-Object { -not (
|
||||
# $_.platform -match 'switch' -and $_.entity_id -match 'light\.' -and -not $_.config_entry_id
|
||||
# ) }
|
||||
|
||||
$Count.Devices.After = $devices.data.devices.count
|
||||
$Count.Entities.After = $entities.data.entities.count
|
||||
$Count.Devices.Removed = $Count.Devices.Before - $Count.Devices.After
|
||||
$Count.Entities.Removed = $Count.Entities.Before - $Count.Entities.After
|
||||
|
||||
$Count | Format-Table
|
||||
|
||||
$devices | ConvertTo-Json -Depth 10 > /tmp/new.core.device_registry
|
||||
$entities | ConvertTo-Json -Depth 10 > /tmp/new.core.entity_registry
|
||||
|
||||
ha core stop
|
||||
sudo mv ./core.entity_registry ./core.entity_registry.old
|
||||
sudo mv ./core.device_registry ./core.device_registry.old
|
||||
sudo cp /tmp/new.core.entity_registry ./core.entity_registry
|
||||
sudo cp /tmp/new.core.device_registry ./core.device_registry
|
||||
Pop-Location
|
||||
|
||||
|
||||
ha core start
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"package": {
|
||||
"Condition": [
|
||||
{
|
||||
"custom": null,
|
||||
"System": null,
|
||||
"Hostname": null,
|
||||
"Username": null,
|
||||
"CmdletExists": null,
|
||||
"AppExeExists": [
|
||||
"ha",
|
||||
"docker"
|
||||
],
|
||||
"Logic": 0
|
||||
}
|
||||
],
|
||||
"Name": "HomeAssistant"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
if( $args ) { docker exec homeassistant hass $args }
|
||||
else { docker exec homeassistant hass --help }
|
Loading…
Reference in New Issue