Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) CallService(ctx context.Context, cmd DefaultServiceCmd) (StateEntities, error)
- func (c *Client) CreateState(ctx context.Context, entityId string, newState State) (StateResponse, error)
- func (c *Client) FireEvent(ctx context.Context, eventType string, atTime *time.Time) (bool, error)
- func (c *Client) GetCameraJpeg(ctx context.Context, cameraEntityId string) (image.Image, error)
- func (c *Client) GetConfig(ctx context.Context) (Config, error)
- func (c *Client) GetDiscoverInfo(ctx context.Context) (DiscoveryInfo, error)
- func (c *Client) GetEvents(ctx context.Context) (Events, error)
- func (c *Client) GetLogbook(ctx context.Context, filter *LogbookFilter) (LogbookRecords, error)
- func (c *Client) GetPlainErrorLog(ctx context.Context) (PlainText, error)
- func (c *Client) GetServices(ctx context.Context) (Services, error)
- func (c *Client) GetStateChangesHistory(ctx context.Context, filter *StateChangesFilter) (StateChanges, error)
- func (c *Client) GetStateForEntity(ctx context.Context, entityId string) (StateEntity, error)
- func (c *Client) GetStates(ctx context.Context) (StateEntities, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) RenderTemplate(ctx context.Context, template string) (string, error)
- func (c *Client) TriggerConfigCheck(ctx context.Context) (ConfigurationCheckResult, error)
- type ClientConfig
- type Config
- type ConfigurationCheckResult
- type DefaultServiceCmd
- type DiscoveryInfo
- type EntityChange
- type Event
- type Events
- type LogbookFilter
- type LogbookRecord
- type LogbookRecords
- type PlainText
- type Service
- type ServiceDomain
- type ServiceField
- type Services
- type State
- type StateChanges
- type StateChangesFilter
- type StateEntities
- type StateEntity
- type StateResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var NotFoundError = errors.New("not found")
View Source
var UnAuthorizedError = errors.New("unauthorized")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CallService ¶
func (c *Client) CallService(ctx context.Context, cmd DefaultServiceCmd) (StateEntities, error)
func (*Client) CreateState ¶
func (*Client) GetCameraJpeg ¶
func (*Client) GetDiscoverInfo ¶
func (c *Client) GetDiscoverInfo(ctx context.Context) (DiscoveryInfo, error)
func (*Client) GetLogbook ¶
func (c *Client) GetLogbook(ctx context.Context, filter *LogbookFilter) (LogbookRecords, error)
func (*Client) GetPlainErrorLog ¶
func (*Client) GetStateChangesHistory ¶
func (c *Client) GetStateChangesHistory(ctx context.Context, filter *StateChangesFilter) (StateChanges, error)
func (*Client) GetStateForEntity ¶
func (*Client) RenderTemplate ¶
func (*Client) TriggerConfigCheck ¶
func (c *Client) TriggerConfigCheck(ctx context.Context) (ConfigurationCheckResult, error)
type ClientConfig ¶
type Config ¶
type Config struct { Components []string `json:"components"` ConfigDir string `json:"config_dir"` Elevation int `json:"elevation"` Latitude float64 `json:"latitude"` LocationName string `json:"location_name"` Longitude float64 `json:"longitude"` TimeZone string `json:"time_zone"` UnitSystem struct { Length string `json:"length"` Mass string `json:"mass"` Temperature string `json:"temperature"` Volume string `json:"volume"` } `json:"unit_system"` Version string `json:"version"` WhitelistExternalDirs []string `json:"whitelist_external_dirs"` }
type DefaultServiceCmd ¶
type DefaultServiceCmd struct { Service string `json:"-"` Domain string `json:"-"` EntityId string `json:"entity_id"` }
func NewToggleLightTCmd ¶ added in v0.4.0
func NewToggleLightTCmd(entityId string) DefaultServiceCmd
NewToggleLightTCmd is helper for turning light off
func NewTurnLightOffCmd ¶
func NewTurnLightOffCmd(entityId string) DefaultServiceCmd
NewTurnLightOffCmd is helper for turning light off
func NewTurnLightOnCmd ¶
func NewTurnLightOnCmd(entityId string) DefaultServiceCmd
NewTurnLightOnCmd is helper for turning light on
func (DefaultServiceCmd) Reader ¶
func (c DefaultServiceCmd) Reader() io.Reader
type DiscoveryInfo ¶
type EntityChange ¶
type EntityChange struct { EntityId string `json:"entity_id"` State string `json:"state"` Attributes map[string]interface{} `json:"attributes"` LastChanged time.Time `json:"last_changed"` LastUpdated time.Time `json:"last_updated"` }
func (*EntityChange) GetFriendlyName ¶
func (e *EntityChange) GetFriendlyName() string
type LogbookFilter ¶
type LogbookFilter struct { StartTime time.Time EndTime time.Time `json:"end_time"` EntityId string `json:"entity"` }
func (*LogbookFilter) String ¶
func (f *LogbookFilter) String() string
type LogbookRecord ¶
type LogbookRecords ¶
type LogbookRecords []LogbookRecord
type Service ¶
type Service struct { Name string `json:"name"` Description string `json:"description"` Fields map[string]ServiceField `json:"fields"` Target struct { Entity []map[string]interface{} `json:"entity"` } `json:"target"` }
type ServiceDomain ¶
type ServiceField ¶
type Services ¶
type Services []ServiceDomain
type StateChanges ¶
type StateChanges [][]EntityChange
type StateChangesFilter ¶
type StateChangesFilter struct { StartTime time.Time EndTime time.Time `json:"end_time"` FilterEntityId string `json:"filter_entity_id"` MinimalResponse bool `json:"minimal_response"` SignificantChangesOnly bool `json:"significant_changes_only"` }
StateChangesFilter use json tags to construct queryParams
func (*StateChangesFilter) String ¶
func (f *StateChangesFilter) String() string
type StateEntities ¶
type StateEntities []StateEntity
type StateEntity ¶
type StateEntity struct { EntityId string `json:"entity_id"` State string `json:"state"` Attributes map[string]interface{} `json:"attributes"` LastChanged time.Time `json:"last_changed"` LastUpdated time.Time `json:"last_updated"` Context struct { Id string `json:"id"` ParentId string `json:"parent_id"` UserId string `json:"user_id"` } `json:"context"` }
type StateResponse ¶
type StateResponse struct { State CreateCode int `json:"-"` EntityId string `json:"entity_id"` LastChanged time.Time `json:"last_changed"` LastUpdated time.Time `json:"last_updated"` }
func (StateResponse) Created ¶ added in v0.4.0
func (s StateResponse) Created() bool
func (StateResponse) Updated ¶ added in v0.4.0
func (s StateResponse) Updated() bool
Click to show internal directories.
Click to hide internal directories.