aht20

command module
v0.0.0-...-0841979 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

AHT20 Client

A small client utility for reading and resetting the AHT20 or AM2301B sensor.

Tested on a Raspberry PI with Go 1.22

Usage?

Basic usage information:

$ aht --help
usage: aht20 [<flags>] <command> [<args> ...]

Client for the AHT20

Commands:
  read   Reads from the sensor
  reset  Resets the sensor

Global Flags:
  --help   Show context-sensitive help
  --bus=1  i2c bus number to use
  --debug  Enable debug logging

Reading the device:

$ aht read
Temperature: 24.75C
Relative Humidity: 49.05%

It supports JSON output:

$ aht read --json
{
  "humidity": 49.737072,
  "raw_humidity": 521531,
  "raw_temperature": 391857,
  "temperature": 24.740791
}

And also the format required by Choria Metric watchers:

$ aht20  read --choria --label location:home
{
  "labels": {
    "location": "home"
  },
  "metrics": {
    "humidity": 49.845886,
    "humidity_raw": 522672,
    "temperature": 24.757957,
    "temperature_raw": 391947
  }
}

Contact?

R.I. Pienaar / rip@devco.net / devco.net

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL