Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthMethod ¶
type AuthMethod string
const ( AuthPassword AuthMethod = "password" AuthKey AuthMethod = "key" )
type Config ¶
type Config struct {
Name string `yaml:"device-name" validate:"required"`
Mode string `yaml:"mode" validate:"omitempty,oneof=ssh local"`
Url string `yaml:"url"`
Port string `yaml:"port" validate:"omitempty,numeric"`
Username string `yaml:"username"`
AuthMethod AuthMethod `yaml:"auth-method" validate:"omitempty,oneof=password key"`
Password string `yaml:"password"`
SSHKeyPath string `yaml:"ssh-key-path"`
SSHKnownHosts string `yaml:"ssh-known-hosts"`
PoolSize int `yaml:"pool-size" validate:"min=1,max=10"`
MaxRetries int `yaml:"max-retries" validate:"min=0,max=10"`
RetryDelay int `yaml:"retry-delay" validate:"min=0"`
}
type Device ¶
type Device interface {
Start() error
Stop() error
Read(pin int) (int, error)
Write(pin int, value int) error
Watch(pin int) (<-chan PinEvent, error)
StopWatch(pin int)
SetDutyCycle(pin int, duty float64) error
GetDutyCycle(pin int) (float64, error)
StopPWM(pin int) error
I2CProbe(bus int, address string) error
I2CWrite(bus int, address string, data []byte) error
I2CRead(bus int, address string, length int) ([]byte, error)
I2CWriteRegister(bus int, address string, register byte, data []byte) error
I2CReadRegister(bus int, address string, register byte, length int) ([]byte, error)
ReadSensor(id string) (map[string]any, error)
ReadSensors() (map[string]map[string]any, error)
Health() HealthStatus
Metrics() DeviceMetrics
Info() DeviceInfo
SystemMetrics() (SystemMetrics, error)
}
type DeviceConfig ¶
type DeviceConfig struct {
Config Config `yaml:"config" validate:"required"`
Chip *Chip `yaml:"chip"`
MQTT *MQTT `yaml:"mqtt"`
}
func (*DeviceConfig) Validate ¶
func (c *DeviceConfig) Validate() error
type DeviceInfo ¶ added in v1.1.3
type DeviceMetrics ¶
type Digital ¶
type Digital struct {
Pin int `yaml:"pin" validate:"required,gt=0,lt=54"`
PinDefault `yaml:",inline"`
}
type HealthStatus ¶
type MQTT ¶
type MQTT struct {
Broker string `yaml:"broker" validate:"required"`
ClientID string `yaml:"client-id" validate:"required"`
Topic string `yaml:"topic" validate:"required"`
Username string `yaml:"username"`
Password string `yaml:"password"`
UseTLS bool `yaml:"use-tls"`
CertFile string `yaml:"cert-file"`
KeyFile string `yaml:"key-file"`
CAFile string `yaml:"ca-file"`
QOS byte `yaml:"qos"`
}
type PinDefault ¶
type SystemMetrics ¶ added in v1.1.3
Click to show internal directories.
Click to hide internal directories.