E.volve / Fitdays smart scale (solved)

My wife bought a cheap (€ 19,95) but OK BLE e.volve smart scale, ofcourse without checking if it can be integrated. It looks like e.volve is a very unknown ‘company’.

I was about to post a question, but luckily it became the solution, right on time!

Here is what works for me. If anyone else has a similar e.volve scale, please post your details if your scale also starts with BLE MAC address 80:F4:16.

esphome:

esp32:
  board: esp-wrover-kit
  framework:
    type: esp-idf
ble_client:
  - mac_address: XX:XX:XX:XX:XX:XX
    id: ble_evolve_smart_scale
    # auto_connect: true
    on_connect:
      then:
        - lambda: |-
            ESP_LOGD("ble_client_lambda", "Connected to ble_evolve_smart_scale");
    on_disconnect:
      then:
        - lambda: |-
            ESP_LOGD("ble_client_lambda", "Disconnected from ble_evolve_smart_scale");

esp32_ble_tracker:

sensor:
  - platform: template
    name: "Evolve Smart Scale User1"
    id: evolve_smart_scale_user1
    unit_of_measurement: "kg"
    icon: mdi:weight-kilogram
    accuracy_decimals: 2
    update_interval: never

  - platform: template
    name: "Evolve Smart Scale User2"
    id: evolve_smart_scale_user2
    unit_of_measurement: "kg"
    icon: mdi:weight-kilogram
    accuracy_decimals: 2
    update_interval: never

  - platform: template
    name: "Evolve Smart Scale User3"
    id: evolve_smart_scale_user3
    unit_of_measurement: "kg"
    icon: mdi:weight-kilogram
    accuracy_decimals: 2
    update_interval: never

  - platform: ble_client
    type: characteristic
    ble_client_id: ble_evolve_smart_scale
    id: scale_data
    internal: true
    notify: true
    service_uuid: '0000FFB0-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '0000FFB2-0000-1000-8000-00805F9B34FB'
    lambda: |-
      // Assuming x is std::vector<uint8_t>
      // Combine the bytes x[3], x[4], and x[5] into a single 3-byte integer
      int32_t raw_value = (x[3] << 16) | (x[4] << 8) | x[5];

      // The offset is likely part of the raw value. Subtract it.
      int32_t final_value = raw_value - 0x680000;

      // The final value is likely in grams or decigrams. Divide to get kg.
      float weightKg = static_cast<float>(final_value) / 1000.0f;
      ESP_LOGD("scale_data", "Raw Value: 0x%X, Final Value: %d, Weight: %.2f kg", raw_value, final_value, weight);

      // Round the weight to two decimal places
      float roundedWeightKg = round(weightKg * 100.0) / 100.0;

      id(weight).publish_state(roundedWeightKg);

      return roundedWeightKg;

  - platform: template
    name: Weight Filters
    id: weight
    on_value:
      then:
        - lambda: |-
            if (id(weight).state < 0) {
              return;
            }

            if (id(weight).state >= 77) {
              id(evolve_smart_scale_user1).publish_state(x);
            } else if (id(weight).state >= 65 && id(weight).state <= 77) {
              id(evolve_smart_scale_user2).publish_state(x);
            } else {
              id(evolve_smart_scale_user3).publish_state(x);
            }

Resources:

Hello,
we bought a similiar smart scale: Healthkeep Electronic Body Fat Scale, FG2317WB
MAC starts with 80:F4:16.
It's working fine with your script. Thanks for sharing.

One thing I would be interested in is if there is any other indicator beside the weight to differentiate the user. Two of my users are within the same range (+/- 1Kg) so it is not possible to differentiate them via weight.

Indeed, sadly doesn't look like it :smiling_face_with_tear:

Hello,
I would like to share my solution with scale model FG2317WB.

Claude extracted the data encription of the broadcasted messages with a XOR by key 0x2CA0A0

sensor:
  - platform: template
    name: "Peso Bilancia"
    id: peso_bilancia
    unit_of_measurement: "kg"
    icon: "mdi:weight-kilogram"
    accuracy_decimals: 1
    device_class: weight
    state_class: measurement
	
esp32_ble_tracker:
  scan_parameters:
    interval: 320ms
    window: 30ms
    active: true
  on_ble_advertise:
    mac_address: A0:91:5C:2F:80:EE
    then:
      - lambda: |-
          for (auto &item : x.get_manufacturer_datas()) {
              const auto &d = item.data;
              if (d.size() != 12 || d[10] != 0x0D) continue;  // solo frame di peso
              bool stabile = !(d[6] & 0x80);
              uint32_t raw = (((uint32_t)d[7] << 16) | ((uint32_t)d[8] << 8) | d[9]) ^ 0x2CA0A0;
              float kg = raw / 1000.0f;
              ESP_LOGD("ble_scale", "Peso %.2f kg (%s)", kg, stabile ? "stabile" : "in corso");
              if (stabile) id(peso_bilancia).publish_state(kg);
            }

Muy bien @piedecarlo! :smiley:

Gracias por compartir :smiley: