mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-21 17:38:19 +02:00
Improved simulate-presence.ps1
This commit is contained in:
parent
55dcaec249
commit
14453b14b6
@ -6,12 +6,21 @@
|
|||||||
.NOTES Author: Markus Fleschutz / License: CC0
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([string]IPaddress)
|
param(IPaddress = "")
|
||||||
|
|
||||||
for ([int]$i = 0; $i -lt 1000; $i++) {
|
try {
|
||||||
./switch-shelly1 $IPaddress on 0
|
if ($IPaddress -eq "" ) {
|
||||||
sleep 60
|
$IPaddress = read-host "Enter IP address of Shelly1 device"
|
||||||
./switch-shelly1 $IPaddress off 0
|
}
|
||||||
sleep 10
|
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