Skip to content
This repository has been archived by the owner on Oct 31, 2022. It is now read-only.

Releases: smarthome-go/sdk

SDK v0.20.1

21 Aug 15:28
Compare
Choose a tag to compare

Changelog for v0.20.1

  • Added the workspace attribute to the Homescript-request struct

SDK v0.20.0

21 Aug 14:29
Compare
Choose a tag to compare

Changelog for v0.20.0

  • Added the workspace attribute to the Homescript struct

SDK v0.19.1

10 Aug 11:13
Compare
Choose a tag to compare

Changelog for v0.19.1

  • BUGFIX: The auth mode CookieToken was broken and is now fixed
  • The cookies were neither received nor appended which caused a invalid credentials error on any connection function after the inital login

SDK v0.19.0

10 Aug 10:30
Compare
Choose a tag to compare

Changelog for v0.19.0

  • Added username & token label fetching when logging in via an authentication token
  • This means you can obtain the username even though a token was used to authenticate
  • In order to get the username and token label, two additional public functions have been implemented (demonstrated in the code example below)
  • Removed usages of the deprecated ioutil package
  • This release is required because one error change inside the error "ENUMS"
  • This is a significant change and should be made public.
  • Because of the above facts, this release exists

Code Example (Obtaining username + token label)

package main

import (
	"fmt"

	"github.com/smarthome-go/sdk"
)

const URL = "http://smarthome.box"

func main() {
	// === Example 1: Obtaining username & token-label === //
	c, err := sdk.NewConnection(URL, sdk.AuthMethodQueryToken /* sdk.AuthMethodCookieToken */)
	if err != nil {
		panic(err.Error())
	}
	// Login with your user authentication token, to obtain one, visit `http://your-smarthome.box/profile`
	if err := c.TokenLogin("807b2eded585803ff287c295afe23d1a"); err != nil {
		panic(err.Error())
	}
	fmt.Println(c.GetUsername())         // This function works on all auth methods except `None`
	fmt.Println(c.GetTokenClientLabel()) // This function only works when token auth is used
}

SDK v0.18.0

09 Aug 21:07
Compare
Choose a tag to compare

Changelog for v0.18.0

  • Fixed all known typos in the codebase
  • This release is required because some typos were located inside error "ENUMS"
  • This is a significant change and should be made public.
  • Because of the above facts, this release exists

SDK v0.17.0

09 Aug 20:58
Compare
Choose a tag to compare

Changelog for v0.17.0

  • Added support for token authentication
  • Completely refactored the way login and connection works
  • Now compatible with Smarthome user authentication tokens and server version 0.0.54

Example Code

This code demonstrates the use and difference of the new authentication methods

package main

import "github.com/smarthome-go/sdk"

const URL = "http://localhost:8082"

func main() {
	// === Example 1: Using token authentication === //
	c1, err := sdk.NewConnection(URL, sdk.AuthMethodQueryToken /* sdk.AuthMethodCookieToken */)
	if err != nil {
		panic(err.Error())
	}
	// Login with your user authentication token, to obtain one, visit `http://your-smarthome.box/profile`
	if err := c1.TokenLogin("650feaafc1487d18bd8c5a805363be96"); err != nil {
		panic(err.Error())
	}

	// === Example 2: Using username & password authentication === //
	c2, err := sdk.NewConnection(URL, sdk.AuthMethodQueryPassword /* sdk.AuthMethodCookiePassword */)
	if err != nil {
		panic(err.Error())
	}
	// Login with the usual username-password combination
	if err := c1.UserLogin("admin", "admin"); err != nil {
		panic(err.Error())
	}

	// => After login, each connection behaves idenically
	if err := c1.SetPower("s2", true); err != nil {
		panic(err.Error())
	}
	if err := c2.SetPower("s2", true); err != nil {
		panic(err.Error())
	}
}

SDK v0.16.0

31 Jul 22:44
Compare
Choose a tag to compare

Changelog for v0.16.0

  • Added HMS job count to debug info

SDK v0.15.0

23 Jun 16:28
Compare
Choose a tag to compare

Changelog

  • Added additional parameters to the DebugInfo struct
  • Due to previous change, the GetDebugInfo function now returns more information, such as HW-nodes

SDK v0.14.1

23 Jun 08:18
Compare
Choose a tag to compare

Changelog

  • The version info of the connection struct is now always set, regardless of version conflicts or errors
  • This allows the host software's error implementation to display the conflicting versions

SDK v0.14.0

21 Jun 18:07
Compare
Choose a tag to compare

Changelog for v0.14.0

  • Added version to Smarthome connection instance attributes