Skip to content

peknur/ruuvitag

Repository files navigation

RuuviTag

RuuviTag BT Scanner collects data from all nearby RuuviTag devices.

Supports RuuviTag v3 (RAWv1) and v5 (RAWv2) formats.

Only tested in Linux environments

Usage

copied from example app

Open BT scanner

outputBufferSize := 10
scanner, err := ruuvitag.OpenScanner(outputBufferSize)
if err != nil {
    logger.Fatal(err)
}

Start scanner returns measurement output channel

output := scanner.Start()

Stopping scanner will stop BT scanning and closes output channel

scanner.Stop()

Read incoming RuuviTag measurements from channel

for {
    data, ok := <-output
    if ok == false {
        logger.Println("scanner closed channel")
        break
    }
    logger.Printf("%s[v%d] %.2f / %.2f %%", data.DeviceID(), data.Format(), data.Temperature(), data.Humidity())
}

Examples

See simple example from example folder or visit Ruuvibeacon project https://github.com/peknur/ruuvibeacon to see how I use this with Rasberry PI to collect data.