Integrating Xiaomi Mi Scale

@mgim

If node red turns you off, you can create a sensor template

  1. Put a name for your weight sensor = weight_name_user1
  2. Change the name of the sensor according to your choice above = {{ states(“sensor.weight_name_user1”) }}
  3. To determine the user you must enter where your weight is. Between xx kg and xx kg = {% if 69 <= weight <= 72.99 %}

The problem with this solution is that if 2 users have a weight too close together it will not work.

#Balance Connectée
- platform: template
  sensors:
    weight_name_user1:
      friendly_name: "Weight Name"
      value_template: >-
        {% set weight = states('sensor.xiaomi_mi_scale_weight') | float %}
          {% if 69 <= weight <= 72.99 %}
            {{ states("sensor.xiaomi_mi_scale_weight") }}
          {% else %}
            {{ states("sensor.weight_name_user1") }}
          {% endif %}
      unit_of_measurement: 'kg'
      icon_template: mdi:weight-kilogram
- platform: template
  sensors:
    weight_name_user2:
      friendly_name: "Weight Name"
      value_template: >-
        {% set weight = states('sensor.xiaomi_mi_scale_weight') | float %}
          {% if 60 <= weight <= 68.99 %}
            {{ states("sensor.xiaomi_mi_scale_weight") }}
          {% else %}
            {{ states("sensor.weight_name_user2") }}
          {% endif %}
      unit_of_measurement: 'kg'
      icon_template: mdi:weight-kilogram

For impedance:

We keep the same logic, it is the weight that will determine the user

  1. Put a name for your impedance sensor = impedance_name_user1
  2. Change the name of the sensor according to your choice above = {{ states(“sensor.impedance_name_user1”) }}
  3. To determine the user you must enter where your weight is. Between xx kg and xx kg = {% if 69 <= weight <= 72.99 %}
- platform: template
  sensors:
    impedance_name_user1:
      friendly_name: "Impedance Name"
      value_template: >-
        {% set weight = states('sensor.xiaomi_mi_scale_weight') | float %}
          {% if 69 <= weight <= 72.99 %}
            {{ states("sensor.xiaomi_mi_scale_impedance") }}
          {% else %}
            {{ states("sensor.impedance_name_user1") }}
          {% endif %}
      unit_of_measurement: 'ohm'
      icon_template: mdi:omega
- platform: template
  sensors:
    impedance_name_user2:
      friendly_name: "Impedance Name"
      value_template: >-
        {% set weight = states('sensor.xiaomi_mi_scale_weight') | float %}
          {% if 60 <= weight <= 68.99 %}
            {{ states("sensor.xiaomi_mi_scale_impedance") }}
          {% else %}
            {{ states("sensor.impedance_name_user2") }}
          {% endif %}
      unit_of_measurement: 'ohm'
      icon_template: mdi:omega
11 Likes