Documentation ¶
Index ¶
- Constants
- Variables
- func GetDisplayCategory(deviceType string) []string
- func GetValue(propertyName string, value interface{}) interface{}
- type ActionMapping
- type AdditionalAttributes
- type Capability
- type Connection
- type Context
- type CustomPolicy
- type DirectiveConfiguration
- type DirectiveEndpoint
- type DirectiveOrEvent
- type DiscoverResponse
- type Endpoint
- type EndpointDirective
- type Header
- type IsConnectedBy
- type IsPartOf
- type Properties
- type Property
- type Relationships
- type Request
- type RequestedAuthenticationConfidenceLevel
- type Response
- type Scope
- type Semantics
- type StateMapping
- type VerificationsRequired
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 ( TraitControllerMap = map[string]string{ vdTY.DeviceTraitOnOff: NamespacePowerController, vdTY.DeviceTraitBrightness: NamespaceBrightnessController, vdTY.DeviceTraitColorSetting: NamespaceColorController, } InterfacePropertyNameMap = map[string]string{ NamespacePowerController: PropertyNamePowerState, NamespaceBrightnessController: PropertyNameBrightness, NamespaceColorController: PropertyNameColor, } )
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 ¶
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"` }
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"` }
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"` }
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 }
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"` }
type DirectiveEndpoint ¶
type DirectiveOrEvent ¶
type DirectiveOrEvent struct { Header Header `json:"header"` Payload map[string]interface{} `json:"payload"` Endpoint *DirectiveEndpoint `json:"endpoint,omitempty"` }
type DiscoverResponse ¶
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"` }
type EndpointDirective ¶
type IsConnectedBy ¶
type IsConnectedBy struct {
EndpointId string `json:"endpointId"`
}
type Properties ¶
type Properties struct { Supported []cmap.CustomStringMap `json:"supported,omitempty"` ProactivelyReported bool `json:"proactivelyReported"` Retrievable bool `json:"retrievable"` }
func GetInterfaceProperties ¶
func GetInterfaceProperties(aInterface string) Properties
type Relationships ¶
type Relationships struct { IsConnectedBy *IsConnectedBy `json:"isConnectedBy,omitempty"` IsPartOf *IsPartOf `json:"Alexa.Automotive.IsPartOf,omitempty"` }
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 Semantics ¶
type Semantics struct { ActionMappings []ActionMapping `json:"actionMappings,omitempty"` StateMappings []StateMapping `json:"stateMappings,omitempty"` }
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
type VerificationsRequired ¶
type VerificationsRequired struct { Directive string `json:"directive"` Methods cmap.CustomStringMap `json:"methods"` }
Click to show internal directories.
Click to hide internal directories.