Last active
November 14, 2025 08:00
-
-
Save iricigor/03ed982d21215d28fd5e0975377eb0ae to your computer and use it in GitHub Desktop.
MDCP World Diabetes Day
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type: custom:mini-graph-card | |
| name: Glucose Levels (24h) | |
| entities: | |
| - entity: sensor.glucose_mmol_l | |
| hours_to_show: 24 | |
| points_per_hour: 12 | |
| show: | |
| labels: true | |
| color_thresholds: | |
| - value: 3 | |
| color: "#FF0000" | |
| - value: 4 | |
| color: "#FFAA00" | |
| - value: 5 | |
| color: "#AAFF00" | |
| - value: 7 | |
| color: "#00FF00" | |
| - value: 9 | |
| color: "#00FFAA" | |
| - value: 10 | |
| color: "#00AAFF" | |
| - value: 11 | |
| color: "#0000FF" | |
| - value: 13 | |
| color: "#AA00FF" | |
| - value: 15 | |
| color: "#FF00AA" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias: Change RGB Light Color Based on Blood Glucose | |
| description: "" | |
| triggers: | |
| - entity_id: sensor.blood_sugar | |
| trigger: state | |
| conditions: [] | |
| actions: | |
| - if: | |
| - condition: time | |
| after: "05:50:00" | |
| before: "21:50:00" | |
| then: | |
| - alias: Blood Sugar Light Color | |
| target: | |
| entity_id: "{{ ['light.h6022'] | select('is_state', 'on') | list }}" | |
| data: | |
| hs_color: >- | |
| {% set blood_sugar = states('sensor.blood_sugar') | float %} {% set | |
| hue = ( | |
| 0 if blood_sugar < 3 | |
| else (80 * (blood_sugar - 3) / 2) | int if blood_sugar < 5 | |
| else (80 + (80 * (blood_sugar - 5) / 4)) | int if blood_sugar < 9 | |
| else (160 + (80 * (blood_sugar - 9) / 2)) | int if blood_sugar < 11 | |
| else (240 + (80 * (blood_sugar - 11) / 4)) | int if blood_sugar <= 15 | |
| else 330 | |
| ) %} [{{ hue }}, 100] | |
| action: light.turn_on | |
| else: | |
| - action: light.turn_off | |
| metadata: {} | |
| data: {} | |
| target: | |
| device_id: 70dacb1e321ec06ccad9c1e442af44b1 | |
| mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment