{"id":23817898,"url":"https://github.com/lsongdev/miservice-go","last_synced_at":"2025-09-07T00:32:51.673Z","repository":{"id":264853127,"uuid":"894481683","full_name":"lsongdev/miservice-go","owner":"lsongdev","description":":cloud: XiaoMi Cloud Service","archived":false,"fork":false,"pushed_at":"2024-11-27T15:04:11.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-31T10:05:29.757Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lsongdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"song940","patreon":"song940","open_collective":"song940","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://git.io/fjRcB"}},"created_at":"2024-11-26T12:37:39.000Z","updated_at":"2024-11-29T03:35:41.000Z","dependencies_parsed_at":"2024-11-27T08:27:33.284Z","dependency_job_id":null,"html_url":"https://github.com/lsongdev/miservice-go","commit_stats":null,"previous_names":["lsongdev/mihome-go","lsongdev/miservice-go"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsongdev%2Fmiservice-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsongdev%2Fmiservice-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsongdev%2Fmiservice-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lsongdev%2Fmiservice-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lsongdev","download_url":"https://codeload.github.com/lsongdev/miservice-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232158300,"owners_count":18480860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-02T05:49:02.567Z","updated_at":"2025-01-02T05:49:03.280Z","avatar_url":"https://github.com/lsongdev.png","language":"Go","funding_links":["https://github.com/sponsors/song940","https://patreon.com/song940","https://opencollective.com/song940","https://git.io/fjRcB"],"categories":[],"sub_categories":[],"readme":"# XiaoMi Cloud Service\n\n```go\npackage main\n\nimport (\n  \"log\"\n  \"os\"\n\n  \"github.com/lsongdev/miservice-go/miservice\"\n)\n\nfunc main() {\n  client := miservice.NewClient(\n    os.Getenv(\"MI_USERNAME\"),\n    os.Getenv(\"MI_PASSWORD\"),\n  )\n```\n\n*[[repo]/miservice/miio.go](./miservice/miio.go)*\n\n#### MiioRequest\n\n+ HomeRequest\n+ [HomeDeviceList](#homedevicelist)\n+ HomeGetProps\n+ HomeSetProps\n\n#### HomeDeviceList\n\n```go\ndevices, err := client.HomeDeviceList(\u0026miservice.DeviceListFilter{\n  ShowVirtualModel: true,\n  ShowHuamiDevices: 1,\n})\nif err != nil {\n  log.Fatal(err)\n}\nfor _, device := range devices {\n  log.Println(device.Name, device.Model, device.Did, device.Token)\n}\n```\n\n*[[repo]/miservice/miot.go](./miservice/miot.go)*\n\n+ MiotGetProps\n+ MiotSetProps\n+ [MiotAction](#miotaction)\n\n#### MiotAction\n\n\u003chttps://miot-spec.org/miot-spec-v2/instances?status=all\u003e\n\n```go\nfunc (c *Client) Speak(did, text string) (H, error) {\n  return c.MiotAction(did, []int{5, 1}, []any{text})\n}\n\nfunc (c *Client) WakeUp(did string) (H, error) {\n  return c.MiotAction(did, []int{5, 2}, []any{})\n}\n\nfunc (c *Client) PlayRadio(did string) (H, error) {\n  return c.MiotAction(did, []int{5, 3}, []any{})\n}\n\nfunc (c *Client) PlayMusic(did string) (H, error) {\n  return c.MiotAction(did, []int{5, 4}, []any{})\n}\n```\n\n*[[repo]/miservice/mina.go](./miservice/mina.go)*\n\n+ MinaRequest\n+ [ListMinaDevices](#listminadevices)\n+ [RemoteUbusCall](#remoteubuscall)\n\n#### ListMinaDevices\n\n```go\ndevices, _ := client.ListMinaDevices(1)\nfor _, device := range devices {\n  log.Println(device.Name, device.DeviceID)\n}\n```\n\n#### RemoteUbusCall\n\n```go\nfunc (c *Client) TextToSpeech(deviceId, text string) (out H, err error) {\n  out = make(map[string]any)\n  err = c.RemoteUbusCall(deviceId, \"mibrain.text_to_speech\", H{\"text\": text}, out)\n  return\n}\n```\n\n```go\ndid := \"f1801b9f-0034-4153-bbf6-6b6453668c26\"\nclient.PlayerSetVolume(did, 30)\nresp, err := client.TextToSpeech(did, \"你好，我是小爱\")\nif err != nil {\n  log.Fatal(err)\n}\nlog.Println(resp)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsongdev%2Fmiservice-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flsongdev%2Fmiservice-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flsongdev%2Fmiservice-go/lists"}