Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ Scripts for remote logging data from ratgdo
* Usage: `./ratgdo-logger.sh <RATGDO HOSTNAME OR IP>`
* To capture to a file append the command with: ` > my.log`

## Windows PowerShell
* Usage: `.\ratgdo-logger.ps1 -HostName <RATGDO HOSTNAME OR IP>`
* To capture to a file append the command with: ` > my.log`

```
mbpm3:remote-logging paul$ ./ratgdo-logger.sh 10.0.1.191
**Example:**
```bash
$ ./ratgdo-logger.sh 10.0.1.191
Pinging 10.0.1.191...
✅ Host 10.0.1.191 is reachable.
Checking firmware type...
Expand All @@ -19,3 +16,8 @@ Checking firmware type...
2025-08-01T12:20:03Z data: [D][ratgdo:229]: Light state=OFF
2025-08-01T12:20:03Z data: [D][ratgdo:235]: Lock state=UNLOCKED
2025-08-01T12:20:03Z data: [D][ratgdo:214]: Learn state=INACTIVE
```

## Windows PowerShell
* Usage: `.\ratgdo-logger.ps1 -HostName <RATGDO HOSTNAME OR IP>`
* To capture to a file append the command with: ` > my.log`
8 changes: 4 additions & 4 deletions ratgdo-logger.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ Write-Host "---"

try {
$printNextLine = $false

curl.exe -s --no-buffer $Url | ForEach-Object {
if ($printNextLine) {
$timestamp = (Get-Date).ToUniversalTime().ToString("s") + "Z"

# --- THIS IS THE KEY CHANGE ---
# Changed Write-Host to Write-Output to enable file redirection.
Write-Output "$timestamp $_"

$printNextLine = $false
}
if ($_ -eq 'event: log') {
Expand All @@ -54,4 +54,4 @@ catch {
finally {
Write-Host "---"
Write-Host "Log capture stopped."
}
}
2 changes: 1 addition & 1 deletion ratgdo-logger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ curl -s --no-buffer $URL | while IFS= read -r line; do
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
echo "$timestamp $next_line_clean"
fi
done
done