{"id":22423492,"url":"https://github.com/qbbr/mi-scale-2","last_synced_at":"2025-06-23T01:34:56.014Z","repository":{"id":48182574,"uuid":"247677483","full_name":"qbbr/mi-scale-2","owner":"qbbr","description":"Get Xiaomi Mi Smart Scale 2 weight and publishing to mqtt","archived":false,"fork":false,"pushed_at":"2023-12-14T15:22:45.000Z","size":18,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-07T17:39:10.862Z","etag":null,"topics":["bluetooth-low-energy","mqtt","python3","raspberry-pi","reverse-engineering","xiaomi","xiaomi-miscale"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qbbr.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-16T10:48:35.000Z","updated_at":"2024-08-20T06:17:51.000Z","dependencies_parsed_at":"2024-12-05T18:11:43.876Z","dependency_job_id":"ece25435-15a7-4636-afae-48ab761a40ad","html_url":"https://github.com/qbbr/mi-scale-2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/qbbr/mi-scale-2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbbr%2Fmi-scale-2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbbr%2Fmi-scale-2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbbr%2Fmi-scale-2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbbr%2Fmi-scale-2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qbbr","download_url":"https://codeload.github.com/qbbr/mi-scale-2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbbr%2Fmi-scale-2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261396045,"owners_count":23152439,"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":["bluetooth-low-energy","mqtt","python3","raspberry-pi","reverse-engineering","xiaomi","xiaomi-miscale"],"created_at":"2024-12-05T18:11:33.059Z","updated_at":"2025-06-23T01:34:50.991Z","avatar_url":"https://github.com/qbbr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mi-scale-2\n\nGet Xiaomi Mi Smart Scale 2 weight and publishing to mqtt\n\n*Tested only on Raspberry Pi 3b + Mi Scale 2*\n\n## Requirements\n\n * python3\n * python-dotenv\n * bluepy\n * paho-mqtt\n * root permission for `bluepy.btle`\n\n```bash\nsudo pip install -r requirements.txt\n```\n\n## Usage\n\nalways run with `sudo` or from `root`:\n\n```bash\ncp .env.dist .env\nvim .env\nsudo ./main.py\n# sudo ./main.py --help\n# sudo ./main.py --loglevel=DEBUG\n```\n\n## Autostart\n\n```bash\nsudo cp mi-scale-2.service /etc/systemd/system/\nsudo systemctl enable mi-scale-2\nsudo systemctl start mi-scale-2\n```\n\n## Integrate with Home Assistant\n\n[![qbbr-mi-scale-2-home-assistant-integration](https://i.imgur.com/rRetkYZ.png)](https://i.imgur.com/rRetkYZ.png)\n\n```yaml\n# configuration.yaml:\nmqtt:\n    sensor:\n      - name: \"my_weight\"\n        state_topic: \"miscale/qbbr/weight\"\n        force_update: true\n        unit_of_measurement: \"kg\"\n        state_class: \"measurement\"\n        icon: mdi:scale\n\n# customize.yaml:\nsensor.my_weight:\n    friendly_name: Мой вес\n```\n\n## Help\n\nget dev mac address:\n\n```bash\nsudo hcitool lescan\n```\n\nif u have troubleshoots, try restart u bluetooth/adapter\n\n```bash\nsudo hciconfig hci0 reset\nsudo invoke-rc.d bluetooth restart\n```\n\n### Reverse Engineering RAW Schema for Mi Scale 2\n\n!!! *slightly different than from openScale wiki* !!!\n\n**byte 0:**\n\n- 0 bit - unknown\n- 1 bit - unit kg\n- 2 bit - unit lbs\n- 3 bit - unknown\n- 4 bit - jin (chinese catty) unit\n- 5 bit - stabilized\n- 6 bit - unknown\n- 7 bit - weight removed\n\n**byte 1-2:**\n - weight (little endian)\n\n## Links\n\n * https://github.com/oliexdev/openScale/wiki/Xiaomi-Bluetooth-Mi-Scale\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqbbr%2Fmi-scale-2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqbbr%2Fmi-scale-2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqbbr%2Fmi-scale-2/lists"}