Dexcom One CGM - Request for Thoughts

Hi All,

My wife is type 1 diabetic, over the last 4-5 years we have been self funding the use of the Dexcom G6 then ultimately the Dexcom G7.

The NHS has now finally said they will fund the Dexcom, however they only provide the Dexcom One and after a few days of use it is clear that it is lacking on a number of features that were helpful in managing this condition.

  • Blood Trends
  • Double Down Warnings
  • Double Up Warnings
  • Share with family

This Dexcom one literally is only a case of setting the high and low threshold and then it beeping when its met. Anyone that has this condition knows it would be better to action a double down warning than be told about when it is too late.

Anyway on reflection i have ressurected an old Nightscout instance on my Synology NAS (using docker) which i can integrate with Home Assistant but it only appears to provide the blood meter reading.

That is fine as long as i can use the power of HA to replicate the features that are now missing.

Ultimately there must be others out there with Diabetes that have used Home Assistant to do these tasks and i am reaching out to those people for any advice or comments on how i could achieve what im looking for.

I have done some investigation and the below table shows how the blood direction and trends are calculated, this surely canb be replicated using automations or scripts ?

diabetic_trends

As always, thank you for your assitance in advance

Based on the table above made some binary sensors, i am sure there is a more compact and combined method of code that would do the same but as i am more of a hobbyist this is my attempt thus far;

binary_sensor:
  - platform: template
    sensors:
      bloods_steady:
        friendly_name: "Bloods Steady"
        unique_id: binary_bloods_steady
        value_template: >
          {{ is_state('binary_sensor.bloods_falling', 'off') and
             is_state('binary_sensor.bloods_falling_doubledown', 'off') and
             is_state('binary_sensor.bloods_falling_quickly', 'off') and
             is_state('binary_sensor.bloods_rising', 'off') and
             is_state('binary_sensor.bloods_rising_doubleup', 'off') and
             is_state('binary_sensor.bloods_rising_quickly', 'off') }}

  - platform: trend
    sensors:
      # 5 minute sample duration (300s)
      # Max sample window 2hrs (120mins)

      # Blood sugars rise 6 in 5 minute window
      bloods_rising_doubleup:
        friendly_name: "Bloods Double Up"
        entity_id: sensor.dexcom_emily_glucose_value
        sample_duration: 300
        max_samples: 120
        min_gradient: 0.02000

      # Blood sugars rise 3 in 5 minute window
      bloods_rising_quickly:
        friendly_name: "Bloods Rising Quickly"
        entity_id: sensor.dexcom_emily_glucose_value
        sample_duration: 300
        max_samples: 120
        min_gradient: 0.01000

      # Blood sugars rise 1.5 in 5 minute window
      bloods_rising:
        friendly_name: "Bloods Rising"
        entity_id: sensor.dexcom_emily_glucose_value
        sample_duration: 300
        max_samples: 120
        min_gradient: 0.00500

      # Blood sugars drop 1.5 in 5 minute window
      bloods_falling:
        friendly_name: "Bloods Falling"  
        entity_id: sensor.dexcom_emily_glucose_value
        sample_duration: 300
        max_samples: 120
        min_gradient: -0.00500

      # Blood sugars drop 3 in 5 minute window
      bloods_falling_quickly:
        friendly_name: "Bloods Falling Quickly"         
        entity_id: sensor.dexcom_emily_glucose_value
        sample_duration: 300
        max_samples: 120
        min_gradient: -0.01000

      # Blood sugars drop 6 in 5 minute window
      bloods_falling_doubledown:
        friendly_name: "Bloods Double Down"       
        entity_id: sensor.dexcom_emily_glucose_value
        sample_duration: 300
        max_samples: 120
        min_gradient: -0.02000

I can now use these as a starting block for replication the blood sugar trends of the Dexcom G6 and the Dexcom G7

Nightscout has an api that you can get a lot of info from. Nightscout API — nightscout-test latest documentation

Edit: I have for example this rest sensor

  - platform: rest
    name: Trend
    resource: https://secret.t1pal.com/api/v1/entries/current.json
    value_template: '{{ value_json[0].direction }}'

As @nickrout mentioned the nightscout APi is the way to go for this.

The blood sugar reading in home assistant can show the trend via the MDI icon.

As I have to take different insulin to carb ratios depending on time of day and the fact maths is not my strong point, I recently created a page that I can input carb intake and it works out how much insulin I need based on carbs, time of day (ratio required) with or without correction and then allows me to post this and notes back to nightscout:

It’s still work in progress, but it has made my life a lot easier so far.

I still plan to make some automations using the data but haven’t as yet. Interested to see what others are doing however.

1 Like

Also you can get the current level plus trend graphic in a panel. I cast this to a google screen thing

https://secret.t1pal.com/clock/clock-color

That is a Nightscout link. It shows this

@nickrout @rossk thatk you both for your comments … was thinking about best to do this but was sure that someone out there would have done this before. let me play about with your suggestions and i will update this thread on any outcomes.

Thanks again