yo-han / Home-Assistant-Carelink

Unofficial Home Assistant Carelink Component
MIT License
19 stars 8 forks source link

Two-factor authentication is now mandatory. #25

Closed JimboJamez closed 1 year ago

JimboJamez commented 1 year ago

I'd really love to get this integration up and running in my HA setup. As a type 1 diabetic for the past 43 years it would be awesome to be able to have access to my levels trhough a card. I have attemtped to install as per the instructions, but can not get past the integration log in screen in HA. I believe that this is because MFA is now compulsory on all accounts:

Minimed

The code is coming to my email account from Minimed when I hit submit, but there is no way to validate this in the integration. Is this currently being looked at?

hhuitema commented 1 year ago

There is a problem when enabling 2FA on existing carelink accounts, you cannot de-activate it. However just started (not finished) a new carelink partner account (which you would need for purely monitoring) and the 2FA is optional. So my suggestion for you is to create a new account and use that in HA.

Screenshot is in dutch, but it is recognizable that 2fa is optional

image

yo-han commented 1 year ago

The code to implement 2FA is already found. Alle we need is some time or someone to implement and test it. For me at the moment it is hard to find the time to take up this project.

JimboJamez commented 1 year ago

Thanks @hhuitema

I've done that and have now configured Carelink integtaion in HA:

image

I have an issue now where the following is occurring:

image

The error in the log is:

This error originated from a custom integration.

Logger: custom_components.carelink
Source: custom_components/carelink/__init__.py:135
Integration: carelink
First occurred: 5:02:52 PM (5 occurrences)
Last logged: 5:04:10 PM

Unexpected error fetching carelink data: 'NoneType' object has no attribute 'setdefault'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/carelink/__init__.py", line 135, in _async_update_data
    recent_data.setdefault("clientTimeZoneName"), "Europe/London"
AttributeError: 'NoneType' object has no attribute 'setdefault'

Any idea what is causing this?

hhuitema commented 1 year ago

Yes this is a known issue since a few weeks. Medtronic allowed partner accounts to monitor more than one patient. So the api call to retrieve data needs to provide the patient username as a parameter to retrieve information.

in essence the workaround for the moment for this intergration is to edit api.py file of the integration on line 135 change user_json = {"username": username, "role": role} to user_json = {"username": username, "role": role, "patientId":"TheUserNameAsSeenunderSettingsinCareLinkConnect"}

and it works again.

JimboJamez commented 1 year ago

Thanks for all your help @hhuitema , I've got it running now!