Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionOptions ¶ added in v0.9.0
type ConnectionOptions struct {
// QueueSize bounds how many events may be waiting for a handler.
//
// Home Assistant disconnects a client that stops draining its socket, so
// the queue is deliberately finite: once it is full, further events are
// dropped and counted rather than allowed to stall the connection. Raise it
// if your handlers are bursty, and prefer making handlers return quickly
// over setting it very high. Defaults to 256.
QueueSize int
// Workers is how many events may be handled concurrently. A handler that
// blocks occupies a worker for as long as it runs, so this is effectively
// the number of slow callbacks tolerated before events start queueing.
// Defaults to 4.
Workers int
// PingInterval is how often an idle connection is checked for liveness.
// Defaults to 30 seconds.
PingInterval time.Duration
}
ConnectionOptions tunes the websocket connection. The zero value selects a sensible default for every field, so only the settings you care about need to be set.
This mirrors the internal connection options rather than exposing them directly, which keeps the wire layer free to change shape without moving the public API with it.
type DurationString ¶ added in v0.7.1
type DurationString string
DurationString represents a duration, such as "2s" or "24h". See https://pkg.go.dev/time#ParseDuration for all valid time units.
type EventZWaveJSValueNotification ¶ added in v0.7.1
type EventZWaveJSValueNotification struct {
ID int `json:"id"`
Type string `json:"type"`
Event struct {
EventType string `json:"event_type"`
Data struct {
Domain string `json:"domain"`
NodeID int `json:"node_id"`
HomeID int64 `json:"home_id"`
Endpoint int `json:"endpoint"`
DeviceID string `json:"device_id"`
CommandClass int `json:"command_class"`
CommandClassName string `json:"command_class_name"`
Label string `json:"label"`
Property string `json:"property"`
PropertyName string `json:"property_name"`
PropertyKey string `json:"property_key"`
PropertyKeyName string `json:"property_key_name"`
Value string `json:"value"`
ValueRaw int `json:"value_raw"`
} `json:"data"`
Origin string `json:"origin"`
TimeFired time.Time `json:"time_fired"`
} `json:"event"`
}
type Item ¶ added in v0.7.1
type Item struct {
Value interface{}
Priority float64
}
Item represents a priority queue item with a value and priority.
type NewAppRequest ¶ added in v0.7.1
type NewAppRequest struct {
// Required
URL string
// Optional
// Deprecated: use URL instead
// IpAddress of your Home Assistant instance, e.g. "localhost"
// or "192.168.86.59" etc.
IpAddress string
// Optional
// Deprecated: use URL instead
// Port number Home Assistant is running on. Defaults to 8123.
Port string
// Required
// Auth token generated in Home Assistant. Used
// to connect to the WebSocket API.
HAAuthToken string
// Required
// EntityId of the zone representing your home, e.g. "zone.home".
// Used to pull latitude/longitude from Home Assistant
// to calculate sunset/sunrise times.
HomeZoneEntityId string
// Optional
// Whether to use secure connections for HTTP and WebSockets.
// Setting this to `true` will use `https://` instead of `http://`
// and `wss://` instead of `ws://`.
Secure bool
// Optional
// Connection tunes the websocket connection. The zero value uses defaults
// suitable for a typical Home Assistant instance.
Connection ConnectionOptions
}
NewAppRequest contains the configuration for creating a new App instance.
type NotifyRequest ¶
type SetTemperatureRequest ¶
type SetTemperatureRequest struct {
Temperature float32
TargetTempHigh float32
TargetTempLow float32
HvacMode string
}
func (*SetTemperatureRequest) ToJSON ¶
func (r *SetTemperatureRequest) ToJSON() map[string]any
type TimeString ¶ added in v0.7.1
type TimeString string
TimeString is a 24-hr format time "HH:MM" such as "07:30".