bodymiscale
bodymiscale copied to clipboard
Multiuser Support
Hello! Thank you for your work on the integration, it is great.
I have a suggestion how to improve the integration even more. This is about multiuser support. For example, the users could be distinguished by the measured weight.
You could configure it like this for example:
bodymiscale:
model_miscale: "181B"
sensors:
weight: sensor.weight_aurelien
impedance: sensor.impedance_aurelien
users:
- name: "Username 1"
height: 176
born: "1990-04-10"
gender: "male"
weight_low: 70
weight_heigh: 100
- name: "Username 2"
height: 170
born: "1990-01-12"
gender: "female"
weight_low: 0
weight_heigh: 70
Each user would then get his own entity. For this to be possible, the values would probably also have to be persisted in core.restore_state.
Hello, at the beginning I was part in this direction then my wife and I we have a weight too close. So I went with this solution. In addition it keeps the data well after a restart.
https://community.home-assistant.io/t/exemple-xiaomi-miscale-select-the-person-who-weighs-himself-notif-action/299321
ESPHOME has a way to do this on sensor scale:
https://esphome.io/components/sensor/xiaomi_miscale2.html
You can add as many users as you want, granted they differ in weight ranges.
Hello, at the beginning I was part in this direction then my wife and I we have a weight too close. So I went with this solution. In addition, it keeps the data well after a restart.
https://community.home-assistant.io/t/exemple-xiaomi-miscale-select-the-person-who-weighs-himself-notif-action/299321
Hello,
There is a solution to do this without nodered? Example with input?
Multiuser would be fine without nodered.
Anyone got this working without node red?
Best would be that dckiller can implement this. If it is only a thing of changing the conig.yaml, can somebody give examples how to do?
I'll add a Plus one - this seems like the most logical extension of this.
plus 1 from my side as well!
My solution is to take the readings from the scale, pass through Node-RED to check who it is and then send to their own weight/imp sensors. It also solves the retained issue at the same time.
You must create one bodymiscale per user. The component is based on https://www.home-assistant.io/integrations/plant/
Dear @dckiller51, Thanks a lot for your work! Can you please provide an example of configuration for this?
You must create one bodymiscale per user. The component is based on https://www.home-assistant.io/integrations/plant/
Dear @dckiller51, Thanks a lot for your work! Can you please provide an example of configuration for this?
You must create one bodymiscale per user. The component is based on https://www.home-assistant.io/integrations/plant/
hello, your request should not be here. but here is an example
https://community.home-assistant.io/t/exemple-xiaomi-miscale-select-the-person-who-weighs-himself-notif-action/299321
Hello , if i create one bodymiscale per user. Only one card show statistic but others are unavailable ,till next messure, then new is showed other are unavailable. https://ibb.co/mG2Fnrk https://ibb.co/YbLhsHG
Hello , if i create one bodymiscale per user. Only one card show statistic but others are unavailable ,till next messure, then new is showed other are unavailable. https://ibb.co/mG2Fnrk https://ibb.co/YbLhsHG
Hello, Any updates on this? I have the same issue.
plus 1
plus 1
What is your configuration? it is important to have a weight and impedance sensor for each user.
I use templates to create a new weight sensor per person, then add that sensor to the person's bodymiscale instance. Here's an example that assigns the new scale values to the closest weight sensor:
template:
- trigger:
- platform: state
entity_id:
- sensor.mi_smart_scale_mass
sensor:
- name: "Person 1 Mass"
unit_of_measurement: "kg"
state: >
{% set weight = states('sensor.mi_smart_scale_mass') | float %}
{% set distance_a = (states('sensor.person_1_mass') | float - weight) | abs %}
{% set distance_b = (states('sensor.person_2_mass') | float - weight) | abs %}
{% if distance_a < 5 and distance_a < distance_b %}
{{ weight }}
{% else %}
{{ states('sensor.person_1_mass') }}
{% endif %}
- name: "Person 2 Mass"
unit_of_measurement: "kg"
state: >
{% set weight = states('sensor.mi_smart_scale_mass') | float %}
{% set distance_a = (states('sensor.person_1_mass') | float - weight) | abs %}
{% set distance_b = (states('sensor.person_2_mass') | float - weight) | abs %}
{% if distance_b < 5 and distance_b < distance_a %}
{{ weight }}
{% else %}
{{ states('sensor.person_2_mass') }}
{% endif %}
How about more users, like e.g. 4?
@maciek188, Following the same logic, something like this should work for 4 people:
Note: since HA doesn't initially know the values of sensor.person_1_mass
, sensor.person_2_mass
, sensor.person_3_mass
and sensor.person_4_mass
, they'll all be zeroes at first. You should set their proper values in Developer Tools.
template:
- trigger:
- platform: state
entity_id:
- sensor.mi_smart_scale_mass
sensor:
- name: "Person 1 Mass"
unit_of_measurement: "kg"
state: >
{% set weight = states('sensor.mi_smart_scale_mass') | float %}
{% set delta_a = (states('sensor.person_1_mass') | float - weight) | abs %}
{% set delta_b = (states('sensor.person_2_mass') | float - weight) | abs %}
{% set delta_c = (states('sensor.person_3_mass') | float - weight) | abs %}
{% set delta_d = (states('sensor.person_4_mass') | float - weight) | abs %}
{% if delta_a == [delta_a, delta_b, delta_c, delta_d, 5] | min %}
{{ weight }}
{% else %}
{{ states('sensor.person_1_mass') }}
{% endif %}
- name: "Person 2 Mass"
unit_of_measurement: "kg"
state: >
{% set weight = states('sensor.mi_smart_scale_mass') | float %}
{% set delta_a = (states('sensor.person_1_mass') | float - weight) | abs %}
{% set delta_b = (states('sensor.person_2_mass') | float - weight) | abs %}
{% set delta_c = (states('sensor.person_3_mass') | float - weight) | abs %}
{% set delta_d = (states('sensor.person_4_mass') | float - weight) | abs %}
{% if delta_b == [delta_a, delta_b, delta_c, delta_d, 5] | min %}
{{ weight }}
{% else %}
{{ states('sensor.person_2_mass') }}
{% endif %}
- name: "Person 3 Mass"
unit_of_measurement: "kg"
state: >
{% set weight = states('sensor.mi_smart_scale_mass') | float %}
{% set delta_a = (states('sensor.person_1_mass') | float - weight) | abs %}
{% set delta_b = (states('sensor.person_2_mass') | float - weight) | abs %}
{% set delta_c = (states('sensor.person_3_mass') | float - weight) | abs %}
{% set delta_d = (states('sensor.person_4_mass') | float - weight) | abs %}
{% if delta_c == [delta_a, delta_b, delta_c, delta_d, 5] | min %}
{{ weight }}
{% else %}
{{ states('sensor.person_3_mass') }}
{% endif %}
- name: "Person 4 Mass"
unit_of_measurement: "kg"
state: >
{% set weight = states('sensor.mi_smart_scale_mass') | float %}
{% set delta_a = (states('sensor.person_1_mass') | float - weight) | abs %}
{% set delta_b = (states('sensor.person_2_mass') | float - weight) | abs %}
{% set delta_c = (states('sensor.person_3_mass') | float - weight) | abs %}
{% set delta_d = (states('sensor.person_4_mass') | float - weight) | abs %}
{% if delta_d == [delta_a, delta_b, delta_c, delta_d, 5] | min %}
{{ weight }}
{% else %}
{{ states('sensor.person_4_mass') }}
{% endif %}
I am using BLE monitor and this integration and it shows me on the lovelace card correct data. But i want to use now 2 multi user data registered on separate lovelace card. Now i have followed this topic but don't really understand how i can do that. Can someone please help me?