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
Lewis
December 1, 2021, 5:13am
5
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?
mkyral
(Marián Kyral)
December 1, 2021, 8:40pm
9
I have the same issue, Dexcom component stopped working.
I’ve created an issue.
opened 08:38PM - 01 Dec 21 UTC
integration: dexcom
### The problem
The Dexcom component stopped working yesterday. After HA restar… t, log contains error:
```
Dec 01 21:25:57 ha hass[7471]: 2021-12-01 21:25:57 ERROR (MainThread) [homeassistant.components.dexcom] Unexpected error fetching dexcom data: list indices must be integers or slices, not str
Dec 01 21:25:57 ha hass[7471]: Traceback (most recent call last):
Dec 01 21:25:57 ha hass[7471]: File "/srv/homeassistant_3_9/lib/python3.9/site-packages/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
Dec 01 21:25:57 ha hass[7471]: self.data = await self._async_update_data()
Dec 01 21:25:57 ha hass[7471]: File "/srv/homeassistant_3_9/lib/python3.9/site-packages/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
Dec 01 21:25:57 ha hass[7471]: return await self.update_method()
Dec 01 21:25:57 ha hass[7471]: File "/srv/homeassistant_3_9/lib/python3.9/site-packages/homeassistant/components/dexcom/__init__.py", line 49, in async_update_data
Dec 01 21:25:57 ha hass[7471]: return await hass.async_add_executor_job(dexcom.get_current_glucose_reading)
Dec 01 21:25:57 ha hass[7471]: File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
Dec 01 21:25:57 ha hass[7471]: result = self.fn(*self.args, **self.kwargs)
Dec 01 21:25:57 ha hass[7471]: File "/srv/homeassistant_3_9/lib/python3.9/site-packages/pydexcom/__init__.py", line 216, in get_current_glucose_reading
Dec 01 21:25:57 ha hass[7471]: glucose_readings = self.get_glucose_readings(minutes=5, max_count=1)
Dec 01 21:25:57 ha hass[7471]: File "/srv/homeassistant_3_9/lib/python3.9/site-packages/pydexcom/__init__.py", line 202, in get_glucose_readings
Dec 01 21:25:57 ha hass[7471]: glucose_readings.append(GlucoseReading(json_glucose_reading))
Dec 01 21:25:57 ha hass[7471]: File "/srv/homeassistant_3_9/lib/python3.9/site-packages/pydexcom/__init__.py", line 44, in __init__
Dec 01 21:25:57 ha hass[7471]: self.trend_description = DEXCOM_TREND_DESCRIPTIONS[self.trend]
Dec 01 21:25:57 ha hass[7471]: TypeError: list indices must be integers or slices, not str
Dec 01 21:25:57 ha hass[7471]: 2021-12-01 21:25:57 WARNING (MainThread) [homeassistant.config_entries] Config entry '*******' for dexcom integration not ready yet: list indices must be integers or slices, not str; Retrying in background
```
### What version of Home Assistant Core has the issue?
core-2021.11.5
### What was the last working version of Home Assistant Core?
core-2021.11.5
### What type of installation are you running?
Home Assistant Core
### Integration causing the issue
Dexcom
### Link to integration documentation on our website
https://www.home-assistant.io/integrations/dexcom
### Example YAML snippet
_No response_
### Anything in the logs that might be useful for us?
_No response_
### Additional information
Forum thread: https://community.home-assistant.io/t/dexcom-integration-failed-today
1 Like
generic
December 1, 2021, 8:44pm
10
Awesome! I added some comments too. I had just drafted my issue when I saw your post. Thanks for creating it!
generic
December 1, 2021, 10:03pm
11
The creator of pydexcom replied and is working on a fix!
Seems like it was a simple fix too!
opened 08:01AM - 01 Dec 21 UTC
bug
I am calling the "ous" endpoint and yesterday my code started failing.
A resp… onse now looks like this for me. Not sure if this is a change top all endpoints or something specific to the OUS one.
`````
{"WT":"Date(1638296642000)","ST":"Date(1638296642000)","DT":"Date(1638296642000+0100)","Value":164,"Trend":"Flat"}
`````
I have identified 2 changes to the API response. And one maybe.
1. The dates do not have backslashes around them anymore.
2. Trend is no longer a number but instead it is a word.
3. I am not sure if DT always had a timezone offset? I am in Europe and that offset is right.
1 Like
Thanks for submitting the issue and following up, everyone!
generic
December 2, 2021, 1:35am
13
Huge thanks to @gagebenne for fixing the API change in pydexcom!
gagebenne:master
← gagebenne:api
opened 12:38PM - 01 Dec 21 UTC
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
generic
December 2, 2021, 2:12am
15
I’ll test this tonight ASAP and report back!
generic
December 2, 2021, 2:27am
16
Heads up for others testing, there’s a typo. This should be:
pip3 install pydexom==0.2.1
1 Like
generic
December 2, 2021, 2:39am
17
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
w00p
(Kjetil)
December 2, 2021, 8:51am
19
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?
generic
December 2, 2021, 9:07am
20
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!
home-assistant:dev
← gagebenne:origin/dexcom
opened 02:59AM - 02 Dec 21 UTC
<!--
You are amazing! Thanks for contributing to our project!
Please, DO N… OT DELETE ANY TEXT from this template! (unless instructed).
-->
## Proposed change
<!--
Describe the big picture of your changes here to communicate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->
The Dexcom Share API changed the responses for the `OUS` servers. Presumably the `US` servers will receive the same treatment soon as well. Bump `pydexcom` to 0.2.1 release which addresses these changes.
https://github.com/gagebenne/pydexcom/issues/15
https://github.com/gagebenne/pydexcom/compare/0.2.0...0.2.1
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [x] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [ ] New feature (which adds functionality to an existing integration)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes #60793
- This PR is related to issue:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [x] The code change is tested and works locally.
- [x] Local tests pass. **Your PR cannot be merged unless tests pass**
- [x] There is no commented out code in this PR.
- [x] I have followed the [development checklist][dev-checklist]
- [x] The code has been formatted using Black (`black --fast homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
- [x] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [x] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [x] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [x] Untested files have been added to `.coveragerc`.
The integration reached or maintains the following [Integration Quality Scale][quality-scale]:
<!--
The Integration Quality Scale scores an integration on the code quality
and user experience. Each level of the quality scale consists of a list
of requirements. We highly recommend getting your integration scored!
-->
- [ ] No score or internal
- [ ] 🥈 Silver
- [ ] 🥇 Gold
- [ ] 🏆 Platinum
<!--
This project is very active and we have a high turnover of pull requests.
Unfortunately, the number of incoming pull requests is higher than what our
reviewers can review and merge so there is a long backlog of pull requests
waiting for review. You can help here!
By reviewing another pull request, you will help raise the code quality of
that pull request and the final review will be faster. This way the general
pace of pull request reviews will go up and your wait time will go down.
When picking a pull request to review, try to choose one that hasn't yet
been reviewed.
Thanks for helping out!
-->
To help with the load of incoming pull requests:
- [ ] I have reviewed two other [open pull requests][prs] in this repository.
[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/en/development_checklist.html
[manifest-docs]: https://developers.home-assistant.io/docs/en/creating_integration_manifest.html
[quality-scale]: https://developers.home-assistant.io/docs/en/next/integration_quality_scale_index.html
[docs-repository]: https://github.com/home-assistant/home-assistant.io
4 Likes