mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-09 01:25:04 +01:00
Improved simulate-presence.ps1
This commit is contained in:
parent
55dcaec249
commit
14453b14b6
@ -6,12 +6,21 @@
|
||||
.NOTES Author: Markus Fleschutz / License: CC0
|
||||
#>
|
||||
|
||||
param([string]IPaddress)
|
||||
param(IPaddress = "")
|
||||
|
||||
for ([int]$i = 0; $i -lt 1000; $i++) {
|
||||
./switch-shelly1 $IPaddress on 0
|
||||
sleep 60
|
||||
./switch-shelly1 $IPaddress off 0
|
||||
sleep 10
|
||||
try {
|
||||
if ($IPaddress -eq "" ) {
|
||||
$IPaddress = read-host "Enter IP address of Shelly1 device"
|
||||
}
|
||||
for ([int]$i = 0; $i -lt 1000; $i++) {
|
||||
& ./switch-shelly1.ps1 $IPaddress on 0
|
||||
start-sleep -s 10
|
||||
& ./switch-shelly1.ps1 $IPaddress off 0
|
||||
start-sleep -s 60
|
||||
}
|
||||
write-host -foregroundColor green "Done."
|
||||
exit 0
|
||||
} catch {
|
||||
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
exit 1
|
||||
}
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user