2020-12-29 15:14:21 +01:00
|
|
|
<#
|
2021-07-13 21:10:02 +02:00
|
|
|
.SYNOPSIS
|
|
|
|
simulate-presence.ps1 [<IP-address>]
|
|
|
|
.DESCRIPTION
|
|
|
|
Simulates the human presence against burglars
|
|
|
|
.EXAMPLE
|
|
|
|
PS> .\simulate-presence.ps1 192.168.100.100
|
|
|
|
.LINK
|
|
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
.NOTES
|
2021-08-03 15:53:57 +02:00
|
|
|
Author: Markus Fleschutz
|
|
|
|
License: CC0
|
2020-12-29 15:14:21 +01:00
|
|
|
#>
|
2020-11-30 16:28:56 +01:00
|
|
|
|
2021-07-15 15:51:22 +02:00
|
|
|
param([string]$IPaddress = "")
|
2021-02-18 20:17:55 +01:00
|
|
|
|
2021-02-16 17:40:35 +01:00
|
|
|
try {
|
2021-07-15 15:51:22 +02:00
|
|
|
if ($IPaddress -eq "" ) { $IPaddress = read-host "Enter IP address of Shelly1 device" }
|
|
|
|
|
2021-02-16 17:40:35 +01:00
|
|
|
for ([int]$i = 0; $i -lt 1000; $i++) {
|
2021-04-07 14:45:10 +02:00
|
|
|
& "$PSScriptRoot/switch-shelly1.ps1" $IPaddress on 0
|
2021-02-16 17:40:35 +01:00
|
|
|
start-sleep -s 10
|
2021-04-07 14:45:10 +02:00
|
|
|
& "$PSScriptRoot/switch-shelly1.ps1" $IPaddress off 0
|
2021-02-16 17:40:35 +01:00
|
|
|
start-sleep -s 60
|
|
|
|
}
|
|
|
|
write-host -foregroundColor green "Done."
|
|
|
|
exit 0
|
|
|
|
} catch {
|
2021-05-02 21:30:48 +02:00
|
|
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2021-02-16 17:40:35 +01:00
|
|
|
exit 1
|
2020-11-30 16:28:56 +01:00
|
|
|
}
|