Skip to content

nasa9084/go-switchbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

93372d1 · Mar 8, 2023

History

35 Commits
Nov 5, 2022
Feb 24, 2021
Nov 11, 2022
Mar 8, 2023
Feb 3, 2023
Feb 3, 2023
Feb 3, 2023
Nov 11, 2022
Feb 3, 2023
Nov 11, 2022
Feb 3, 2023
Mar 8, 2023
Mar 8, 2023
Feb 3, 2023

Repository files navigation

go-switchbot

Go Reference test

A SwitchBot API client for Golang

SYNOPSIS

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, you need to get Open Token for auth. Follow steps 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!