package test import ( "encoding/json" "fmt" "mijia-go-sdk" "testing" "time" ) func Test_login(t *testing.T) { user := "15542100924" pwd := "1XAII@wsk" result, _ := mijia_go_sdk.Login(user, pwd) _, err := json.Marshal(result) if err != nil { return } Mi := mijia_go_sdk.NewMiJia(result) //Mi.Rooms() Mi.Devices() //Mi.Scenes(0) //Mi.RunScene("1784216758920822784") var data []map[string]interface{} data = append(data, map[string]interface{}{ "did": "740885802", "siid": 9, "piid": 1, }) data = append(data, map[string]interface{}{ "did": "740885802", "siid": 9, "piid": 2, }) deviceVar, err := Mi.GetDeviceVar(data) if err != nil { return } for _, v := range deviceVar { fmt.Printf("%f", v.Value) } time.Sleep(10 * time.Second) //Mi.Consumables(0) //Mi.Scenes(0) }