config

package
v0.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version string

Functions

func GenerateTokenHash

func GenerateTokenHash(token string) (string, error)

func ProbeConfigFile

func ProbeConfigFile() error

A dry-run of the `RadConfigFile()` method used in the healthtest

func ReadConfigFile

func ReadConfigFile() error

Reads the config file from disk, if the file does not exist (for example first run), a new one is created

func SetHardwareEnabled

func SetHardwareEnabled(enabled bool)

func SetHash

func SetHash(hash string)

func WriteConfig

func WriteConfig() error

Writes the current state of the global config to the file on disk

Types

type Config

type Config struct {
	Port      uint16   `json:"port"`
	NodeName  string   `json:"nodeName"`
	TokenHash string   `json:"tokenHash"`
	Hardware  Hardware `json:"hardware"`
	Switches  []Switch `json:"switches"`
}

func GetConfig

func GetConfig() Config

type Hardware

type Hardware struct {
	HardwareEnabled     bool   `json:"hardwareEnabled"`
	RFDevicePin         uint8  `json:"pin"` // The BCM pin to which a 433mhz sender is attached
	RFDeviceProtocol    uint8  `json:"protocol"`
	RFDeviceRepeat      uint8  `json:"repeat"`
	RFDevicePulselength uint16 `json:"pulseLength"`
	RFDeviceLength      uint8  `json:"contentLength"`
}

Documentation of following parameters: github.com/MikMuellerDev/rpirf

type Switch

type Switch struct {
	Id      string `json:"id"`
	CodeOn  int    `json:"on"`
	CodeOff int    `json:"off"`
}

Jump to

Keyboard shortcuts

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