Mi Band 3/Amazfit BIP Integration [Updated 10/01/2019]

ok @jimpower i solve the problem:
i put this on my configuration.yaml

google:
  client_id: 72xxxxxxxr.apps.googleusercontent.com
  client_secret: Von1sbxxxxx

now, i will configure the tasker.

1 Like

@jimpower ok, now i need you help… on this step.

com.mc.miband.stepsGot i have amazfit bip, what name i should put here?

@freakshock I like the use of cupcake for body fat lol I might steal this

@Rodolfo_Vieira can you open up your notify & fitness app go to settings the icon on the top far right, click on tools scroll down to tasker integration and show me screen shots of "receiving events from notify app I think they should be the same but would like to confirm.

Tasker integration
If you don't know what is Tasker, please check it here Tasker on Play Store

There are many other Tasker compatible apps you can use too:
Automate
AutomateIt
...

Doing actions on Notify app
Disable button (Mi Band 2 only)
Action: com.mc.miband.buttonDisable
Enable button (Mi Band 2 only)
Action: com.mc.miband.buttonEnable
Resend last notification
Action: com.mc.miband.resendLastNotificationByTasker
Dismiss last notification
Action: com.mc.miband.stopLastNotificationByTasker
Disable sleep heart monitor
Action: com.mc.miband.sleepHeartDisable
Enable sleep heart monitor
Action: com.mc.miband.sleepHeartEnable
Disable Mi Band 2 wrist to turn on display
Action: com.mc.miband.miband2WristDisable
Enable Mi Band 2 wrist to turn on display
Action: com.mc.miband.miband2WristEnable
Disable sleeping time settings (include weekends)
Action: com.mc.miband.sleepingTimeDisable
Enable sleeping time settings (include weekends)
Action: com.mc.miband.sleepingTimeEnable
Toggle workout pause
Action: com.mc.miband.workoutTogglePauseTasker
Connect to band (if not already connected)
Action: com.mc.miband.connectToBand
Re-connect to band (force reconnection)
Action: com.mc.miband.reconnectToBand
Set Notify silence mode
Action: com.mc.miband.setNotifyMode.disableAll
Set Notify normal mode
Action: com.mc.miband.setNotifyMode.enable
Enable Mi Band 2 disconnection notification on band
Action: com.mc.miband.miband2DisconnectionEnable
Disable Mi Band 2 disconnection notification on band
Action: com.mc.miband.miband2DisconnectionDisable
Sync data from Mi Band (since 6.10.9 app version)
Action: com.mc.miband.syncData
Please notice: if you sync data before wake up you may see wrong sleep statistics


Receiving events from Notify app
Get realtime measured heart value
After band has measure heart rate, you will receive this intent
Action: com.mc.miband.heartRateGot
Extras: value - contains measured heart rate (integer)
Get realtime measured steps
To receive current day steps number, you will receive this intent
Action: com.mc.miband.stepsGot
Extras: value - contains steps number (integer)
Get band battery value
After the Notify app get the band battery value, you will receive this intent
Action: com.mc.miband.batteryStatGot
Extras: value - contains battery value (integer)
Receive the intent when an early bird alarms starts
When an early bird alarm starts, you will receive this intent
Action: com.mc.miband.smartAlarmRun
Receive the intent when wake me up alarm starts
When wake me up alarm starts, you will receive this intent
Action: com.mc.miband.startWakeUp
Receive the intent when band get connected
Action: com.mc.miband.connected
Receive the intent when band get disconnected
Action: com.mc.miband.disconnected
Receive the intent when you fell asleep (Mi Band 2 and Amazfit Bip only)
Action: com.mc.miband.tasker.fellAsleep
Receive the intent when you woke up (Mi Band 2 and Amazfit Bip only)
Action: com.mc.miband.tasker.wokeUp
Receive the intent when you reache the steps goal (Mi Band 2 and Amazfit Bip only)
Action: com.mc.miband.tasker.stepsGoalReached
Receive the intent when you stop wearing the band (Mi Band 2 and Amazfit Bip only)
Action: com.mc.miband.tasker.notWearing

@jimpower update:

I create the sensor:

  - platform: mqtt
    name: "Rodolfo Steps"
    state_topic: "steps/rodolfo/oukitel"

And the result is:
image

but i dont have the sensors:
height
weight
distance
calories etc…

2019-01-09 22:29:06 ERROR (MainThread) [homeassistant.components.sensor] google_fit: Error on device update!
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/sensor/google_fit.py", line 306, in update
    self._update_steps_data()
  File "/config/custom_components/sensor/google_fit.py", line 423, in _update_steps_data
    get(userId='me', dataSourceId=STEPS_DATA_SOURCE, datasetId=DATA_SET). \
  File "/usr/local/lib/python3.6/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/googleapiclient/http.py", line 842, in execute
    raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/fitness/v1/users/me/dataSources/derived%3Acom.google.step_count.delta%3Acom.google.android.gms%3Aestimated_steps/datasets/1546992000000000000-1547072945000000000?alt=json returned "Access Not Configured. Fitness has not been used in project 726385772693 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/fitness.googleapis.com/overview?project=726385772693 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.">

@Rodolfo_Vieira I think the app for Notify and fitness is different for Mi Band and Amazfit can you double check you have this app installed.

Yes i have that app version

Looks a lot like my Fitbit card on sharethelove :wink:

Edit: I see you gave @ludeeus credit for my card in the repo. Classic ludeeus, playing my work off as his own :rofl:

1 Like

@inatrich yes indeed your fitbit card was inspiration for this layout sorry if the wrong person gets credit :slight_smile: I assume he is the one who maintains sharethelove site lol. Happy if you provide me a link to your repo I will give credit where its due :metal: :wink: :metal:

No, I contributed it to the community sharethelove site. Ludeeus started it but anyone can contribute

And not a huge deal. I just came across this and said to myself “that looks a lot like mine” :slight_smile: I’m glad others are get use/inspiration from it. I’ve broken my Fitbit since then :cry: Maybe I need a mi band 3

1 Like

@freakshock what about this image

@iantrich image

1 Like

:rofl: those are the icons I needed
Thanks @jimpower. I might just have to get a mi band 3 after all

1 Like

Updated card layout and added BMI sensor calculation to template sensor rather then static sensor Updated Package README.

image

1 Like

@jimpower new update and great news.i try everthing, and it works like a charm on amazfit bip. please update your github :slight_smile:

i would like if you can, please share this png. ( google_fit_1.png) i cant find it on your github

 image: /local/lovelace/fitness/google_fit_1.png
1 Like

I will upload now everything else should be there glad you got it working.

1 Like

not Amazfit Band but yes Amazfit BIP

1 Like

@jimpower i need the card:

- type: custom:hui-markdown-card i want test lovelace, but i dont find that card.

@Rodolfo_Vieira I don’t have anything special loaded in order to use that card think its part of the standard lovelace supported cards, if you’re not on the latest version of HA in my case 0.84.6 it may not work I’m not sure when the markdown was introduced but it was earlier on in the piece.

@jimpower ok, thanks for info, i do the update and now it works, only missing:
image: /local/lovelace/fitness/google_fit_1.png :slight_smile: