goha

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 11 Imported by: 0

README

goha

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity struct {
	EntityID    string                 `json:"entity_id,omitempty"`
	State       string                 `json:"state,omitempty"`
	Attributes  map[string]interface{} `json:"attributes,omitempty"`
	LastChanged time.Time              `json:"last_changed,omitempty"`
	LastUpdates time.Time              `json:"last_updates,omitempty"`
}

type Event

type Event struct {
	EventType string       `json:"event_type"`
	Data      EventData    `json:"data"`
	Origin    string       `json:"origin"`
	TimeFired time.Time    `json:"time_fired"`
	Context   EventContext `json:"context"`
}

Event is

type EventContext

type EventContext struct {
	ID       string `json:"id"`
	ParentID string `json:"parent_id"`
	UserID   string `json:"user_id"`
}

EventContext is

type EventData

type EventData struct {
	EntityID  string `json:"entity_id,omitempty"`
	Attribute string
	OldState  EventState `json:"old_state"`
	NewState  EventState `json:"new_state"`
}

EventData is

type EventManager

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

EventManager is

func (*EventManager) Connected

func (em *EventManager) Connected() bool

Connected is

func (*EventManager) Subscribe

func (em *EventManager) Subscribe(entityID string, attribute string, ch chan Event)

Subscribe is

func (*EventManager) Unsubscribe

func (em *EventManager) Unsubscribe(entityID string, attribute string, ch chan Event)

Unsubscribe is

func (*EventManager) Write

func (em *EventManager) Write(c *websocket.Conn, message interface{}) error

type EventState

type EventState struct {
	EntityID    string                 `json:"entity_id"`
	State       string                 `json:"state"`
	Attributes  map[string]interface{} `json:"attributes"`
	LastChanged time.Time              `json:"last_changed"`
	LastUpdate  time.Time              `json:"last_update"`
	Context     EventContext           `json:"context"`
}

EventState is

type HASP

type HASP struct {
	BasePath   string
	ActivePage int
	Brightness int
	Pages      []HASPPage
}

func (*HASP) ColorFromHex

func (hasp *HASP) ColorFromHex(red int, green int, blue int) (int, error)

func (*HASP) FactoryReset

func (hasp *HASP) FactoryReset() error

func (*HASP) Init

func (hasp *HASP) Init(ctx context.Context)

func (*HASP) Reboot

func (hasp *HASP) Reboot() error

func (*HASP) Update

func (hasp *HASP) Update() error

type HASPButton

type HASPButton struct {
	OnClick            func(value string) error
	Font               int
	BackgroundColorPri int
	BackgroundColorSec int
	ForegroundColorPri int
	ForegroundColorSec int
	HorizAlign         string
	VertAlign          string
	Text               string
	Wordwrap           bool
}

type HASPPage

type HASPPage struct {
	Buttons map[string]HASPButton
}

type Hass

type Hass struct {
	EventManager EventManager
	// contains filtered or unexported fields
}

func New

func New(URI string, token string, insecureSkipVerify bool) (*Hass, error)

func (*Hass) CallService

func (ha *Hass) CallService(domain string, service string, serviceData interface{}) error

func (*Hass) GetState

func (ha *Hass) GetState(entityID string) (Entity, error)

Jump to

Keyboard shortcuts

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