Enhanced Nightscout integration for Home Assistant with full Plotly chart support.
Unlike the built-in Nightscout integration, Nightscout Plus exposes raw SGV history and treatment notes as sensor attributes — making it possible to build rich, interactive glucose charts directly in your HA dashboard.
history attribute: array of up to 288 SGV data points (24h) for Plotly charts{"date": "ISO local time", "sgv": mmol/L}history_count attribute for diagnosticsnotes attribute: array of notes with coordinates for chart overlay{"created_at", "text", "sgv", "timestamp_ms", "eventType", ...}Europe/Kyiv)https://github.com/adminpb/ha-nightscout-plus as Integrationnightscout_plus/ folder to /config/custom_components/The integration is designed to work with Plotly Graph Card.
See dashboard.yaml for a complete example configuration with:
| Zone | Range (mmol/L) | Color |
|---|---|---|
| LOW | < 3.9 | 🔴 Red |
| SAFE | 3.9 – 6.0 | 🟢 Green |
| OK | 6.0 – 7.8 | 🟡 Yellow-green |
| HIGH | 7.8 – 10.0 | 🩷 Pink |
| VERY HIGH | > 10.0 | 🔴 Red |
| Target | 4.9 | Dark green solid line |
The chart reads data from sensor attributes, not from HA’s history database:
# SGV line + dots from attributes
x: |-
$fn ({ hass }) => {
const hist = hass.states['sensor.nightscout_plus_blood_glucose']?.attributes?.history;
if (!hist || !Array.isArray(hist) || hist.length === 0) return [];
return hist.map(h => h.date);
}
# Notes overlay
x: |-
$fn ({ hass }) => {
const notes = hass.states['sensor.nightscout_plus_notes']?.attributes?.notes || [];
return notes
.filter(n => n && n.created_at && n.sgv !== null)
.map(n => n.created_at);
}
custom_components/nightscout_plus/
├── __init__.py # Platform setup & teardown
├── api.py # Async HTTP client for Nightscout REST API v1
├── config_flow.py # UI configuration flow with reconfigure support
├── const.py # Constants, icons, event type mappings
├── coordinator.py # DataUpdateCoordinator (SGV + treatments → notes)
├── manifest.json # Integration metadata
├── sensor.py # Blood Glucose + Notes sensor entities
└── strings.json # UI strings for config flow
history[] attribute on Blood Glucose sensor for Plotly chartshistory_count diagnostic attribute%H:%M)MIT