googleassistant

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SyncIntent is used when syncing devices.
	SyncIntent = "action.devices.SYNC"
	// QueryIntent is used when querying for status.
	QueryIntent = "action.devices.QUERY"
	// ExecuteIntent is used when controlling devices.
	ExecuteIntent = "action.devices.EXECUTE"

	CommandBrightnessAbsolute = "action.devices.commands.BrightnessAbsolute"
	CommandOnOff              = "action.devices.commands.OnOff"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	ID              string     `json:"id"`
	Type            string     `json:"type"`
	Traits          []string   `json:"traits"`
	Name            DeviceName `json:"name"`
	WillReportState bool       `json:"willReportState"`
	// DeviceInfo      struct {
	// Manufacturer string `json:"manufacturer"`
	// Model        string `json:"model"`
	// HwVersion    string `json:"hwVersion"`
	// SwVersion    string `json:"swVersion"`
	// } `json:"deviceInfo"`
	// CustomData struct {
	// FooValue int    `json:"fooValue"`
	// BarValue bool   `json:"barValue"`
	// BazValue string `json:"bazValue"`
	// } `json:"customData"`
	Attributes DeviceAttributes `json:"attributes,omitempty"`
}

type DeviceAttributes

type DeviceAttributes struct {
	ColorModel      string `json:"colorModel,omitempty"`
	TemperatureMinK int    `json:"temperatureMinK,omitempty"`
	TemperatureMaxK int    `json:"temperatureMaxK,omitempty"`
}

type DeviceName

type DeviceName struct {
	DefaultNames []string `json:"defaultNames,omitempty"`
	Name         string   `json:"name,omitempty"`
	Nicknames    []string `json:"nicknames,omitempty"`
}

type Inputs

type Inputs []map[string]json.RawMessage

Inputs from google.

func (Inputs) Intent

func (i Inputs) Intent() Intent

func (Inputs) Payload

func (i Inputs) Payload() Payload

type Intent

type Intent string

Intent of the action.

type Payload

type Payload struct {
	Commands []struct {
		Devices []struct {
			ID string `json:"id"`
		} `json:"devices"`
		Execution []struct {
			Command string `json:"command"`
			Params  struct {
				On         bool `json:"on"`
				Brightness int  `json:"brightness"`
			} `json:"params"`
		} `json:"execution"`
	} `json:"commands"`
	Devices []struct {
		ID string `json:"id"`
	} `json:"devices"`
}

type QueryResponse

type QueryResponse struct {
	RequestID string `json:"requestId"`
	Payload   struct {
		Devices map[string]map[string]interface{} `json:"devices,omitempty"`
	} `json:"payload"`
}

type Request

type Request struct {
	RequestID string
	Inputs    Inputs
}

type Response

type Response struct {
	RequestID string `json:"requestId"`
	Payload   struct {
		AgentUserID string            `json:"agentUserId,omitempty"`
		Devices     []Device          `json:"devices,omitempty"`
		Commands    []ResponseCommand `json:"commands,omitempty"`
	} `json:"payload"`
}

type ResponseCommand

type ResponseCommand struct {
	IDs       []string       `json:"ids"`
	Status    string         `json:"status"`
	States    ResponseStates `json:"states"`
	ErrorCode string         `json:"errorCode,omitempty"`
}

func NewResponseCommand

func NewResponseCommand() ResponseCommand

type ResponseStates

type ResponseStates struct {
	On         bool `json:"on,omitempty"`
	Brightness int  `json:"brightness,omitempty"`
	Online     bool `json:"online,omitempty"`
}

Jump to

Keyboard shortcuts

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