cmd

package
v0.8.0-beta Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const Version = "0.8.0-beta"

Variables

View Source
var (
	History   []string
	Switches  []Switch
	DebugInfo DebugInfoData
)
View Source
var (
	Verbose  bool
	ShowInfo bool
	Silent   bool

	SmarthomeURL   string
	SessionCookies []*http.Cookie

	Username string
	Password string
)
View Source
var Config = map[string]string{
	Username:     "",
	Password:     "",
	SmarthomeURL: "",
}

Functions

func Execute

func Execute()

func GetDebugInfo

func GetDebugInfo() error

Fetches debug information from the smarthome server

func Login

func Login(doOutput bool)

Tests if the provided credentials are valid

func PingServer

func PingServer()

Tests if the server configuration is valid and the server is reachable

func PromptLogin

func PromptLogin()

The login function prompts the user to enter his password and username (if not provided via flag)

func StartRepl

func StartRepl()

Types

type DBStatus

type DBStatus struct {
	OpenConnections int `json:"openConnections"`
	InUse           int `json:""`
	Idle            int `json:""`
}

type DebugInfoData

type DebugInfoData struct {
	ServerVersion          string      `json:"version"`
	DatabaseOnline         bool        `json:"databaseOnline"`
	DatabaseStats          DBStatus    `json:"databaseStats"`
	CpuCores               uint8       `json:"cpuCores"`
	Goroutines             uint16      `json:"goroutines"`
	GoVersion              string      `json:"goVersion"`
	MemoryUsage            uint16      `json:"memoryUsage"`
	PowerJobCount          uint16      `json:"powerJobCount"`
	PowerJobWithErrorCount uint16      `json:"lastPowerJobErrorCount"`
	PowerJobs              []PowerJob  `json:"powerJobs"`
	PowerJobResults        []JobResult `json:"powerJobResults"`
}

type JobResult

type JobResult struct {
	Id    int64 `json:"id"`
	Error error `json:"error"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type PowerJob

type PowerJob struct {
	Id         int64  `json:"id"`
	SwitchName string `json:"switchName"`
	Power      bool   `json:"power"`
}

type Switch

type Switch struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	RoomId  string `json:"roomId"`
	PowerOn bool   `json:"powerOn"`
	Watts   uint   `json:"watts"`
}

Used when starting a REPL session (for autocompletion)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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