BSG-001 manual passed failed not run e2e core

31 passed 0 failed 0 not run 16 e2e 15 core

Downloading the records

A BSG-001 that is logging keeps a record of the dose rate at regular intervals. bsg-001 records downloads the records the device holds and prints them, oldest first, leaving out the first one.

Downloading from a device

First discover the device, then pass its address to bsg-001 records with --address. The address can also be set once for all commands, as explained in choosing the device.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes4

The device holds these records:

dose rate
4.35
0.05
0.00
0.10

Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF
2026-01-02 03:24:05 UTC	0.05 µSv/h
2026-01-02 03:34:05 UTC	0.00 µSv/h
2026-01-02 03:44:05 UTC	0.10 µSv/h

What each line means

Each line is one record: the time it was recorded, a tab, and its dose rate in microsieverts per hour.

The first record of a run is left out, which is why the first line comes two intervals after the start of the run. The sensor keeps counting while the device is stopped, and the first record holds everything it counted since the previous run ended. In the example above it would have shown 4.35 µSv/h for what was ordinary background.

The start of the run and the record interval are those shown by bsg-001 logging.

Saving the records as CSV

With --format csv the records are printed as comma-separated values, ready for a spreadsheet or a script. The first line names the columns.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes4

The device holds these records:

dose rate
4.35
0.05
0.00
0.10

Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF --format csv
recorded_at,minutes_from_start,dose_rate_usv_h
2026-01-02T03:24:05Z,20,0.05
2026-01-02T03:34:05Z,30,0.00
2026-01-02T03:44:05Z,40,0.10

The format can also be chosen with the environment variable BSG_001_FORMAT, and --format wins over the variable. Without either, the format is text, the one shown at the top of this page.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes2

The device holds these records:

dose rate
4.35
0.05

Here is the terminal session:

$ BSG_001_FORMAT=csv bsg-001 records --address AA:BB:CC:DD:EE:FF
recorded_at,minutes_from_start,dose_rate_usv_h
2026-01-02T03:24:05Z,20,0.05

Following a long download

A full device holds 1440 records, which take a while to arrive. The tool shows a progress bar while it downloads, and removes it once it is done. The bar is drawn on standard error, and only when standard error is a terminal. It is never part of the result: with bsg-001 records > records.csv the bar still shows in the terminal, and the file holds only the records.

The device sends its records ten at a time, so the progress moves in steps of ten records.

While it downloads the number of records shown, the tool reports the progress shown.

recordsprogress
2510 of 25, 20 of 25, 25 of 25
1010 of 10
33 of 3
0none

Good to know

Edge cases

A device that holds no record

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes0

Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF
No records.

Nothing is printed on standard output.

A device that holds only its first record

The first record is left out, so there is nothing to show until the second one is written.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes1

The device holds these records:

dose rate
4.35

Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF
No records.

Nothing is printed on standard output.

Of the records the device holds, the tool keeps those shown.

device holdstool keeps
4.35, 0.05, 0.00, 0.100.05, 0.00, 0.10
0.00, 0.050.05
4.35none
nonenone
CSV for a device that holds no record, or whose clock was not set

Without records, the CSV has only its first line.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes0

Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF --format csv
recorded_at,minutes_from_start,dose_rate_usv_h

Without a start time, the recorded_at column is left empty.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
1 dayunknown10 minutes3

The device holds these records:

dose rate
2.10
0.05
0.15

Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF --format csv
recorded_at,minutes_from_start,dose_rate_usv_h
,20,0.05
,30,0.15
A format that does not exist

A device at address "AA:BB:CC:DD:EE:FF" stores the name it is sent. Here is the terminal session:

$ BSG_001_FORMAT=xml bsg-001 records --address AA:BB:CC:DD:EE:FF
Error: The format must be text or csv, not xml.
A format variable that is empty

A variable that is set but empty counts as not set, so the format is text.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes2

The device holds these records:

dose rate
4.35
0.05

Here is the terminal session:

$ BSG_001_FORMAT= bsg-001 records --address AA:BB:CC:DD:EE:FF
2026-01-02 03:24:05 UTC	0.05 µSv/h
A device whose clock was not set

Without a start time the tool cannot tell when a record was written. It shows how long after the start of the run instead, in days, hours, minutes and seconds.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
1 dayunknown10 minutes3

The device holds these records:

dose rate
2.10
0.05
0.15

Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF
0 d 00:20:00	0.05 µSv/h
0 d 00:30:00	0.15 µSv/h
Hourly records, and runs that cross midnight or the end of a month

A run longer than ten days records every sixty minutes.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
31 days2026-12-31 20:30:0060 minutes4

The device holds these records:

dose rate
0.95
0.03
0.07
0.00

Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF
2026-12-31 22:30:00 UTC	0.03 µSv/h
2026-12-31 23:30:00 UTC	0.07 µSv/h
2027-01-01 00:30:00 UTC	0.00 µSv/h

Given when the run started and its record interval, each record was recorded at the time shown. Record 1 is the first record, the one the tool leaves out.

run startedrecord intervalrecordrecorded at
2026-01-02 03:04:0510 minutes12026-01-02 03:14:05
2026-01-02 03:04:0510 minutes14402026-01-12 03:04:05
2026-02-28 23:55:0010 minutes12026-03-01 00:05:00
2028-02-28 23:55:0010 minutes12028-02-29 00:05:00
2026-12-01 00:00:0060 minutes14402027-01-30 00:00:00
unknown10 minutes10 d 00:10:00
unknown60 minutes144060 d 00:00:00
A record written during the download

The tool first asks how many records the device holds, then downloads them. A device that writes a record between the two steps sends one record more than it announced. The tool keeps the records that were announced and leaves the new one for the next download.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes3

The device holds these records:

dose rate
4.35
0.05
0.10

While the tool downloads the records for the first time, the device writes a record of "0.20". Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF
2026-01-02 03:24:05 UTC	0.05 µSv/h
2026-01-02 03:34:05 UTC	0.10 µSv/h
Records that do not match the checksum

The device tells a checksum of its records, and the tool checks what it downloaded against it. When they differ, for example because part of the download was lost, the tool asks again and downloads again. It tries three times, then reports the failure instead of printing records it cannot trust.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes2

The device holds these records:

dose rate
0.05
0.10

The device sends records that never match its checksum. Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF
Error: The records do not match the checksum of the device.
Records lost during the download

The device sends its records in packets, and a packet can be lost on the way. The tool waits for the missing records, then asks again and downloads again, as it does for records that do not match the checksum.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes3

The device holds these records:

dose rate
4.35
0.05
0.10

While the tool downloads the records for the first time, the last packet is lost. Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF
2026-01-02 03:24:05 UTC	0.05 µSv/h
2026-01-02 03:34:05 UTC	0.10 µSv/h

After three downloads that lose records, the tool reports the failure.

A device at address "AA:BB:CC:DD:EE:FF" reports this logging state:

logging durationrun startedrecord intervalrecords
10 days2026-01-02 03:04:0510 minutes2

The device holds these records:

dose rate
0.05
0.10

The last packet of every download is lost. Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF
Error: Timed out waiting for the records.
A reply the tool cannot read

A device at address "AA:BB:CC:DD:EE:FF" answers the logging state query with a reply that is too short. Here is the terminal session:

$ bsg-001 records --address AA:BB:CC:DD:EE:FF
Error: Invalid logging state reply.