Date Voltage
---- -------
4/29/2022 9:49:47 AM 119.5
4/29/2022 10:10:20 AM 123.6
4/29/2022 10:10:26 AM 120.7
4/29/2022 11:10:49 AM 113.9
4/29/2022 11:10:55 AM 119.5
4/29/2022 11:33:18 AM 121.5
4/29/2022 11:40:18 AM 119.3
Last active
April 29, 2022 21:47
-
-
Save quonic/0805ccfb7e03bde06b71f43e2bcdfec6 to your computer and use it in GitHub Desktop.
Get Input Voltage measurements from IPP's database for a single Eaton 5P UPS.
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
Import-Module SimplySql | |
# To allow acces from any user | |
# Remove Users deny permissons from C:\Program Files (x86)\Eaton\IntelligentPowerProtector\db\mc2.db | |
$ConfigFolderPath = "C:\Program Files (x86)\Eaton\IntelligentPowerProtector\db" | |
$ConfigPath = "$ConfigFolderPath\mc2.db" | |
$TempPath = "$env:TEMP\mc2_tmp.db" | |
Copy-Item -Path $ConfigPath -Destination $TempPath -Force | |
Open-SQLiteConnection -DataSource $TempPath -ConnectionName "eaton" | |
$Query = @" | |
SELECT | |
m.date,d.name,m.value | |
FROM | |
measures m | |
INNER JOIN | |
dictionnary d | |
ON | |
d.ID=m.objectID | |
WHERE | |
d.ID=9; | |
"@ | |
Invoke-SqlQuery -Query $Query -ConnectionName "eaton" | ForEach-Object { | |
[PSCustomObject]@{ | |
Date = [DateTime]::new(0).AddMilliseconds($($_.date)).AddYears(1969).ToLocalTime() | |
Voltage = $_.value | |
} | |
} | |
Close-SqlConnection -ConnectionName "eaton" | |
Remove-Item $TempPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment