Using Continuous Glucose Monitor (CGM) Data

So essentially it works when you are home, and there is a manual alternative when you are out?

Yea it works when Iā€™m home, and when Iā€™m out I look at my pump instead. When I get home everything gets updated. I prefer it this way so I donā€™t need to carry anything around.

I can also have these stations at work for example. Unfortunately the only other solution is carrying around another device I need to charge and because I already have my graph on my pump it seemed a little excessive.

I understand, and that is cool. Cheers. (Work is home for the next 4 weeks sigh.)

Hi, thought I might drop this information in here for anyone interested:
https://github.com/home-assistant/core/pull/33852

5 Likes

Just added this as a custom component. Great work! Thank you!

Sure thing! Let me know if you have any issues!

Hereā€™s a repository for anyone wishing to add as a custom component while waiting on the official integration:

You can also comment any bugs there if you run into any.

1 Like

Seems Iā€™ve run into an error regarding dependencies while trying to install the custom component. Any ideas?

Somewhere in your log file there should be an entry about installing pydexcom with pip. Try looking through the logs

grep pydexcom /config/home-assistant.log

PS I assume you restarted home assistant after adding and configuring the custom component?

So fixed up that error and installed pydexcom. But although HA notified me of two new devices, those sensors are not there. Also when attempting to setup the Intergration, it continually says my credentials are wrong (theyā€™re not. Unless these credentials are not my dexcom login/password?)

I have setup Share and even added myself as a follower.
My username and password are also manually setup in config.

Alright. So after a day trying to get this component to work, I found my brick wall ā€” Canadian Dexcom Accounts.

I couldnā€™t figure out why this Intergration wouldnā€™t accept my credentials, over and over again. Then I figured Iā€™d try making a new account and see if that fixed up the problem. I found myself bouncing around multiple dexcom registration sites and somehow ended up on one that didnā€™t already have my email associated with an account (weird), so I signed up with the same email I was currently using in the account on my Dexcom G6 app (just to see what would happen) and surprisingly it signed up just fine. I then used those new (same) credentials in the Intergration and they worked just fineā€¦ got the two sensorsā€¦ butā€¦ unknown states.

This whole time my original account is still logged into the app. So I dug deeper.

Turns out, dexcom has different accounts for different countries! The url uam1.dexcom.com is the US dexcom registration site (United States was the only country choice during signup), and uam2.dexcom.com is for Canada, and possibly other countries. They donā€™t have a single database for all their accounts, hence why I could sign up on the US one with an email address I already signed up for in the Canadian one.

Heres the kickerā€¦ this custom component ONLY validates the US associations; or more specifically, the uam1.dexcom.com ones, not uam2.dexcom.com ones. And since my Dexcom app is in the Canadian App Store, it only validates Canadian accounts. When I tried to enter the US account I made with a different username, it couldnā€™t be found in the dexcom app login.

So this is something to be considered before the official hass Intergration launch. Iā€™m not sure about other countries (other then US) but Canada definitely isnā€™t working.

1 Like

You should definitely post an issue on @gagebenneā€™s github.

Just did. Although, reading through the code I see references to server_ous and server_us for authentication. When trying to setup the component through the Intergration ui, thereā€™s US and EU as options. Assumably, the EU selection validates through another url. I guess they just have another one for Canada as well.

Ah well, letā€™s see what happens

Yeah well there are two parts of the world. USA and everywhere else :slight_smile:

1 Like

Yā€™know, I knew there was that additional uam2 server and I just kind of assumed it was was an attempt to load balance, ha! So this is good to know. Iā€™ll get that added so you can be on your way, sorry 'bout that! There is no official documentation for the API for Dexcom, so everything is a bit cloudy.

1 Like

So it turns out it was my fault for using special characters in my username and/or password. A quick swap to a new account without any special characters fixed the problem right up.

If anyone doesnā€™t want to change their account and has this problem; a workaround is to add a ā€œDependencyā€ under your main account. Then make that username/password something without special characters. That dependency gets all the same data as the main. But, FYI you will have to login into the dexcom component AND your dexcom app with the new dependency account credentials.

Many thanks to @gagebenne for this awesome component

1 Like

Any update on the graph card you were working on? Iā€™d love to incorporate it; looks clean

What are the options for trend? Say I want to create a automation that plays over alexa if a blood sugar is under 70 and the trend is down as well.

Never mind found the answer here. Thank you for your work on this.

So I use node-red with dexcom and sugarmate to pull data and make alarms with alexa. Next thing I would like to know if there is a way to make this work with the libre 3 when it is out.

,
Thanks for doing this as itā€™s very interesting. My wife is the Dexcom user in our household and Iā€™m successful with sending the value and trend via push message to iOS.

What Iā€™m interested now is to receive notifications if the Dexcom sensor is unknown as these are messages I sometimes receive if the value or trend are unknown and the sensor is basically offline and/or no data as displayed by the Dexcom app. This could be just as useful as the actual data itself.

My code examples of trying to monitor if unknown exists but do not know if this works. It works via iOS push in the developer tools > services when I call the automation. Iā€™m not sure though if the templates are correct. Have you done anything such as this? I reviewed templates here

Also if someone knows how to combine both of the value_templates into one Iā€™d appreciate a lesson on that too.

automation example:

- alias: "Dexcom Unknown Notification"
    trigger:
      platform: time_pattern
      minutes: /5 # repeat every 5 min.
    condition: 
      - condition: template
        value_template: >-
          {{ state_attr('sensor.dexcom_wife_glucose_value' 'attr') == unknown, unavailable, none}}
      -  condition: template
         value_template: >-
           {{ state_attr('sensor.dexcom_wife_glucose_trend' 'attr') == unknown, unavailable, none}}
    action:
    - service: notify.mobile_app_iphone
      data:
        message: |
          WIFE BLOOD SUGAR IS UNKNOWN
          {{now().strftime("Date: %m-%d-%Y  Time: %I:%M:%S  %p")}}
1 Like

Iā€™ve used node-red on home assistant to poll BSL levels ( via Sugarmate) and if below 4.0 during set times:

  1. Play TTS loop to Google mini speaker to warn of low BSL
  2. Flash the bedroom light on and off on loop
  3. Send IOS Notification
  4. Incorporated a snooze function, triggered by responding to the IOS notification that puts the flow into a snooze for 20 minutes ( to allow time for treating and BSLs to start rising again before alerting again)

Has been an awesome setup for peace of mind when it comes to night time monitoring of my daughters BSL

2 Likes