{"id":16526072,"url":"https://github.com/markusressel/esphome-smart-scale","last_synced_at":"2025-04-05T15:03:18.070Z","repository":{"id":37398855,"uuid":"493440529","full_name":"markusressel/ESPHome-Smart-Scale","owner":"markusressel","description":"An ESPHome based Smart Scale.","archived":false,"fork":false,"pushed_at":"2025-01-21T23:49:29.000Z","size":226,"stargazers_count":141,"open_issues_count":2,"forks_count":19,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-29T14:04:32.775Z","etag":null,"topics":["esphome","home-assistant","scale","smart-scale"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markusressel.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":"2022-05-17T23:11:41.000Z","updated_at":"2025-03-26T23:25:35.000Z","dependencies_parsed_at":"2024-04-08T16:48:45.284Z","dependency_job_id":"e9c0992e-73ee-4da5-b75d-c1a25f0f02f4","html_url":"https://github.com/markusressel/ESPHome-Smart-Scale","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2FESPHome-Smart-Scale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2FESPHome-Smart-Scale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2FESPHome-Smart-Scale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markusressel%2FESPHome-Smart-Scale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markusressel","download_url":"https://codeload.github.com/markusressel/ESPHome-Smart-Scale/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353729,"owners_count":20925329,"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":["esphome","home-assistant","scale","smart-scale"],"created_at":"2024-10-11T17:25:55.000Z","updated_at":"2025-04-05T15:03:18.043Z","avatar_url":"https://github.com/markusressel.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  ESPHome-Smart-Scale\n\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003eAn ESPHome based Smart Scale.\u003c/h4\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"images/hass-dashboard.png\" width=512 alt=\"Home Assistant Example Card\"\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003cimg src=\"images/scale-hardware.jpg\" width=512 alt=\"Modified Scale Hardware\"\u003e\u003c/p\u003e\n\n## Features\n\n* [x] Based on [ESPHome][esphome]\n* [x] Realtime transmission to Home Assistant\n* [x] On-device mapping of raw sensor values to Kg scale (or whatever unit you want to use instead)\n* [x] Automatically accounts for sensor shifts due to temperature changes\n* [x] Instant tare with a click of a button\n\n## What you need\n\n* Any standard scale of choice\n* An HX711 ADC converter\n* An ESP8266, ESP32 or similar board\n  * A power supply (preferrably USB)\n\n## Flashing the firmware\n\n* Create a new ESPHome configuration YAML file\n* Copy the contents of [esphome_hx711_smart_scale.yaml](esphome_hx711_smart_scale.yaml) into it\n* Customize the basic device cnfiguration (Board, WiFi, etc.) to your liking\n* Flash it onto your ESP based board\n\n## Wiring\n\nConnect the load cells to the HX711, and the ESP board to the HX711 as shown:\n\n![Wiring diagram for a 4x50kg load cell configuration](https://circuitjournal.com/img/articles/10_50kg_load_cell/HX711_4x50kg_load_cell_diagram.jpg?v=10)\nCredit: https://circuitjournal.com/img/articles/10_50kg_load_cell/HX711_4x50kg_load_cell_diagram.jpg\n\n## Connect to Home Assistant\n\nAdd the ESPHome device to Home Assistant via the \"Integrations\" page.\nThe sensors and buttons will automatically appear.\n\nThe configuration for the card as seen at the top relies on the \n[multiple-entity-row](https://github.com/benct/lovelace-multiple-entity-row) custom component.\n\n\u003cimg src=\"images/hass-dashboard.png\" width=420 alt=\"Dashboard Card for this Smart Scale\"\u003e\u003c/p\u003e\n\nLovelace Configuration:\n\n```yaml\ntitle: Devices\ntype: vertical-stack\ncards:\n  - type: entities\n    show_header_toggle: false\n    state_color: false\n    entities:\n      - entities:\n          - entity: switch.smart_scale_continuous_tare_enabled\n            name: Auto Tare\n            toggle: true\n          - entity: button.smart_scale_manual_tare_action\n            name: Manual Tare\n            type: Button\n            icon: mdi:scale-balance\n            tap_action:\n              action: call-service\n              service: button.press\n              service_data:\n                entity_id: button.smart_scale_manual_tare_action\n          - entity: sensor.smart_scale_hx711_value\n            name: Current\n        entity: input_number.weight_markus\n        name: Smart Scale\n        icon: mdi:scale-bathroom\n        secondary_info: last-changed\n        state_header: Markus\n        type: custom:multiple-entity-row\n```\n\n## Initial Calibration\n\n### Preparations\n\nTo do the initial calibration we need to be able to read the raw sensor values of the\nHX711 sensor in real time. We can do this a couple of ways, f.ex. by\n\n* Using the diagnostic sensor \"HX711 RAW Value\" exposed to Home Assistant\n  * This sensor is only updated once right after the ESP has booted\n  * To update the value simply press the \"Manual Tare\" Button\n* plugging the ESP in via USB and using a serial monitor\n* reading the ESPHome logs\n\n### 0 Kg baseline\n\nWe can then take the baseline measurement by simply letting the scale sit for a couple of seconds and writing\ndown the raw sensor value at this time. Don't worry about the value fluctuating a bit, the measurement doesn't\nneed to be super accurate since it will be automatically adjusted later-on.\n\nIn my case the value is `-481989` (a negative number). This means a raw sensor value of `-481989` correlates\nwith a 0 Kg load on the scale: `-481989 -\u003e 0`\n\n### Known Mass measurement\n\nTo be able to extrapolate the whole curve we need to measure a second point on it. To do this the first \nthing we need is a weight with a known mass. Again there are multiple options to choose from:\n\n* your own body weight as measured with a \"normal\" scale\n* a water tank filled to 10 or 20 liters\n\nIt should be noted though, that the measurement error does increase the closer the two measurements are to each other.\nSo my personal recommendation would be to just measure yourself on a standard scale and use yourself as a \"known mass\".\n\nIn my case the raw sensor value for a known mass of 88.3 Kg (my body weight) is `1339163` (not negative anymore).\nThis means a raw sensor value of `1339163` correlates with a 88.3 Kg load on the scale:\n\n`1339163 -\u003e 88.3`\n\n### Applying this to the YAML config\n\nLastly we need to set those measurements in the YAML configuration:\n\n```yaml\n...\n\nglobals:\n  - id: initial_zero\n    type: float\n    restore_value: yes\n    # NOTE: make sure to align this value to the one used in \"calibrate_linear\" below!\n    initial_value: '-481989'\n\n...\n```\n\n```yaml\n...\n  - platform: template\n    name: \"Smart Scale HX711 Value\"\n    ...\n    filters:\n      ...\n      - calibrate_linear:\n          - -481989 -\u003e 0\n          - 1339163 -\u003e 88.3\n      ...\n```\n\nAfter that, upload the firmware again and you should be good to go!\n\n## Auto Tare\n\nSince the raw values will drift slightly due to room temperature etc., over time the scale might \nshift up or down a bit. To combat this you can use the \"Auto Tare\" feature, which will automatically\nshift the whole curve to keep it at 0 Kg. For this to work the approximate 0 Kg value needs to be set\nin the YAML config, and the adjustment is only done while no weight is applied to the scale (0 ± 10 Kg).\n\nThis process is intentionally very slow, so don't expect it to adjust within a minute. In practice\nno big differences should occur though, if the scale is powered at all times.\n\n## Manual Tare\n\nIf the Auto Tare is too slow or you want to force a manual tare at any point you can use the \"Manual Tare\"\ntoggle. This will immediately adjust the weight curve to make the current weight be the 0 Kg value.\n\n\n# License\n\nCC0 see [LICENSE](LICENSE)\n\n[esphome]: https://esphome.io/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkusressel%2Fesphome-smart-scale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkusressel%2Fesphome-smart-scale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkusressel%2Fesphome-smart-scale/lists"}