homescript

package
v0.0.24-beta Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(logger *logrus.Logger)

func RunById

func RunById(username string, homescriptId string) (string, int, error)

Types

type Executor

type Executor struct {
	ScriptName string
	Username   string
	Output     string
}

func (Executor) Exec

func (self Executor) Exec(homescriptId string) (string, error)

Executes another Homescript based on its Id

func (*Executor) GetDate

func (self *Executor) GetDate() (int, int, int, int, int, int)

Returns the current time variables

func (*Executor) GetDebugInfo

func (self *Executor) GetDebugInfo() (string, error)

func (*Executor) GetTemperature

func (self *Executor) GetTemperature() (int, error)

TODO: Will later be implemented, should return the temperature in Celsius

func (*Executor) GetUser

func (self *Executor) GetUser() string

Returns the name of the user who is currently running the script

func (*Executor) GetWeather

func (self *Executor) GetWeather() (string, error)

TODO: Will later be implemented, should return the weather as a human-readable string

func (*Executor) Log

func (self *Executor) Log(
	title string,
	description string,
	level interpreter.LogLevel,
) error

Adds a log entry to the internal logging system

func (*Executor) Notify

func (self *Executor) Notify(
	title string,
	description string,
	level interpreter.LogLevel,
) error

Sends a notification to the current user

func (*Executor) Play

func (self *Executor) Play(server string, mode string) error

Sends a mode request to a given radiGo server

func (*Executor) Print

func (self *Executor) Print(args ...string)

Prints to the console

func (*Executor) Switch

func (self *Executor) Switch(switchId string, powerOn bool) error

Changes the power state on said switch

func (*Executor) SwitchOn

func (self *Executor) SwitchOn(switchId string) (bool, error)

Returns a boolean if the requested switch is on or off

type HomescriptError

type HomescriptError struct {
	ErrorType string   `json:"errorType"`
	Location  Location `json:"location"`
	Message   string   `json:"message"`
}

func Run

func Run(username string, scriptLabel string, scriptCode string) (string, int, []HomescriptError)

Executes a given homescript as a given user, returns the output and a possible error slice

type Location

type Location struct {
	Filename string `json:"filename"`
	Line     uint   `json:"line"`
	Column   uint   `json:"column"`
	Index    uint   `json:"index"`
}

Jump to

Keyboard shortcuts

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