homescript

package
v0.0.6-beta Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(logger *logrus.Logger)

func Run

func Run(username string, scriptLabel string, scriptCode string) (string, []error)

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

Types

type Executor

type Executor struct {
	ScriptName string
	Username   string
	Output     string
}

func (*Executor) Exit

func (self *Executor) Exit(code int)

func (*Executor) GetDate

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

Returns the current time variables

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

Jump to

Keyboard shortcuts

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