{"id":42196082,"url":"https://github.com/icepie/miio.go","last_synced_at":"2026-01-27T00:17:21.248Z","repository":{"id":57704090,"uuid":"493267687","full_name":"icepie/miio.go","owner":"icepie","description":"Go implementation for MiIO protocol.","archived":false,"fork":false,"pushed_at":"2022-06-03T16:52:03.000Z","size":1666,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-21T14:19:48.997Z","etag":null,"topics":["miio-protocol","mijia","xiaomi"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icepie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-17T13:40:01.000Z","updated_at":"2023-11-14T19:44:15.000Z","dependencies_parsed_at":"2022-09-26T21:12:04.757Z","dependency_job_id":null,"html_url":"https://github.com/icepie/miio.go","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/icepie/miio.go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icepie%2Fmiio.go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icepie%2Fmiio.go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icepie%2Fmiio.go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icepie%2Fmiio.go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icepie","download_url":"https://codeload.github.com/icepie/miio.go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icepie%2Fmiio.go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28792656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["miio-protocol","mijia","xiaomi"],"created_at":"2026-01-27T00:17:16.855Z","updated_at":"2026-01-27T00:17:20.498Z","avatar_url":"https://github.com/icepie.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# miio.go\n\nGo implementation for MiIO protocol.\ninpsired by [miio.dart](https://github.com/ctrysbita/miio.dart)\n\n## Install\n\n```sh\ngo get github.com/icepie/miio.go\n```\n\n## Usage\n\n\u003e for get device token and device id, you can try [micloud](https://github.com/icepie/micloud)\n\n```go\ndevice := miio.New(\"192.168.1.12\").\n\tSetToken(\"ffffffffffffffffffffffffffffffff\").\n\tSetDid(\"did\") // some device must use the true device id\n\n// get device info\ninfo, err := device.Info()\nif err != nil {\n\tpanic(err)\n}\n\nfmt.Printf(\"%s\\n\", info)\n\n// for get siid and piid, see https://home.miot-spec.com/\n// get properties\ngetProps, err := device.GetProps(miio.PropParam{\n\tSiid: 5,\n\tPiid: 1,\n}, miio.PropParam{\n\tSiid: 5,\n\tPiid: 2,\n})\n\nif err != nil {\n\tpanic(err)\n}\n\nfmt.Printf(\"%s\\n\", getProps)\n\n// set properties\nsetPropsParams := []miio.PropParam{\n\t{\n\t\tSiid:  5,\n\t\tPiid:  1,\n\t\tValue: true,\n\t},\n\t{\n\t\tSiid:  5,\n\t\tPiid:  2,\n\t\tValue: 0,\n\t},\n}\n\nsetProps, err := device.SetProps(setPropsParams...)\nif err != nil {\n\tpanic(err)\n}\n\n// Do action\naction, err := device.DoAction(miio.ActionParam{\n\tSiid: 2,\n\tAiid: 1,\n\t// In:   []any{0, \"test\"}, if need to send extra data\n})\n\nif err != nil {\n\tpanic(err)\n}\n\nfmt.Printf(\"%s\\n\", action)\n\n// some old devices can not use the standard way to control...\n// https://github.com/icepie/miio.go/issues/1\n// you can try to send raw data, like:\ngetProps, err := device.Send(\"get_prop\", []interface{}{\"power\", \"mode\", \"fan_level\", \"ver_swing\"})\nsetProps, err := device.Send(\"set_mode\", []interface{}{\"cool\"})\n\n\n// or you can try: https://github.com/icepie/micloud\n\n```\n\n## Protocol\n\n```\n0                   1                   2                   3\n 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1\n+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n| Magic Number = 0x2131         | Packet Length (incl. header)  |\n|-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|\n| Unknown                                                       |\n|-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|\n| Device ID (\"did\")                                             |\n|-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|\n| Stamp                                                         |\n|-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|\n| MD5 Checksum                                                  |\n| ... or Device Token in response to the \"Hello\" packet         |\n|-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|\n| Optional variable-sized payload (encrypted)                   |\n|...............................................................|\n\n\nPacket Length: 16 bits unsigned int\n    Length in bytes of the whole packet, including header(0x20 bytes).\n\nUnknown: 32 bits\n    This value is always 0.\n    0xFFFFFFFF in \"Hello\" packet.\n\nDevice ID: 32 bits\n    Unique number. Possibly derived from the MAC address.\n    0xFFFFFFFF in \"Hello\" packet.\n\nStamp: 32 bit unsigned int\n    Continously increasing counter.\n    Number of seconds since device startup.\n\nMD5 Checksum:\n    Calculated for the whole packet including the MD5 field itself,\n    which must be initialized with token.\n\n    In \"Hello\" packet,\n    this field contains the 128-bit 0xFF.\n\n    In the response to the first \"Hello\" packet,\n    this field contains the 128-bit device token.\n\nOptional variable-sized payload:\n    Payload encrypted with AES-128-CBC (PKCS#7 padding).\n\n        Key = MD5(Token)\n        IV  = MD5(Key + Token)\n```\n\n## Link\n\n- https://github.com/OpenMiHome/mihome-binary-protocol\n- https://github.com/rytilahti/python-miio\n- https://home.miot-spec.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficepie%2Fmiio.go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficepie%2Fmiio.go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficepie%2Fmiio.go/lists"}