Integrating Xiaomi Mi Scale

Happens to the best of us :smiley:
Don’t forget the template editor, it will give you lots of helpful hints

Thank you a lot :pray:
I never used template editor before for don’t know about it😀.
As per your suggestion, I knew it already and gave it a try

1 Like

HA changed recently the definition of the manually configured MQTT sensors

Please advise how should I change my actual configuration:

sensor:

  • platform: mqtt
    name: “MiScale Weight”
    state_topic: “miscale/weight/kg”
    unit_of_measurement: “kg”
  • platform: mqtt
    name: “MiScale Impedance”
    state_topic: “miscale/impedance”
    unit_of_measurement: “Ω”
  • platform: mqtt
    name: “MiScale Datetime”
    state_topic: “miscale/midatetime”
    unit_of_measurement: “Datetime”
  • platform: mqtt
    name: “Cinematics Weight”
    state_topic: “miscale/cinematics/weight”
    value_template: “{{ value_json[‘weight’] }}”
    unit_of_measurement: “kg”
    json_attributes_topic: “miscale/cinematics/weight”
    icon: mdi:scale-bathroom
  • platform: mqtt
    name: “Cinematics BMI”
    state_topic: “miscale/cinematics/weight”
    value_template: “{{ value_json[‘bmi’] }}”
    icon: mdi:human-pregnant
    unit_of_measurement: “kg/m2”

I’ve managed with this configuration:

image

1 Like

I’ll update the doc (haven’t worked on the repo in a while)
I’m also working on updating the add-on since HA deprecated bluepy

2 Likes

great, ive noticed that mine no longer gets data from the scale since the latest version that brought bluetooth proxy, i dont have any proxies but something must have changed

HA stopped supporting the bluepy library. I’ve been working at using the bleak library instead. I’m close to publishing something in the next few days :slight_smile:

2 Likes

Great to see your being so active with the updates. Implemented and tested them, but cant get it to work anymore. Has anyone tested it over the use of bluetooth proxy on an ESP32?

1 Like

Just posting an update that a new version is available supporting bleak.

  • Standalone docker container version here
  • HA Add-On version here

Thanks to all early updaters for your help in troubleshooting :hugs:

Also interested in getting it working using bluetooth proxy on an esp32!

1 Like

I use HA, Passive BLE monitor and BodyMiScale integrations. I have followed the example you provided, but HA informs me that there’s an error in the configuration:

Invalid config for [bodymiscale]: expected a dictionary for dictionary value @ data['bodymiscale']. Got [OrderedDict([('platform', 'template'), ('sensors', OrderedDict([('weight_name_user1', OrderedDict([('friendly name', 'Waga P'), ('value_template', '{% set weight = states(\'sensor.ble_weight_waga\') | float(0) %}\n {% if 74 <= weight <= 90 %}\n {{ states("sensor.ble_weight_waga") }}\n {% else %}\n {{ states("sensor.weight_name_user1") }}\n{% endif %}'), ('unit_of_measurement', 'kg'), ('icon_template', 'mdi:weight-kilogram')]))]))]), OrderedDict([('platform', 'template'), ('.... (See /config/configuration.yaml, line 12).

The configuration itself is as follows:

- platform: template
  sensors:
    weight_name_user1:
      friendly name: "Waga P"
      value_template: >-
        {% set weight = states('sensor.ble_weight_waga') | float(0) %}
          {% if 74 <= weight <= 90 %}
            {{ states("sensor.ble_weight_waga") }}
          {% else %}
            {{ states("sensor.weight_name_user1") }}
        {% endif %}
      unit_of_measurement: 'kg'
      icon_template: mdi:weight-kilogram

- platform: template
  sensors:
    weight_name_user2:
    friendly name: "Waga E"
    value_template: >-
      {% set weight = states('sensor.ble_weight_waga') | float(0) %}
      {% if 40 <= weight <= 55 %}
          {{ states("sensor.ble_weight_waga") }}
      {% else %}
          {{ states("sensor.weight_name_user2") }}
      {% endif %}
    unit_of_measurement: 'kg'
    icon_template: mdi:weight-kilogram

- platform: template
  sensors:
    impedance_name_user1:
    friendly name: "Impedancja P"
    value_template: >-
      {% set weight = states('sensor.ble_weight_waga') | float(0) %}
      {% if 74 <= weight <= 90 %}
          {{ states("sensor.ble_impedance_waga") }}
      {% else %}
          {{ states("sensor.weight_name_user1") }}
      {% endif %}
    unit_of_measurement: 'kg'
    icon_template: mdi:weight-kilogram

- platform: template
  sensors:
    weight_name_user2:
    friendly name: "Impedancja E"
    value_template: >-
      {% set weight = states('sensor.ble_weight_waga') | float(0) %}
      {% if 40 <= weight <= 55 %}
          {{ states("sensor.ble_impedance_waga") }}
      {% else %}
          {{ states("sensor.weight_name_user2") }}
      {% endif %}
    unit_of_measurement: 'kg'
    icon_template: mdi:weight-kilogram

What I have missed or did wrong?

Can we identify users with NFC Tag? This means a person first scans the tag before weighing his or her weight.

Have you seen the addon for MiScale yet?
Runs fantastic and also saves the values.
With all other integrations etc. I had after each restart an “unknown” but the addon runs bomb!

1 Like

Hi, I was able to make my connection without esp32. Thanks @lolouk44.

Would you write a nice interface for Ha. (HA’s own interface is bad)

1 Like

What do you mean by that?

Custom cart. How can I tell you, it’s just for your plugin. To see body information more visually.
Just a suggestion, thanks again for the plugin.

Sorry I’ve only built the plug-in. For the Lovelace card there’s plenty ways to build what you want. It all depends on what information you want displayed. Have a look on the community there are plenty examples on how to display sensor information

1 Like

Hello and congratulations for the graphs, can you explain how you made the table with "current weight, change since yesterday, change last 7 days … Thanks

When i install the HA add-on and configure, save and i will start the addon i get this error:

This add-on does not expose configuration for you to mess with…

I dont see anything on the logs.

That error message doesn’t look familiar at all. Are you sure you installed my add-on?