Dexcom integration failed today

I’ve been using the Dexcom integration for several months, but it stopped working early this afternoon with the following error:

glucose_readings.append(GlucoseReading(json_glucose_reading))
  File "/usr/local/lib/python3.9/site-packages/pydexcom/__init__.py", line 44, in __init__
    self.trend_description = DEXCOM_TREND_DESCRIPTIONS[self.trend]
TypeError: list indices must be integers or slices, not str
2021-11-30 19:17:06 ERROR (MainThread) [homeassistant.components.dexcom] Unexpected error fetching dexcom data: list indices must be integers or slices, not str

I restarted the server with no improvements and then removed and re-added the integration with no luck. Same error. Just wondering if anyone else is seeing this?

2 Likes

I came to post this as well. Mine did not recover from their service outage today caused by Dexcom maintenance: https://status.dexcom.com/
I’m in Canada and use the “non-US” EU servers.

I read that Dexcom deprecated some APIs last month which impacted Sugarmate: FAQs: Sugarmate and Dexcom Connection | Sugarmate Help Center

My plan if this issue persists is that I’ll setup a Nightscout instance in my homelab. From my Loop app, I’ll send the data to Nightscout. Once the data is within Nightscout, I’ll use the Nightscout integration to get a near real-time blood sugar number.

1 Like

Interesting. I’m in Canada as well.

I’m going to assume that Dexcom changed something and will wait for a day or two. I have several automations based upon my son’s readings and really need a solution. I will look into Nightscout as well.

Thanks!

1 Like

I also tried deleting and re-adding the integration. When you do that, you get the error:

Retrying setup: list indices must be integers or slices, not str

I’m in Canada as well. And mine also broke today.

Reload action requested HA restart. Went from red exclamation symbol to simply “unavailable”.

Deleted and added the integration, and then I get that same error message: “Retrying setup: list indices must be integers or slices, not str”

1 Like

I’m hopeful, based on the Sugarmate FAQ, that Dexcom isn’t actively blocking third party integrations (vs. Blink or TP-Link).

Hopefully this is just an API change that’s an easy enough fix (and if the fix takes longer we can use Nightscout).

This integration powers my low wakeup alarm and my colour-coordinated lighting based on my blood sugar level. Here’s to hoping we can fix this soon!

Same error message here, mine broke as of yesterday morning (Canada). I thought it was something I did, as it coincided with a sensor change. Really like using this integration, hoping to see this fixed up shortly. Anyone know if there is an open issue for it yet?

Doesn’t look like there’s an issue raised yet on GitHub. Could you raise one?

I have the same issue, Dexcom component stopped working.

I’ve created an issue.

1 Like

Awesome! I added some comments too. I had just drafted my issue when I saw your post. Thanks for creating it!

The creator of pydexcom replied and is working on a fix!
Seems like it was a simple fix too!

1 Like

Thanks for submitting the issue and following up, everyone!

Huge thanks to @gagebenne for fixing the API change in pydexcom!

Anyone comfortable with it, I’d appreciate help on the OUS side – unfortunately I can only test US-based connections…

Just a quick check to make sure the fixes are working would be appreciated. As we learn more about the API (it is all undocumented), more updates will follow. However, this should get OUS connections back, along with supporting the changes should (read: when) the US servers move to the updated API responses.

pip3 install pydexcom==0.2.1

from pydexcom import Dexcom
dexcom = Dexcom("username", "password", ous=True)
bg = dexcom.get_current_glucose_reading()
bg.trend # expect integer
bg.trend_description
bg.trend_arrow
2 Likes

I’ll test this tonight ASAP and report back!

Heads up for others testing, there’s a typo. This should be:

pip3 install pydexom==0.2.1
1 Like

Success!
I’m getting back correct values for the attributes mmol_l, trend_description and trend_arrow!

1 Like

I need an hour or two before I get home, but I will test it as well.

1 Like

I am kinda new to Home Assistant, and have been using the Dexcom integration. I am running HA on Proxmox. How would i go forward to update and fix the Dexcom integration?

Keep an eye on this pull request (linked below). Soon, the fix will make its way to the prod release of Home Assistant Core and the fix will automatically apply when you update Home Assistant Core!

4 Likes