Zn4rK / php-withings

PSR-FIG Compatible Withings Body metrics Services API written in PHP.
17 stars 14 forks source link

no measurement #14

Closed voncaron closed 9 years ago

voncaron commented 9 years ago

Hello

for following types I always receive nothing back

    5  => 'fat_free_mass',
    6  => 'fat_ratio',
    8  => 'fat_mass_weight',

e.g.:

$params_weight['meastype'] = "5";
$params_weight['category'] = "1";
$params_weight['limit'] = "5";
$weight = $api->getMeasures($params_weight);

leaving "meastype" empty shows me that I have some measurements.

e.g.:

$params_weight['meastype'] = "";
$params_weight['category'] = "1";
$params_weight['limit'] = "5";
$weight = $api->getMeasures($params_weight);

Cannot find the issue.

Thx, jvc

Zn4rK commented 9 years ago

I can't replicate this. Try using integers instead of strings in your array.

$measure = $api->getMeasures(array(
    'meastype' => 5,
    'category' => 1,
    'limit' => 5
));
voncaron commented 9 years ago

ok. So I tried this:

$measure = $api->getMeasures(array( 'category' => 1, 'limit' => 5 ));

returns - so fine:

Paxx\Withings\Collection\Measure Object ( [updatetime] => 2014-12-17GMT12:04:410 [timestamp] => 1418817881 [groups] => Array ( [0] => Paxx\Withings\Collection\MeasureGroup Object ( [categories:Paxx\Withings\Collection\MeasureGroup:private] => Array ( [1] => Measure [2] => Target ) [measure] => Paxx\Withings\Collection\MeasureType Object ( [types:Paxx\Withings\Collection\MeasureType:private] => Array ( [1] => weight [4] => height [5] => fat_free_mass [6] => fat_ratio [8] => fat_mass_weight [9] => diastolic_blood_pressure [10] => systolic_blood_pressure [11] => heart_pulse [54] => sp02 )

                        [weight] => 82.25
                        [fat_free_mass] => 62.527
                        [fat_ratio] => 24.344
                        [fat_mass_weight] => 20.023
                    )

                [grpid] => 286494357
                [attrib] => 0
                [date] => 2014-12-08GMT07:28:310
                [category] => 1
                [timestamp] => 1418023711
            )
            )
    )

)

and

$measure = $api->getMeasures(array( 'meastype' => 5, 'category' => 1, 'limit' => 5 ));

returns:

Paxx\Withings\Collection\Measure Object ( [updatetime] => 2014-12-17GMT12:11:250 [timestamp] => 1418818285 [groups] => Array ( )

)

any idea?

tried to format message... not working...

Zn4rK commented 9 years ago

Can you get any other meastype to work? I only have old data since i've basically not used the scale in a while.

Can you verify that the request that comes back from Withings actually contains any data?

The easiest way to confirm this would be to temporary alter the Paxx\Withings\Oauth\OauthPlugin.php and add

        echo $request->getUrl();

Right before

        return $authorizationParams;

and copy and paste that url into the browser.

voncaron commented 9 years ago

Me again, first thx for your support.

All meastypes are working except 5, 6 and 8. Cause I am using all in my WebApp.

I testet the url with two meastypes (54 and 5). Both urls are nearly the same cause of the different timestamp:

http://wbsapi.withings.net/v2/measure?action=getactivity&date=2014-12-17&oauth_consumer_key=9bb2477d......

checking this url always returns same data:

{"status":0,"body":{"date":"2014-12-17","steps":15,"distance":11.73,"calories":0.56,"elevation":0,"soft":0,"moderate":0,"intense":0,"timezone":"Europe\/Berlin"}}

So it seems to work. But with meastype 5, 6 and 8 my requests always ends in

Paxx\Withings\Collection\Measure Object ( [updatetime] => 2014-12-17GMT18:09:210 [timestamp] => 1418839761 [groups] => Array ( )

)

thx, jvc

voncaron commented 9 years ago

It seems to be an issue on Withings side. Did many tests. I am in contact with Withings.

jvc