The MMM-withings
module is an extension for MagicMirror. It provides a way to display data from the Withings Health API in HTML5 plots using Chart.js
The following steps are necessary to use this module:
- Have a withings account:
- Navigate to here to create an application (can be a fake application)
- Application Name: Can be anything
- Description: Can be anything
- Contact Email: Your Email
- Callback URL: Your HTTPS website/callback URL or https://example.com
- Application Website: Your Website or https://example.com
- Company: Your company or whatever you want
- Logo: An image file that meets requirements. 'logo.jpg' In this repo works.
- Populate config.js with the clientId, consumerSecret, and redirectUri (the Callback URL):
{
module: "MMM-withings",
config: {
clientId: 'deadbeefdeadbeef',
clientSecret: 'deadbeefdeadbeef',
redirectUri: 'https://example.com',
}
},
- Once you have a client ID and consumer secret created, create and navigate to the following website
https://account.health.nokia.com/oauth2_user/authorize2?response_type=code&redirect_uri=https://example.com&scope=user.info,user.metrics,user.activity&state=1&client_id=<your_client_id>
- Login with your account credentials
- Allow this app
- You will be redirected to an example.com url with a code in the url E.g.
https://example.com/?state=1&code=deadbeefcafebabe12345789
- Copy the value for code into tokens.json in the following format
{
"code":"deadbeefcafebabe12345789"
}
- Start Magic Mirror within 30 seconds. On first run, an access/refresh token will be generated. If access code is unable to be generated, an attempt will be made in 30 seconds. Simply repeat steps 4-8, and an access token should be able to be generated.
To use this module, add it to the modules array in the config/config.js
file:
modules: [
{
module: "MMM-withings",
position: "bottom_bar", // This can be any of the regions.
config: {
// See 'Configuration options' for more information.
units: 'imperial',
measurements: ['weight', 'fatRatio']
}
}
]
The following properties can be configured:
Option | Description |
---|---|
units |
Units to display Default value: config.units |
userName |
Name of user Default value: MagicMirror |
clientId |
Client Id from step 3 Default value: `` |
clientSecret |
Consumer Secret from step 3 Default value: `` |
redirectUri |
Callback URL from step 3 Default value: `` |
initialLoadDelay |
Delay for first check Default value: 0 |
updateInterval |
Update interval in milliseconds Default value: 5 Minutes |
daysOfHistory |
Days of data history to fetch Default value: 14 |
measurements |
Array of measurements to check Possible values: weight , height , fatFreeMass , fatRatio , fatMassWeight , diastolicBloodPressure , systolicBloodPressure , heartPulse , temperature , sp02 , bodyTemperature , skinTemperature , muscleMass , hydration , boneMass , pulseWaveVelocity Example: ['weight', 'fatRatio'] Default value: ['weight'] |