core icon indicating copy to clipboard operation
core copied to clipboard

Add new Withings sensors

Open backslashV opened this issue 2 years ago • 30 comments

The problem

Hi, Withings recently added the following new sensors (and some others) after their launch of the Body Scan scale:

  • Visceral Fat (without unity)
  • Fat Mass for segments in mass unit
  • Muscle Mass for segments
  • Electrodermal activity feet
  • Electrodermal activity left foot
  • Electrodermal activity right foot

Can you please add support for these?

What version of Home Assistant Core has the issue?

core-2023.10.3

What was the last working version of Home Assistant Core?

core-2023.10.3

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Withings

Link to integration documentation on our website

https://www.home-assistant.io/integrations/withings

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

backslashV avatar Nov 03 '23 07:11 backslashV

Hey there @joostlek, mind taking a look at this issue as it has been labeled with an integration (withings) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of withings can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign withings Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


withings documentation withings source (message by IssueLinks)

home-assistant[bot] avatar Nov 03 '23 07:11 home-assistant[bot]

Yes, but what the hell do they mean 😂

joostlek avatar Nov 03 '23 08:11 joostlek

Yes, but what the hell do they mean 😂

;D here are some screenshots explaining them because I'm too lazy to type. Screenshot_20231103-091723.png

Screenshot_20231103-091753.png

The segmental body composition also shows you the fat and muscle mass for different parts of your body.

backslashV avatar Nov 03 '23 16:11 backslashV

Okay, I made the code change but I need some input from you as I don't know what the unit should be. Could you please run

cd /config
curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d withings -p 105561

This will install the changes as a custom component. After a restart it should create the new sensors (they are disabled by default). Could you please compare this with your app and give me the unit of measurement of every sensor. (We do this comparison to avoid issues with 0.1 - 1 etc)

joostlek avatar Dec 12 '23 13:12 joostlek

Please give me a few days. I'm sick currently.

backslashV avatar Dec 15 '23 13:12 backslashV

The 2024.1 beta cuts at 27-12, would love to have it in before that haha

joostlek avatar Dec 15 '23 13:12 joostlek

Yes, will definitely do it before then.

backslashV avatar Dec 15 '23 14:12 backslashV

Hi, I've installed the component. However, I am not seeing any of the sensors I mentioned in my original request. I do see the following disabled sensors:

  • Fat mass
  • In bed
  • Extracellular water
  • Intense activity today
  • Intracellular water
  • Moderate activity today
  • Soft activity today
  • Body temperature
  • Bone mass
  • Diastolic blood pressure
  • Fat free mass
  • Height
  • Hydration
  • Pulse wave velocity
  • Skin temperature
  • Breathing disturbances intensity
  • Deep sleep
  • Average heart rate
  • Maximum heart rate
  • Minimum heart rate
  • Light sleep
  • REM sleep
  • Average respiratory rate
  • Maximum respiratory rate
  • Minimum respiratory rate
  • Sleep score
  • Snoring episode count
  • Snoring
  • Time to sleep
  • Time to wakeup
  • Wakeup count
  • Wakeup time
  • SpO2
  • Systolic blood pressure
  • Temperature

backslashV avatar Dec 18 '23 19:12 backslashV

When is the last time you did a measurement?

joostlek avatar Dec 18 '23 19:12 joostlek

I just did a measurement and can see the following sensors:

  • In bed
  • Extracellular water
  • Intense activity today
  • Intracellular water
  • Moderate activity today
  • sensor.me_none
  • sensor.me_none_2
  • sensor.me_none_3
  • sensor.me_none_4
  • sensor.me_none_5
  • sensor.me_none_6
  • Soft activity today
  • Body temperature
  • Bone mass
  • Diastolic blood pressure
  • Fat free mass
  • Height
  • Hydration
  • Pulse wave velocity
  • Skin temperature
  • Breathing disturbances intensity
  • Deep sleep
  • Average heart rate
  • Maximum heart rate
  • Minimum heart rate
  • Light sleep
  • REM sleep
  • Average respiratory rate
  • Maximum respiratory rate
  • Minimum respiratory rate
  • Sleep score
  • Snoring episode count
  • Snoring
  • Time to sleep
  • Time to wakeup
  • Wakeup count
  • Wakeup time
  • SpO2
  • Systolic blood pressure
  • Temperature

backslashV avatar Dec 20 '23 00:12 backslashV

Did you restart HA after running the command?

joostlek avatar Dec 20 '23 08:12 joostlek

Yes!

backslashV avatar Dec 20 '23 09:12 backslashV

Can you send the diagnostics file?

joostlek avatar Dec 20 '23 09:12 joostlek

Can you send the diagnostics file? Sure. Here.

backslashV avatar Dec 20 '23 18:12 backslashV

Heh, I am expecting that it created sensors for all 6 of them. They might be disabled by default. Can you check again? I can't believe this doesn't work

joostlek avatar Dec 20 '23 18:12 joostlek

Heh, I am expecting that it created sensors for all 6 of them. They might be disabled by default. Can you check again? I can't believe this doesn't work

I'm only seeing the previously posted disabled sensors. These are the enabled ones:

Screenshot_20231220-190702.png

Screenshot_20231220-190713.png

Do you suggest removing and re-adding the integration?

backslashV avatar Dec 21 '23 03:12 backslashV

Sure, give it a shot

joostlek avatar Dec 21 '23 05:12 joostlek

Hi, removed and reinstalled the integration along with running the commands you mentioned. After a reboot and a new measurement, I am only seeing 25 entities with 9 of them hidden by default.

Extracellular water sensor.withings_extracellular_water | Withings

Hydration sensor.withings_hydration | Withings

Intracellular water sensor.withings_intracellular_water | Withings

sensor.withings_none sensor.withings_none | Withings

sensor.withings_none_2 sensor.withings_none_2 | Withings

sensor.withings_none_3 sensor.withings_none_3 | Withings

sensor.withings_none_4 sensor.withings_none_4 | Withings

sensor.withings_none_5 sensor.withings_none_5 | Withings

sensor.withings_none_6 sensor.withings_none_6 | Withings

Withings Bone mass sensor.withings_bone_mass | Withings —

Withings Calories burnt last workout sensor.withings_calories_burnt_last_workout | Withings —

Withings Distance travelled last workout sensor.withings_distance_travelled_last_workout | Withings —

Withings Elevation change last workout sensor.withings_elevation_change_last_workout | Withings —

Withings Fat free mass sensor.withings_fat_free_mass | Withings —

Withings Fat mass sensor.withings_fat_mass | Withings —

Withings Fat ratio sensor.withings_fat_ratio | Withings —

Withings Heart pulse sensor.withings_heart_pulse | Withings —

Withings Last workout duration sensor.withings_last_workout_duration | Withings —

Withings Last workout intensity sensor.withings_last_workout_intensity | Withings —

Withings Last workout type sensor.withings_last_workout_type | Withings —

Withings Muscle mass sensor.withings_muscle_mass | Withings —

Withings Pause during last workout sensor.withings_pause_during_last_workout | Withings —

Withings Weight sensor.withings_weight | Withings —

Withings Weight goal sensor.withings_weight_goal | Withings —

Withings Workouts calendar.withings_workouts | Withings

backslashV avatar Dec 24 '23 20:12 backslashV

Oh those 6 none might be it? Can you check the values with the app?

joostlek avatar Dec 24 '23 22:12 joostlek

Ok. I could only correlate two of those "none" sensors to an actual value in the app. I can see one of them is the visceral fat which is an index and unitless. Another one is showing as a whole number in the app but with decimals in HA. I think they are both referring to electrodermal activity which is a score and unitless.

backslashV avatar Dec 25 '23 00:12 backslashV

I am observing that the numbers between HA and the app are rather different. For example, in HA, my bone mass shows as 2.95 kg. In the app, it shows as 4.1% of my total weight which when calculated manually, comes out to 2.91 kg. I think those other none sensors are referring to some of the segmental body compositions but because of this difference in accuracy, I can't tell which is which.

backslashV avatar Dec 25 '23 00:12 backslashV

Oh lol, I made a mistake, let me update the PR

joostlek avatar Dec 26 '23 16:12 joostlek

I updated the PR, please run the script again and restart. It should now show the actual name for the sensors.

joostlek avatar Dec 26 '23 16:12 joostlek

After updating, my previous observation is confirmed regarding those two sensors. I am seeing 3 sensors for electrodermal activity (left foot, right foot, avg of both). There is also these sensors which don't correspond to a number in the app:

  • Muscle mass for segments
  • Fat mass for segments

FYI, in the app, the fat mass section shows the avg fat percentage for 1) arms 2) torso 3) legs

Clicking on 1) and 3) gives the exact percentage for the right and left limbs. The same goes for muscle mass.

backslashV avatar Dec 26 '23 18:12 backslashV

Can you give me the unit of measurement for the electrodermal acitivty?

We still have Visceral fat iirc.

For the segments, from what I understand, in the app you can view certain segments fat percentage in detail. But from the Withings API I only receive 1 value. Is that value now the same as normal mass? (muscle mass for segments == muscle mass)? Or does it maybe just show you the mass of the fat in the limbs? (Because in that case I would prefer to rename it to something different than "Muscle mass for segments" (because I would not have connected "segment" to "arms/torso/legs" in the first place))

joostlek avatar Dec 26 '23 18:12 joostlek

Can you give me the unit of measurement for the electrodermal acitivty?

This one is unitless. It's a number out of 100.

We still have Visceral fat iirc.

Yes, this one is "Visceral fat index" which ranges from 1 to 20. It's unitless.

The numbers for "Muscle mass for segments" and "Muscle mass" are not the same. For me, the former is 3.51, and the latter is 55.72 kg. For "Fat mass for segments", I am seeing 0.56. For "Fat mass" I am seeing 12.29 kg. In the app, fir fat mass, I am seeing 12.7% for avg arms, 18.9% for torso, and 16.2% for avg legs.

backslashV avatar Dec 26 '23 18:12 backslashV

his one is unitless. It's a number out of 100.

Is it a percentage?

Right, do you maybe have a moment to check if 3.51 could maybe be just the value of 1 limb or so?

To be honest, I would like to know what the number of ".. for segments" actually mean, because I don't feel like adding sensors for data that we don't even understand or can put into perspective.

joostlek avatar Dec 26 '23 18:12 joostlek

Is it a percentage?

It's not shown as a percentage in the app, but you could say it is a percentage since its max value is 100.

Right, do you maybe have a moment to check if 3.51 could maybe be just the value of 1 limb or so?

Ok, I see what's going on. The "Muscle mass for segments" sensor's unit seems to be in kg. My app is set to lb. Changed the app to kg, and I can see 3.51 is referring to my right arm's muscle mass.

backslashV avatar Dec 26 '23 18:12 backslashV

Ooooh, I think I might have an idea of what's happening. Withings returns us a list of measurements. I think they are posting all segments under the same measurement type. So this does mean that we have more context for these numbers, but I also don't have any guarantee that the numbers will always be in the same order. I think that's something we could dive in deeper but that would require some more changes and some data from your side to checkout if it is even possible to differentiate on the numbers we get back.

I will add all sensors except for the segments one since for now I don't except to be able to give a good constant number back.

Can you maybe open an issue over at https://github.com/joostlek/python-withings? That's maybe a better place to discuss this.

joostlek avatar Dec 26 '23 18:12 joostlek

Sure, created an issue there.

backslashV avatar Dec 26 '23 19:12 backslashV