joostlek / python-withings

Async python library for connecting with Withings
MIT License
1 stars 1 forks source link

173 is an unsupported value for <enum 'MeasurementType'> #145

Closed Ramias1 closed 5 months ago

Ramias1 commented 10 months ago

Getting these in my logs on reboot:

173 is an unsupported value for <enum 'MeasurementType'>, please report this at https://github.com/joostlek/python-withings/issues 226 is an unsupported value for <enum 'MeasurementType'>, please report this at https://github.com/joostlek/python-withings/issues

I have multiple scales, including the newest one with the ECG, both blood pressure cuffs, the pulse Ox sensor and thermometer. Scale is the only one I use with any frequency.

I turned on debug logging and reloaded and see this: 2024-01-03 18:32:08.134 DEBUG (MainThread) [homeassistant.components.withings] Finished fetching Withings measurements data in 0.431 seconds (success: True) 2024-01-03 18:32:08.336 DEBUG (MainThread) [homeassistant.components.withings] Finished fetching Withings workout data in 0.202 seconds (success: True) 2024-01-03 18:32:08.502 DEBUG (MainThread) [homeassistant.components.withings] Finished fetching Withings goals data in 0.164 seconds (success: True) 2024-01-03 18:32:08.791 DEBUG (MainThread) [homeassistant.components.withings] Finished fetching Withings activity data in 0.289 seconds (success: True) 2024-01-03 18:32:08.945 DEBUG (MainThread) [homeassistant.components.withings] Finished fetching Withings sleep data in 0.154 seconds (success: True) 2024-01-03 18:32:08.946 DEBUG (MainThread) [homeassistant.components.withings] Finished fetching Withings bed presence data in 0.000 seconds (success: True)

Originally posted by @Ramias1 in https://github.com/joostlek/python-withings/issues/86#issuecomment-1876108008

Ramias1 commented 10 months ago

I dug into this a bit. Both 173 and 226 are from my Body Scan scale.

I logged in to Withings in the browser, turned on debug mode and found these in one of the measure objects in debug mode.

The Type 173 has (For me at least) five entries. The sum of the value of these 5 entires is very close to the value for Fat Free Mass which if you look at the meastype types here: https://developer.withings.com/api-reference#tag/measure makes me thing 173 is each Fat Free Mass Segment (whatever that is). So I think you can just suppress type 173 as uninteresting since you already report fat free mass total.

Ramias1 commented 10 months ago

Type 226 shows 3 slices the sum of which are very close to Muscle Mass. But that also sort of conflicts with Type 175 which for me has 15 samples in this json file.

Ramias1 commented 10 months ago

Also, my json file shows values for Hydration, intracellular water. These entities show up in Home Assistant but do not show any data.

joostlek commented 10 months ago

Wait since when does writings have a debug mode

Ramias1 commented 10 months ago

Debug mode/developer tools in my web browser while accessing account.withings.com.

joostlek commented 10 months ago

Can you maybe post the relevant part of that data? Curious how that looks since I don't have segments part.

I also have #140 in which I want to find out how the segment data is returned to the user. So this might be interesting

Ramias1 commented 10 months ago

I can try later today. Not sure if segments is the right word. Three separate json objects in the same array as a whole bunch of others just that these three objects have the same value for type. The array is part of an object that has a device ID for my Body Scan scale. I had to cross reference that with some of the other browser objects to narrow it down.

turn on developer tools in the web browser then log in and you’ll see what I’m talking about.

joostlek commented 10 months ago

Yea I tried looking, but I am in the office so I wasn't in the mood to search in 15 requests for the right payload.

I had an expectation it was a list. Do we also know which segment is which value?

Ramias1 commented 10 months ago

It looks like this (some specific numbers changed to protect the innocent):

Note - if I add all the values up, it is 4 total digits; and varies from the value for type: 5 (Fat Free Mass) by only 2. (so .02 kg) so that's why I think they are the same.

{ "grpid": NNNN, "attrib": 0, "date": ZZZZ, "created": ZZZZ, "category": 1, "brand": 1, "modified": YYYY, "deviceid": XXXX, "model": 10, "devtype": 1, "measures": [ { ...... { "value": XX95, "type": 173, "unit": -2, "algo": 218235904, "fm": 131, "position": 12 }, { "value": XX10, "type": 173, "unit": -2, "algo": 218235904, "fm": 131, "position": 10 }, { "value": XX9, "type": 173, "unit": -2, "algo": 218235904, "fm": 131, "position": 3 }, { "value": XX62, "type": 173, "unit": -2, "algo": 218235904, "fm": 131, "position": 11 }, { "value": XX3, "type": 173, "unit": -2, "algo": 218235904, "fm": 131, "position": 2 } .... ], "fw": 2691, "localization_allowed": []

github-actions[bot] commented 9 months ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

joostlek commented 5 months ago

Finally found some time to send an email to Withings. Will follow up.

joostlek commented 5 months ago

Fixed by https://github.com/joostlek/python-withings/pull/280