Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nasa9084/go-switchbot
SwitchBot API Client for Go
https://github.com/nasa9084/go-switchbot
switchbot switchbot-api
Last synced: about 1 month ago
JSON representation
SwitchBot API Client for Go
- Host: GitHub
- URL: https://github.com/nasa9084/go-switchbot
- Owner: nasa9084
- License: mit
- Created: 2021-02-24T15:43:45.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-20T11:59:06.000Z (2 months ago)
- Last Synced: 2024-11-09T06:00:41.468Z (about 2 months ago)
- Topics: switchbot, switchbot-api
- Language: Go
- Homepage:
- Size: 51.8 KB
- Stars: 17
- Watchers: 3
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-switchbot
===
[![Go Reference](https://pkg.go.dev/badge/github.com/nasa9084/go-switchbot.svg)](https://pkg.go.dev/github.com/nasa9084/go-switchbot)
[![test](https://github.com/nasa9084/go-switchbot/actions/workflows/test.yml/badge.svg?event=push)](https://github.com/nasa9084/go-switchbot/actions/workflows/test.yml)A [SwitchBot API](https://github.com/OpenWonderLabs/SwitchBotAPI/blob/main/README.md) client for Golang
## SYNOPSIS
``` go
const (
openToken = "blahblahblah"
secretKey = "blahblahblah"
)c := switchbot.New(openToken, secretKey)
// get physical devices and show
pdev, _, _ := c.Device().List(context.Background())for _, d := range pdev {
fmt.Printf("%s\t%s\n", d.Type, d.Name)
}
```## Get Open Token
To use [SwitchBot API](https://github.com/OpenWonderLabs/SwitchBotAPI/blob/main/README.md), you need to get Open Token for auth. [Follow steps](https://github.com/OpenWonderLabs/SwitchBotAPI/blob/e236be6a613c1d2a9c18965fd502a951608a8765/README.md#getting-started) below:
> 1. Download the SwitchBot app on App Store or Google Play Store
> 2. Register a SwitchBot account and log in into your account
> 3. Generate an Open Token within the app a) Go to Profile > Preference b) Tap App Version 10 times. Developer Options will show up c) Tap Developer Options d) Tap Get Token
> 4. Roll up your sleeves and get your hands dirty with SwitchBot OpenAPI!