Frontend Panel for Diabetics using a Dexcom CGM

thanks for the reply. i saw my error. is there a way to resize it? also, is there a way to adjust the time format? sorry i am a HA novice

Make sure you create all supporting templates in templates.yaml (or your config if you’re not splitting templates.yaml). The error above means you have not defined the sensor.dexcom_glucose_status (which is a template showing in range / out of range).

thanks I am trying to paste my template.yaml here but I am not sure how to format it. from what i can tell, everything looks to be correct

Everything looks good except the “- sensor:” part. Push that two empty spaces to the right.

Also, make sure you reference this file in your config.yaml. In your case, it should say:
template: !include templates.yaml

understood

With your help I was able to get rid of all of the errors. There are no errors now, but nothing is displaying on the dashboard. I have all of the icons in the www folder and my config.yaml references the template now. Below is the lovelace yaml

views:
  - title: Home
    cards:
      - type: custom:button-card
entity: sensor.dexcom_arianaeve2015_glucose_value
show_entity_picture: false
show_last_changed: false
show_icon: false
show_name: false
name: |
  [[[ 
     return `<span>${(states['sensor.dexcom_arianaeve2015_glucose_value'].state)} mg/dL</span>`
  ]]]
styles:
  card:
    - border-radius: 2%
    - padding: 2.5%
    - color: ivory
    - font-size: 12px
    - border-width: >
        [[[ if (states['sensor.dexcom_glucose_status'].state === 'In Range')
        return '0px';
            else return '2px';
        ]]]
    - border-color: >
        [[[ if (states['sensor.dexcom_glucose_status'].state === 'Very Low')
        return 'red';
            if (states['sensor.dexcom_glucose_status'].state === 'Low') return 'orange';
            if (states['sensor.dexcom_glucose_status'].state === 'High') return 'orange';
            if (states['sensor.dexcom_glucose_status'].state === 'Very High') return 'red';
            else return 'none';
        ]]]
  grid:
    - grid-template-areas: '"img img" "trend trend" "update update" "range range"'
    - grid-template-columns: 1fr 1fr
    - grid-template-rows: 1fr min-content min-content min-content
  img_cell:
    - justify-content: middle
    - align-items: start
    - margin: none
    - padding-bottom: 5px
  icon:
    - width: 15%
    - margin-top: 0%
    - color: red
    - padding-bottom: 0px
  custom_fields:
    state:
      - align-self: start
      - justify-self: end
      - font-size: 17px
      - padding-bottom: 5px
    update:
      - font-family: helvetica neue, helvetica, Arial
      - font-weight: 500
      - font-size: 15px
      - color: grey
      - align-self: middle
      - justify-content: middle
      - padding-bottom: 5px
      - margin-top: 0px
    trend:
      - font-family: helvetica neue, helvetica, Arial
      - color: rgba(255, 255, 255, 0.7)
      - font-size: 15px
      - font-weight: 300
      - text-align: center
      - padding-bottom: 5px
    range:
      - font-family: helvetica neue, helvetica, Arial
      - font-size: 15px
      - font-weight: 500
      - text-align: center
      - line-height: 30px
      - color: white
      - background-color: |
          [[[
            if ((states['sensor.dexcom_glucose_status'].state === 'Very Low'))
              return "red";
            if ((states['sensor.dexcom_glucose_status'].state === 'Low'))
              return "orange";
            if ((states['sensor.dexcom_glucose_status'].state === 'High'))
              return "orange";
            if ((states['sensor.dexcom_glucose_status'].state === 'Very High'))
              return "red";
            else
              return "none";
          ]]]
    img:
      - font-weight: bold
      - font-size: 15px
      - color: >
          [[[ if (states['sensor.dexcom_glucose_status'].state === 'In Range')
          return 'grey';
              if ((states['sensor.dexcom_glucose_status'].state === 'Low'))
          return "orange";
              if ((states['sensor.dexcom_glucose_status'].state === 'High'))
          return "orange";
              else return 'red';
          ]]]
      - align-self: middle
      - justify-content: middle
      - padding-bottom: 65px
custom_fields:
  trend: |
    [[[ if (states['input_number.dexcom_change'].state > 0)
          return `${(states['sensor.dexcom_arianaeve2015_glucose_trend'].state)} (+${Math.round(states['input_number.dexcom_change'].state)})`;
        return `${(states['sensor.dexcom_arianaeve2015_glucose_trend'].state)} (${Math.round(states['input_number.dexcom_change'].state)})`;
    ]]]
  update: |
    [[[ return `${(states['sensor.dexcom_last_update'].state)}`; ]]]
  range: |
    [[[

      if ((states['sensor.dexcom_glucose_status'].state === 'Very Low'))
        return "VERY LOW";
      if ((states['sensor.dexcom_glucose_status'].state === 'Low'))
        return "LOW";
      if ((states['sensor.dexcom_glucose_status'].state === 'High'))
        return "HIGH";
      if ((states['sensor.dexcom_glucose_status'].state === 'Very High'))
        return "VERY HIGH";
      if ((states['sensor.dexcom_glucose_status'].state === 'In Range'))
        return "IN RANGE";
      else
        return "N/A";
    ]]]
  img: |
    [[[
        if (states['sensor.dexcom_arianaeve2015_glucose_trend'].state == "steady")
          return `<img src=/local/icons/dexcom-steady.png
          style="width: 170px; height: 170px; color: #00def;">
          </ha-icon><span style="font-size:30px; margin-top:-111px; display:block;">${(states['sensor.dexcom_glucose_value'].state)}</span><span style="font-size:13px; margin-top:0px; display:block;">mg/dL</span>`;
        if (states['sensor.dexcom_arianaeve2015_glucose_trend'].state == "rising slightly")
          return `<img src=/local/icons/dexcom-risingslightly.png
          style="width: 170px; height: 170px; color: #00def;">
          </ha-icon><span style="font-size:30px; margin-top:-111px; display:block;">${(states['sensor.dexcom_glucose_value'].state)}</span><span style="font-size:13px; margin-top:0px; display:block;">mg/dL</span>`;
        if (states['sensor.dexcom_arianaeve2015_glucose_trend'].state == "falling slightly")
          return `<img src=/local/icons/dexcom-fallingslightly.png
          style="width: 170px; height: 170px; color: #00def;">
          </ha-icon><span style="font-size:30px; margin-top:-111px; display:block;">${(states['sensor.dexcom_glucose_value'].state)}</span><span style="font-size:13px; margin-top:0px; display:block;">mg/dL</span>`;
        if (states['sensor.dexcom_arianaeve2015_glucose_trend'].state == "falling")
          return `<img src=/local/icons/dexcom-falling.png
          style="width: 170px; height: 170px; color: #00def;">
          </ha-icon><span style="font-size:30px; margin-top:-111px; display:block;">${(states['sensor.dexcom_glucose_value'].state)}</span><span style="font-size:13px; margin-top:0px; display:block;">mg/dL</span>`;
        if (states['sensor.dexcom_arianaeve2015_glucose_trend'].state == "rising")
          return `<img src=/local/icons/dexcom-rising.png
          style="width: 170px; height: 170px; color: #00def;">
          </ha-icon><span style="font-size:30px; margin-top:-111px; display:block;">${(states['sensor.dexcom_glucose_value'].state)}</span><span style="font-size:13px; margin-top:0px; display:block;">mg/dL</span>`;
        if (states['sensor.dexcom_arianaeve2015_glucose_trend'].state == "falling quickly")
          return `<img src=/local/icons/dexcom-fallingquickly1.png
          style="width: 170px; height: 170px; color: #00def;">
          </ha-icon><span style="font-size:30px; margin-top:-111px; display:block;">${(states['sensor.dexcom_glucose_value'].state)}</span><span style="font-size:13px; margin-top:0px; display:block;">mg/dL</span>`;
        if (states['sensor.dexcom_arianaeve2015_glucose_trend'].state == "rising quickly")
          return `<img src=/local/icons/dexcom-risingquickly1.png
          style="width: 170px; height: 170px; color: #00def;">
          </ha-icon><span style="font-size:30px; margin-top:-111px; display:block;">${(states['sensor.dexcom_glucose_value'].state)}</span><span style="font-size:13px; margin-top:0px; display:block;">mg/dL</span>`;
        return `<img src=/local/icons/dexcom-steady.png
          style="width: 170px; height: 170px; color: #00def;">
          </ha-icon><span style="font-size:30px; margin-top:-111px; display:block;">N/A</span><span style="font-size:13px; margin-top:0px; display:block;">mg/dL</span>`;
    ]]]
tap_action:
  action: none

This looks fine to me. Are you sure the icons are in /www/icons folder? The path is e.g., www/icons/dexcom-steady.png. That’s the only potential issue I think of.

Thanks and Yes they are in the www. I will keep playing around with it

Update to the latest version, it automatically uses local time settings.

1 Like

awesome, thank you!

1 Like

Apologize for the (very) late reply. The Medtronic provides a TiR sensor. However, I think you could use the MeasureIt integration via HACS to do the same.

Thanks. Never too late… I did not know about the Measure It integration. Saved me an extra step in my calculations. I’ll try that out this weekend.

Cheers :wine_glass:

I use the Nightscout integration, where I have the smoothed values with the G7.
How do I reproduce the glucose trend, which is missing in Nigthscout?

I don’t think you can get that in the nightscout integration, but you can with a rest sensor. I have posted how in another thread. I’m away from home, on holiday, so I’ll try to find the thread.

Edit see Using Continuous Glucose Monitor (CGM) Data - #60 by nickrout

The link to * Dexcom Custom Component This retrieves the BG/Trend data from your Dexcom CGM and creates 2 sensors; one for BG current value, and one for trend direction.

is no longer working!

I use a R2 ikoolcore so far its been great no lag

Read the thread. Post 28:

Ya, I already have it with Dexcom G6 IN THERE AS WELL I was thinking it was something else with the link not working! I also have Nightscout in Ha just now trying again to see if I can get Sensor Age expired, would really like it to tell me each day how long I have left on my Dexcoms sensor!

I also noticed a bug last night and ended up with high readings due to the Lovelace Card
Add a mini Graph card!

It seems to have kept at my same readings at 6.3mmols for 2 hours and I was 10.5mmols when I looked at the Graph it was correct but Dexcom reading wasn’t!
I looked at Nightscouts and that was also ok at 10.5mmols so I did a right-click and refresh the page and it updated.

I was talking to a Amazon developer at the time and he said it was due to my monitor being an old one and the re-fresh rate is doing it, but I can’t see it doing this for two hours.

I think maybe a few seconds delay or a minute or 2 but not two hours It has been ok today on keeping the correct readings. Been checking it but a little concerned on it now! Hope too I don’t need a new Monitor :rofl: :smiling_face:

How do I get a bigger Blood reading in the Picture element?
seems to be very small!
image need to be bigger