We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 55dcaec commit 14453b1Copy full SHA for 14453b1
1 file changed
Scripts/simulate-presence.ps1
@@ -6,12 +6,21 @@
6
.NOTES Author: Markus Fleschutz / License: CC0
7
#>
8
9
-param([string]IPaddress)
+param(IPaddress = "")
10
11
-for ([int]$i = 0; $i -lt 1000; $i++) {
12
- ./switch-shelly1 $IPaddress on 0
13
- sleep 60
14
- ./switch-shelly1 $IPaddress off 0
15
- sleep 10
+try {
+ if ($IPaddress -eq "" ) {
+ $IPaddress = read-host "Enter IP address of Shelly1 device"
+ }
+ for ([int]$i = 0; $i -lt 1000; $i++) {
16
+ & ./switch-shelly1.ps1 $IPaddress on 0
17
+ start-sleep -s 10
18
+ & ./switch-shelly1.ps1 $IPaddress off 0
19
+ start-sleep -s 60
20
21
+ write-host -foregroundColor green "Done."
22
+ exit 0
23
+} catch {
24
+ write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
25
+ exit 1
26
}
-exit 0
0 commit comments