types

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestReportState  = "ReportState" // gets when alexa needs a state of a device
	ResponseStateReport = "StateReport" // respond to "ReportState" request
)
View Source
const (
	ErrorTypeAlreadyInOperation                        = "ALREADY_IN_OPERATION"
	ErrorTypeBridgeUnreachable                         = "BRIDGE_UNREACHABLE"
	ErrorTypeCloudControlDisabled                      = "CLOUD_CONTROL_DISABLED"
	ErrorTypeEndPointBusy                              = "ENDPOINT_BUSY"
	ErrorTypeEndpointLowPower                          = "ENDPOINT_LOW_POWER"
	ErrorTypeEndpointUnreachable                       = "ENDPOINT_UNREACHABLE"
	ErrorTypeExpiredAuthorizationCredential            = "EXPIRED_AUTHORIZATION_CREDENTIAL"
	ErrorTypeFirmwareOutOfDate                         = "FIRMWARE_OUT_OF_DATE"
	ErrorTypeHardwareMalfunction                       = "HARDWARE_MALFUNCTION"
	ErrorTypeInsufficientPermissions                   = "INSUFFICIENT_PERMISSIONS"
	ErrorTypeInternalError                             = "INTERNAL_ERROR"
	ErrorTypeInvalidAuthorizationCredentials           = "INVALID_AUTHORIZATION_CREDENTIAL"
	ErrorTypeInvalidDirective                          = "INVALID_DIRECTIVE"
	ErrorTypeInvalidValue                              = "INVALID_VALUE"
	ErrorTypeNoSuchEndpoint                            = "NO_SUCH_ENDPOINT"
	ErrorTypeNotCalibrated                             = "NOT_CALIBRATED"
	ErrorTypeNotSupportedInCurrentMode                 = "NOT_SUPPORTED_IN_CURRENT_MODE"
	ErrorTypeNotSupportedWithCurrentBatteryChargeState = "NOT_SUPPORTED_WITH_CURRENT_BATTERY_CHARGE_STATE"
	ErrorTypeNotInOperation                            = "NOT_IN_OPERATION"
	ErrorTypePowerLevelNotSupported                    = "POWER_LEVEL_NOT_SUPPORTED"
	ErrorTypeRateLimitExceed                           = "RATE_LIMIT_EXCEEDED"
	ErrorTypeTemperatureValueOutOfRange                = "TEMPERATURE_VALUE_OUT_OF_RANGE"
	ErrorTypeTooManyFailedAttempts                     = "TOO_MANY_FAILED_ATTEMPTS"
	ErrorTypeValueOutOfRange                           = "VALUE_OUT_OF_RANGE  "
)
View Source
const (
	NamespaceDiscovery            = "Alexa.Discovery"
	NamespacePowerController      = "Alexa.PowerController"
	NamespaceBrightnessController = "Alexa.BrightnessController"
	NamespaceColorController      = "Alexa.ColorController"
	NamespacePercentageController = "Alexa.PercentageController"

	NameDiscoverResponse = "Discover.Response"

	PropertyNamePowerState      = "powerState"
	PropertyNameBrightness      = "brightness"
	PropertyNameBrightnessDelta = "brightnessDelta"
	PropertyNameColor           = "color"
	PropertyNamePercentage      = "percentage"

	DirectiveTurnOn        = "TurnOn"
	DirectiveTurnOff       = "TurnOff"
	DirectiveSetBrightness = "SetBrightness"
)

Variables

View Source
var (
	DisplayCategory = map[string]string{
		vdTY.DeviceTypeLight:          "LIGHT",
		vdTY.DeviceTypeSwitch:         "SWITCH",
		vdTY.DeviceTypeCamera:         "CAMERA",
		vdTY.DeviceTypeWindow:         "EXTERIOR_BLIND",
		vdTY.DeviceTypeDoor:           "DOOR",
		vdTY.DeviceTypeDoorBell:       "DOORBELL",
		vdTY.DeviceTypeFan:            "FAN",
		vdTY.DeviceTypeGarageDoor:     "GARAGE_DOOR",
		vdTY.DeviceTypeTelevision:     "TV",
		vdTY.DeviceTypeThermostat:     "THERMOSTAT",
		vdTY.DeviceTypeRouter:         "ROUTER",
		vdTY.DeviceTypeOutlet:         "SMARTPLUG",
		vdTY.DeviceTypeAirConditioner: "AIR_CONDITIONER",
		vdTY.DeviceTypeAirCooler:      "AIR_CONDITIONER",
	}
)

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery.html#display-categories

Functions

func GetDisplayCategory

func GetDisplayCategory(deviceType string) []string

func GetValue

func GetValue(propertyName string, value interface{}) interface{}

Types

type ActionMapping

type ActionMapping struct {
	Type      string            `json:"@type"`   // valid value is ActionsToDirective
	Actions   []string          `json:"actions"` // Valid values: Alexa.Actions.Open, Alexa.Actions.Close, Alexa.Actions.Raise, Alexa.Actions.Lower, Alexa.Actions.SetEcoOn, and Alexa.Actions.SetEcoOff.
	Directive EndpointDirective `json:"directive"`
}

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery-objects.html#action-mapping

type AdditionalAttributes

type AdditionalAttributes struct {
	Manufacturer     string `json:"manufacturer,omitempty"`
	Model            string `json:"model,omitempty"`
	SerialNumber     string `json:"serialNumber,omitempty"`
	FirmwareVersion  string `json:"firmwareVersion,omitempty"`
	SoftwareVersion  string `json:"softwareVersion,omitempty"`
	CustomIdentifier string `json:"customIdentifier,omitempty"`
}

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery-objects.html#additionalattributes-object

type Capability

type Capability struct {
	Type                    string                   `json:"type"`
	Interface               string                   `json:"interface"`
	Instance                string                   `json:"instance,omitempty"`
	Version                 string                   `json:"version"`
	Properties              *Properties              `json:"properties,omitempty"`
	CapabilityResources     *cmap.CustomMap          `json:"capabilityResources,omitempty"`
	Configuration           *cmap.CustomMap          `json:"configuration,omitempty"` // or configurations
	Semantics               *Semantics               `json:"semantics,omitempty"`
	VerificationsRequired   []VerificationsRequired  `json:"verificationsRequired,omitempty"`
	DirectiveConfigurations []DirectiveConfiguration `json:"directiveConfigurations,omitempty"`
}

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery-objects.html#capability-object

type Connection

type Connection struct {
	Type                string `json:"type"` // Valid values: MATTER, TCP_IP,ZIGBEE, ZWAVE, or UNKNOWN
	MacAddress          string `json:"macAddress,omitempty"`
	HomeID              string `json:"homeId,omitempty"`
	NodeID              string `json:"nodeId,omitempty"`
	MatterDiscriminator uint   `json:"matterDiscriminator"` // Integer between 0-4095
	MatterVendorID      uint   `json:"matterVendorId"`      // Integer between 0-65535
	MatterProductID     uint   `json:"matterProductId"`     // Integer between 0-65535
	MacNetworkInterface string `json:"macNetworkInterface,omitempty"`
	Value               string `json:"value,omitempty"` // required when type = UNKNOWN
}

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery-objects.html#connections-object

type Context

type Context struct {
	Properties []Property `json:"properties"`
}

type CustomPolicy

type CustomPolicy struct {
	PolicyName string `json:"policyName,omitempty"` // Valid values: OTP, and VOICE_PIN.
}

type DirectiveConfiguration

type DirectiveConfiguration struct {
	Directives                             []string                                `json:"directives"`
	RequestedAuthenticationConfidenceLevel *RequestedAuthenticationConfidenceLevel `json:"requestedAuthenticationConfidenceLevel,omitempty"`
}

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery-objects.html#directiveconfigurations-object-details

type DirectiveEndpoint

type DirectiveEndpoint struct {
	Scope      Scope             `json:"scope"`
	EndpointID string            `json:"endpointId"`
	Cookie     map[string]string `json:"cookie"`
}

type DirectiveOrEvent

type DirectiveOrEvent struct {
	Header   Header                 `json:"header"`
	Payload  map[string]interface{} `json:"payload"`
	Endpoint *DirectiveEndpoint     `json:"endpoint,omitempty"`
}

type DiscoverResponse

type DiscoverResponse struct {
	Header  Header
	Payload map[string]interface{}
}

type Endpoint

type Endpoint struct {
	EndpointID           string                `json:"endpointId"`
	ManufacturerName     string                `json:"manufacturerName"`
	Description          string                `json:"description"`
	FriendlyName         string                `json:"friendlyName"`
	DisplayCategories    []string              `json:"displayCategories"`
	AdditionalAttributes *AdditionalAttributes `json:"additionalAttributes,omitempty"`
	Capabilities         []Capability          `json:"capabilities"`
	Connections          []Connection          `json:"connections,omitempty"`
	Relationships        *Relationships        `json:"relationships,omitempty"`
	Cookie               cmap.CustomStringMap  `json:"cookie"`
}

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery-objects.html#endpoint-object

type EndpointDirective

type EndpointDirective struct {
	Name    string          `json:"name"`
	Payload *cmap.CustomMap `json:"payload,omitempty"`
}
type Header struct {
	Namespace      string `json:"namespace"`
	Name           string `json:"name"`
	MessageID      string `json:"messageId"`
	PayloadVersion string `json:"payloadVersion"`
}

type IsConnectedBy

type IsConnectedBy struct {
	EndpointId string `json:"endpointId"`
}

type IsPartOf

type IsPartOf struct {
	EndpointId string `json:"endpointId"`
}

type Properties

type Properties struct {
	Supported           []cmap.CustomStringMap `json:"supported,omitempty"`
	ProactivelyReported bool                   `json:"proactivelyReported"`
	Retrievable         bool                   `json:"retrievable"`
}

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery-objects.html#properties-object

func GetInterfaceProperties

func GetInterfaceProperties(aInterface string) Properties

type Property

type Property struct {
	Namespace                 string      `json:"namespace"`
	Instance                  string      `json:"instance,omitempty"`
	Name                      string      `json:"name"`
	Value                     interface{} `json:"value"`
	TimeOfSample              string      `json:"timeOfSample"`
	UncertaintyInMilliseconds uint        `json:"uncertaintyInMilliseconds"`
}

type Relationships

type Relationships struct {
	IsConnectedBy *IsConnectedBy `json:"isConnectedBy,omitempty"`
	IsPartOf      *IsPartOf      `json:"Alexa.Automotive.IsPartOf,omitempty"`
}

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery-objects.html#relationships-object

type Request

type Request struct {
	Directive DirectiveOrEvent `json:"directive"`
}

type RequestedAuthenticationConfidenceLevel

type RequestedAuthenticationConfidenceLevel struct {
	Level        int           `json:"level"` // Valid values: 400, 500
	CustomPolicy *CustomPolicy `json:"customPolicy,omitempty"`
}

type Response

type Response struct {
	Event   DirectiveOrEvent `json:"event"`
	Context *Context         `json:"context,omitempty"`
}

type Scope

type Scope struct {
	Type      string `json:"type"`
	Token     string `json:"token"`
	Partition string `json:"partition,omitempty"`
	UserID    string `json:"userId,omitempty"`
}

type Semantics

type Semantics struct {
	ActionMappings []ActionMapping `json:"actionMappings,omitempty"`
	StateMappings  []StateMapping  `json:"stateMappings,omitempty"`
}

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery-objects.html#semantics-object

type StateMapping

type StateMapping struct {
	Type   string                 `json:"@type"`           // Valid values: one of StatesToValue or StatesToRange.
	States []string               `json:"states"`          // Array of Alexa states that are mapped to your controller values. Valid values: Alexa.States.Open, Alexa.States.Closed, Alexa.States.EcoOn, Alexa.States.EcoOff, Alexa.States.Low, Alexa.States.Empty, Alexa.States.Full, Alexa.States.Done, and Alexa.States.Stuck.
	Value  interface{}            `json:"value,omitempty"` // required when @type is StatesToValue
	Range  map[string]interface{} `json:"range,omitempty"` // required when @type is StatesToRange
}

https://developer.amazon.com/en-US/docs/alexa/device-apis/alexa-discovery-objects.html#state-mapping

Jump to

Keyboard shortcuts

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