Skip to content

rcy/gopiss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gopiss

Get the current urine tank level on the International Space Station.

Connects to NASA's public ISSLIVE telemetry stream via Lightstreamer and returns the latest reading from NODE3000005 — the urine tank sensor.

Install

go get github.com/rcy/gopiss@latest

Usage

Get a single reading

package main

import (
    "fmt"

    "github.com/rcy/gopiss"
)

func main() {
    level, err := gopiss.GetISSUrineTankLevel()
    if err != nil {
        panic(err)
    }
    fmt.Printf("ISS urine tank level: %.1f%%\n", level)
}

Watch for changes

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/rcy/gopiss"
)

func main() {
    ctx := context.Background()
    ch, err := gopiss.WatchISSUrineTankLevel(ctx)
    if err != nil {
        log.Fatal(err)
    }

    for level := range ch {
        fmt.Printf("ISS urine tank level: %.1f%%\n", level)
    }
}

API

func GetISSUrineTankLevel() (float64, error)

Returns the urine tank fill percentage from the latest telemetry snapshot. Connects, reads one value, and closes the connection.

func WatchISSUrineTankLevel(ctx context.Context) (<-chan float64, error)

Returns a channel that receives the tank level whenever it changes. The connection stays open and the background goroutine exits when ctx is cancelled.

Both functions require internet access (connect to push.lightstreamer.com via WebSocket). No authentication needed.

About

🟨🛢️🛰️ Get the current urine tank level on the International Space Station in Go.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages