https://github.com/orktes/go-alexa-smarthome
Handler for alexa smarthome v3 directives for golang
https://github.com/orktes/go-alexa-smarthome
alexa alexa-skill
Last synced: 5 months ago
JSON representation
Handler for alexa smarthome v3 directives for golang
- Host: GitHub
- URL: https://github.com/orktes/go-alexa-smarthome
- Owner: orktes
- License: mit
- Created: 2018-01-28T11:14:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-01-07T06:49:59.000Z (over 5 years ago)
- Last Synced: 2025-04-01T15:48:23.010Z (6 months ago)
- Topics: alexa, alexa-skill
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 10
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# go-alexa-smarthome
[](https://godoc.org/github.com/orktes/go-alexa-smarthome)
```go
package main
import (
"github.com/aws/aws-lambda-go/lambda"
smarthome "github.com/orktes/go-alexa-smarthome"
)type mockPropertyHandler struct {
val interface{}
}func (mockHandler *mockPropertyHandler) GetValue() (interface{}, error) {
fmt.Printf("Getting value %+v\n", mockHandler.val)
return mockHandler.val, nil
}func (mockHandler *mockPropertyHandler) SetValue(val interface{}) error {
fmt.Printf("Received value %+v\n", val)
mockHandler.val = val
return nil
}func (mockHandler *mockPropertyHandler) UpdateChannel() <-chan interface{} {
return nil
}func main() {
sm := smarthome.New(smarthome.AuthorizationFunc(func (req smarthome.AcceptGrantRequest) error {
return nil
}))abstractTestDevice := smarthome.NewAbstractDevice(
"1",
"Fake switch",
"Homeautomation",
"Just a fake light",
)
abstractTestDevice.AddDisplayCategory("SWITCH")
capability := abstractTestDevice.NewCapability("PowerController")
capability.AddPropertyHandler("powerState", &mockPropertyHandler{val: "ON"})sm.AddDevice(abstractTestDevice)
lambda.Start(sm.Handle)
}```
## TODO
### Controllers
- [x] Authorization
- [ ] CameraStreamController
- [ ] ChannelController
- [x] ColorTemperatureController
- [x] Discovery
- [ ] InputController
- [x] PercentageController
- [x] PowerController
- [ ] SceneController
- [x] StateReport
- [ ] TemperatureSensor
- [x] BrightnessController
- [x] ChangeReport
- [x] ColorController
- [ ] DeferredResponse
- [x] ErrorResponse
- [ ] LockController
- [ ] PlaybackController
- [ ] PowerLevelController
- [x] Speaker
- [ ] StepSpeaker
- [ ] ThermostatController### High level APIs (device abstractions)
- [ ] Light
- [ ] Switch
- [ ] TV
- [ ] Amplifier
- [ ] Speaker
- [ ] Temperature sensor