Last active
January 18, 2021 20:54
-
-
Save AdamNaj/5553b3d48d4e9ec8958f38be926d0617 to your computer and use it in GitHub Desktop.
How to check if Z-Wave node is Secure or Plus version based on QZW Config file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Combine the functionality of Find-ChattyZwaveDevices and Get-ZwaveNodeSecureOrPlus | |
# Executing this script can take a few minutes debending on the speed of the network and the size of your OZW log. | |
# Path to your Home Assistant shared folder - mapped drive on your windows machine | |
$haPath = "I:" | |
# Get the content of the Open Z-Wave cache file | |
Write-Progress -Activity "Reading Configuration" | |
[xml]$ozwCfg = Get-Content "$haPath\zwcfg_*.xml" | |
# Get valid zwave IDs | |
$validIds = $ozwCfg.Driver.Node | %{ $_.id } | |
# Append Root node devices to the id list | |
$validIds += $validIds | %{ "node-$($_)"} | |
# Read entity registry | |
$entReg = Get-Content "$haPath\.storage\core.entity_registry" | ConvertFrom-Json | |
# Display entities to be deleted | |
$entReg.data.entities | | |
? { $_.platform -eq "zwave" } | | |
? { !$validIds.Contains(($_.unique_id -split "-")[0]) -and !$validIds.Contains($_.unique_id)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path to your Home Assistant shared folder - mapped drive on your windows machine | |
$haPath = "I:" | |
# Get the content of the Open Z-Wave log file | |
[string[]]$ozwCfg = Get-Content "$haPath\OZW_Log.txt" | |
#find received messqages, filter and order by number of messages | |
$ozwCfg | ?{ $_ -match "Detail, Node(\d\d\d), Received"} | | |
% { $matches[0] } | | |
? { $_ -match "(\d\d\d)" } | | |
% { $matches[0] } | | |
Group-Object| | |
Sort-Object Count -descending | | |
Format-Table Name, Count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Path to your Home Assistant shared folder - mapped drive on your windows machine | |
$haPath = "I:" | |
# Get the content of the Open Z-Wave cache file | |
[xml]$ozwCfg = Get-Content "$haPath\zwcfg_*.xml" | |
# Analyze and print | |
$ozwCfg.Driver.Node | | |
ft id, | |
Name, | |
secured, | |
@{Name="Is Z-Wave Plus";Expression={ (($_.CommandClasses.CommandClass.name) | ?{ $_ -eq "COMMAND_CLASS_ZWAVEPLUS_INFO"} | %{"yes"}) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Combine the functionality of Find-ChattyZwaveDevices and Get-ZwaveNodeSecureOrPlus | |
# Executing this script can take a few minutes debending on the speed of the network and the size of your OZW log. | |
# Path to your Home Assistant shared folder - mapped drive on your windows machine | |
$haPath = "I:" | |
# Get the content of the Open Z-Wave cache file | |
Write-Progress -Activity "Reading Configuration" | |
[xml]$ozwCfg = Get-Content "$haPath\zwcfg_*.xml" | |
# Get the content of the Open Z-Wave log file | |
Write-Progress -Activity "Reading log" | |
[string[]]$ozwLog = Get-Content "$haPath\OZW_Log.txt" | |
# Analyze the log - for received messages fron devices | |
Write-Progress -Activity "Analyzing" | |
$messageCounts = $ozwLog | ?{ $_ -match "Detail, Node(\d\d\d), Received"} | # select -first 1000 | | |
% { $matches[0] } | | |
? { $_ -match "(\d\d\d)" } | | |
% { $matches[0] } | | |
Group-Object | | |
Sort-Object Count -descending | | |
Select @{Name = "id"; Expression={[int] $Name = $_.Name; $name}}, Count | |
# Analyze the config file to find out the device security and Plus support and attach the messages received | |
# + display in a nice window with ability to sort by different criteria. | |
Write-Progress -Activity "Displaying input" | |
$ozwCfg.Driver.Node | | |
select id, | |
Name, | |
@{Name="Messages"; Expression={ [int]$id = $_.id; ($messageCounts | ? { $_.id -eq $id}).Count }}, | |
@{Name="Secured"; Expression={ if($_.secured -eq "true") {$true}}}, | |
@{Name="Z-Wave Plus"; Expression={ (($_.CommandClasses.CommandClass.name) | ?{ $_ -eq "COMMAND_CLASS_ZWAVEPLUS_INFO"} | %{$true}) }}, | |
@{Name="Manufacturer"; Expression={$_.Manufacturer.name}}, | |
@{Name="Model"; Expression={$_.Manufacturer.Product.name}} | | |
Out-GridView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have modified the mapped drive and tested these scripts both as admin and as a normal user. Nothing ever outputs. PS just returns to a command prompt. Am I missing something?
Please ignore. It provided an output finally. I just needed to be patient.