package test import ( "encoding/json" "fmt" "git.r-2.top/kunmeng/mijia" "testing" "time" ) func Test_login(t *testing.T) { user := "15542100924" pwd := "1XAII@wsk" result, _ := mijia.Login(user, pwd) _, err := json.Marshal(result) if err != nil { return } Mi := mijia.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) }