As an example of the issue I’m seeing I tested the below code for just the a1c value for each child, and as noted before whichever child is first in the list their value does not get displayed while the second child in the order a1c shows every time. I feel like there is some variable I’m missing or maybe it’s just the way code is read/fed into the system that parts of it don’t work. The code for the Card’s are identical with the exception of the “entity” which is specific to each child.
I’m hoping whatever I’m not seeing is blatantly obvious to one of you.
- platform: average
name: 'Child1 Glucose Avg 90d'
duration:
days: 90
entities:
- sensor.dexcom_child1_glucose_value
- platform: template
sensors:
child1_hba1c_value:
entity_id: sensor.child1_glucose_avg_90d
value_template: >
{% set a = ( states("sensor.child1_glucose_avg_90d") | float + 46.7 ) %}
{% set a1c = (a / 28.7) %}
{{a1c | round(2) }}
- platform: average
name: 'Child2 Glucose Avg 90d'
duration:
days: 90
entities:
- sensor.dexcom_child2_glucose_value
- platform: template
sensors:
child2_hba1c_value:
entity_id: sensor.child2_glucose_avg_90d
value_template: >
{% set a = ( states("sensor.child2_glucose_avg_90d") | float + 46.7 ) %}
{% set a1c = (a / 28.7) %}
{{a1c | round(2) }}
Card example only difference would be the entity line being child1 vs child2
I have this working now but I’m a little confused as to why. Originally when setting up the templates for my kids I used two separate yaml files and added them into the configuration with include commands. This is where I was having problems and only the second child data would show. I decided to combine them into a single script just to see if it would work and it does now. Both kids information is now showing. I’m a little confused as to why includes would cause an issue, but maybe I just need to read up on them more to make sure I fully understand them.
#seperate templates for each child - 1st child data would not show.
#sensor: !include sensors_child1.yaml
#sensor: !include sensors_child2.yaml
#current setup in configuration.yaml using a combined template for both kids.
sensor: !include Dexcom_combined.yaml
In short, I love the interface and all the info it shows me, and I’m happy that it does work for more then one diabetic in the house, just requires minor adjustments for the entities to make them unique.
I know your question was a bit ago, but I noticed no one answered you. You can only have one sensor: declaration in the configuration.yaml file. The following is what I have in my configuration.yaml file so that I have a single file that contains all of my sensors:
sensor: !include sensors.yaml
You could take all of the content of your Dexcom_combined.yaml file, include any other sensors you wish, and merge them into a single sensor.yaml file (if you like). You can find more information in the docs at Splitting Up the Configuration. I hope this helps.
Hi, I’ve been using this code for a while and now the cgm sensor/transmitter expires in templates which shows the remaining days are now showing as unavailable. Has this happened to anyone else, and what can I do to resolve the issue?
I have been trying to integrate this to track my wife’s glucose levels, but have had nothing bu issues. I can get the sensors in the configuration integrated, and they show up as expected. Creating the card, however, I keep getting errors. At first, I was getting simple YAML errors, but now I am getting the following error:
Your configuration is not valid: i: At path: views – Expected an array value, but received: undefined.
Great topic!
I would like to share my dashboard, using Medtronic Guardian but I am sure it can be also used for Dexcom as well. With some automations, Home Assistant greatly helps me to notify me of things that Medtronic does not do:
When in the morning 7:30 my insulin cartridge is less than 30 units, it will send me a notification to consider to change it. (Always annoying when it is empty just before end of the workday)
It will send me a notification in the morning when my sensor needs to be exchanged.
Shows my SG curves for the last 4 days in one graph
Shows my 24hrs TiR for this week and the week before
Keeps a live overview of my (TiR) score for several periods in an attractive “Healt Watch like” view.
Nice @Bart_Huitsing, I’m curious how you obtain and store the time in range data in home assistant. Are you using separate template and statistics sensors?