mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-08-19 00:46:30 +02:00
Updated the manuals
This commit is contained in:
@@ -6,9 +6,9 @@ This PowerShell script switches a Shelly1 device in the local network.
|
||||
Parameters
|
||||
----------
|
||||
```powershell
|
||||
PS> ./switch-shelly1.ps1 [[-Host] <String>] [[-TurnMode] <String>] [[-Timer] <Int32>] [<CommonParameters>]
|
||||
/home/markus/Repos/PowerShell/scripts/switch-shelly1.ps1 [[-host] <String>] [[-turnMode] <String>] [[-timer] <Int32>] [<CommonParameters>]
|
||||
|
||||
-Host <String>
|
||||
-host <String>
|
||||
Specifies either the hostname or IP address of the Shelly1 device
|
||||
|
||||
Required? false
|
||||
@@ -17,7 +17,7 @@ PS> ./switch-shelly1.ps1 [[-Host] <String>] [[-TurnMode] <String>] [[-Timer] <In
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
-TurnMode <String>
|
||||
-turnMode <String>
|
||||
Specifies either 'on', 'off', or 'toggle'
|
||||
|
||||
Required? false
|
||||
@@ -26,7 +26,7 @@ PS> ./switch-shelly1.ps1 [[-Host] <String>] [[-TurnMode] <String>] [[-Timer] <In
|
||||
Accept pipeline input? false
|
||||
Accept wildcard characters? false
|
||||
|
||||
-Timer <Int32>
|
||||
-timer <Int32>
|
||||
Specifies the timer in seconds (0 = infinite)
|
||||
|
||||
Required? false
|
||||
@@ -63,11 +63,11 @@ Script Content
|
||||
Switches a Shelly1 device
|
||||
.DESCRIPTION
|
||||
This PowerShell script switches a Shelly1 device in the local network.
|
||||
.PARAMETER Host
|
||||
.PARAMETER host
|
||||
Specifies either the hostname or IP address of the Shelly1 device
|
||||
.PARAMETER TurnMode
|
||||
.PARAMETER turnMode
|
||||
Specifies either 'on', 'off', or 'toggle'
|
||||
.PARAMETER Timer
|
||||
.PARAMETER timer
|
||||
Specifies the timer in seconds (0 = infinite)
|
||||
.EXAMPLE
|
||||
PS> ./switch-shelly1 192.168.100.100 toggle 10
|
||||
@@ -77,16 +77,16 @@ Script Content
|
||||
Author: Markus Fleschutz | License: CC0
|
||||
#>
|
||||
|
||||
param([string]$Host = "", [string]$TurnMode = "", [int]$Timer = -999)
|
||||
param([string]$host = "", [string]$turnMode = "", [int]$timer = -999)
|
||||
|
||||
try {
|
||||
if ($Host -eq "") { $Host = read-host "Enter hostname or IP address of the Shelly1 device" }
|
||||
if ($TurnMode -eq "") { $TurnMode = read-host "Enter turn mode (on/off/toggle)" }
|
||||
if ($Timer -eq -999) { [int]$Timer = read-host "Enter timer in seconds (0=endless)" }
|
||||
if ($host -eq "") { $host = Read-Host "Enter the hostname or IP address of the Shelly1 device" }
|
||||
if ($turnMode -eq "") { $turnMode = Read-Host "Enter the turn mode (on/off/toggle)" }
|
||||
if ($timer -eq -999) { [int]$timer = Read-Host "Enter the timer in seconds (0=endless)" }
|
||||
|
||||
$Result = Invoke-RestMethod "http://$($Host)/relay/0?turn=$($TurnMode)&timer=$($Timer)"
|
||||
$result = Invoke-RestMethod "http://$($host)/relay/0?turn=$($turnMode)&timer=$($timer)"
|
||||
|
||||
"✔️ switched Shelly1 device at $Host to $TurnMode for $Timer sec"
|
||||
"✅ Switched Shelly1 device at $host to $turnMode for $timer sec."
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
@@ -94,4 +94,4 @@ try {
|
||||
}
|
||||
```
|
||||
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of switch-shelly1.ps1 as of 08/15/2024 09:50:54)*
|
||||
*(generated by convert-ps2md.ps1 using the comment-based help of switch-shelly1.ps1 as of 11/08/2024 12:34:55)*
|
||||
|
Reference in New Issue
Block a user