hyperion

package module
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: MIT Imports: 11 Imported by: 0

README

Static Badge GitHub last commit

hyperion-ng

hyperion-ng is library that helps communicate with Hyperion-NG JSON API.

Install

go get -u github.com/denwwer/hyperion-ng

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client instance for Hyperion.

func NewClient

func NewClient(conf Config, opt ...ClientOption) *Client

NewClient creates new client.

func (Client) ClearPriority

func (c Client) ClearPriority(priority int) error

ClearPriority used to revert SetColor, SetEffect or SetImage.

func (Client) ComponentState

func (c Client) ComponentState(name string, enable bool) error

ComponentState enabled or disabled at runtime.

func (Client) Instance

func (c Client) Instance(instance int, command model.InstanceCmd) error

Instance controlling.

func (Client) LEDMode

func (c Client) LEDMode(mode model.LEDMode) error

LEDMode switched the LED mapping mode for the incoming image.

func (*Client) ServerInfo

func (c *Client) ServerInfo() (*model.Information, error)

ServerInfo retrieve live state of Hyperion.

func (Client) SetAdjustment

func (c Client) SetAdjustment(adj model.Adjustment) error

SetAdjustment to color calibration.

func (Client) SetColor

func (c Client) SetColor(color []int, priority int, origin string, duration *int) error

SetColor for all LEDs.

func (Client) SetEffect

func (c Client) SetEffect(effect model.Effect, priority int, origin string, duration *int) error

SetEffect by name with optional overridden arguments.

func (Client) SetImage

func (c Client) SetImage(image model.Image, priority int, origin string, duration *int) error

SetImage a single image.

func (Client) SetSource

func (c Client) SetSource(priority int) error

SetSource priority manually.

func (Client) SetSourceAuto

func (c Client) SetSourceAuto() error

SetSourceAuto visible source is determined by priority.

func (*Client) SystemInfo

func (c *Client) SystemInfo() (*model.System, error)

SystemInfo retrieve basic system information about Hyperion server.

func (Client) VideoMode

func (c Client) VideoMode(mode model.VideoMode) error

VideoMode switching.

type ClientOption

type ClientOption func(c *Client)

ClientOption available options.

func WithHeader

func WithHeader(headers map[string]string) ClientOption

WithHeader set custom headers.

func WithLogger

func WithLogger(l Logger) ClientOption

WithLogger set custom logger.

type Config added in v1.3.0

type Config struct {
	VerboseLog bool       `json:"verbose_log"` // Enable verbose logging
	Connection Connection `json:"connection"`
}

Config for client.

func (Config) GetTimeout added in v1.3.0

func (c Config) GetTimeout() time.Duration

GetTimeout returns custom or default timeout.

type Connection added in v1.3.0

type Connection struct {
	Token   string         `json:"token"`
	Type    ConnectionType `json:"type"`
	Host    string         `json:"host"`
	Port    int            `json:"port"`
	SSL     bool           `json:"ssl"`
	Timeout int            `json:"timeout"` // Time to wait for a server response in seconds (default 30 sec)
}

Connection configuration.

type ConnectionType added in v1.3.0

type ConnectionType string

ConnectionType mechanism.

const (
	// ConnectTCP       ConnectionType = "TCP"  // TCP Socket
	// ConnectWebSocket ConnectionType = "WS"   // WebSocket
	ConnectHTTP ConnectionType = "HTTP" // HTTP/S
)

List of Hyperion connection mechanisms.

type Logger

type Logger interface {
	Info(msg string)
	Warn(msg string)
	Error(msg string)
}

Logger integration for client.

type StdLogger

type StdLogger struct{}

StdLogger represent standard logger from "log" pkg.

func (*StdLogger) Error

func (l *StdLogger) Error(msg string)

func (*StdLogger) Info

func (l *StdLogger) Info(msg string)

func (*StdLogger) Warn

func (l *StdLogger) Warn(msg string)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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