Nightscout Plugin (#108)
This commit is contained in:
1 parent
dd90d55a8a
commit
1656f3cf6b
12 files changed
+352
-33
No files matched your search
@@ -24,7 +24,7 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="2" align="center">
|
||||
<a href="source/plugins/README.md">🧩 19 plugins</a>
|
||||
<a href="source/plugins/README.md">🧩 20 plugins</a>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -100,7 +100,7 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/music/README.md">🎼 Music plugin</a></th>
|
||||
<th><a href="source/plugins/pagespeed/README.md">⏱️ Website performances</a></th>
|
||||
<th><a href="source/plugins/nightscout/README.md">💉 Nightscout</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
@@ -112,6 +112,16 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
|
||||
</details>
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/legoandmars/legoandmars/blob/master/metrics.plugin.nightscout.svg">
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/pagespeed/README.md">⏱️ Website performances</a></th>
|
||||
<th><a href="source/plugins/people/README.md">🧑🤝🧑 People plugin</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.pagespeed.svg">
|
||||
<details><summary>Detailed version</summary>
|
||||
@@ -122,12 +132,6 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
|
||||
</details>
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/people/README.md">🧑🤝🧑 People plugin</a></th>
|
||||
<th><a href="source/plugins/posts/README.md">✒️ Recent posts</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.people.followers.svg">
|
||||
<details><summary>Followed people version</summary>
|
||||
@@ -141,34 +145,40 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
|
||||
</details>
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/posts/README.md">✒️ Recent posts</a></th>
|
||||
<th><a href="source/plugins/projects/README.md">🗂️ Projects</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.posts.svg">
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/projects/README.md">🗂️ Projects</a></th>
|
||||
<th><a href="source/plugins/stargazers/README.md">✨ Stargazers over last weeks</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.projects.svg">
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/stargazers/README.md">✨ Stargazers over last weeks</a></th>
|
||||
<th><a href="source/plugins/stars/README.md">🌟 Recently starred repositories</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.stargazers.svg">
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/stars/README.md">🌟 Recently starred repositories</a></th>
|
||||
<th><a href="source/plugins/topics/README.md">📌 Starred topics</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.stars.svg">
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/topics/README.md">📌 Starred topics</a></th>
|
||||
<th><a href="source/plugins/traffic/README.md">🧮 Repositories traffic</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.topics.svg">
|
||||
<details open><summary>Mastered and known technologies version</summary>
|
||||
@@ -176,30 +186,23 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
|
||||
</details>
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/traffic/README.md">🧮 Repositories traffic</a></th>
|
||||
<th><a href="source/plugins/tweets/README.md">🐤 Latest tweets</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.traffic.svg">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/tweets/README.md">🐤 Latest tweets</a></th>
|
||||
<th><a href="source/plugins/wakatime/README.md">⏰ WakaTime plugin</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.tweets.svg">
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="source/plugins/wakatime/README.md">⏰ WakaTime plugin</a></th>
|
||||
<th><a href="source/plugins//README.md"></a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.wakatime.svg">
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
<td align="center"><img width="900" height="1" alt=""></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2" align="center">
|
||||
@@ -551,6 +554,7 @@ https://my-personal-domain.com/my-github-user?base=0&base.repositories=1
|
||||
<th nowrap="nowrap" align="center">🈷️</th>
|
||||
<th nowrap="nowrap" align="center">👨💻</th>
|
||||
<th nowrap="nowrap" align="center">🎼</th>
|
||||
<th nowrap="nowrap" align="center">💉</th>
|
||||
<th nowrap="nowrap" align="center">⏱️</th>
|
||||
<th nowrap="nowrap" align="center">🧑🤝🧑</th>
|
||||
<th nowrap="nowrap" align="center">✒️</th>
|
||||
@@ -574,6 +578,7 @@ https://my-personal-domain.com/my-github-user?base=0&base.repositories=1
|
||||
<th nowrap="nowrap" align="center" data-plugin="languages">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="lines">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="music">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="nightscout">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="pagespeed">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="people">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="posts">✔️</th>
|
||||
@@ -597,6 +602,7 @@ https://my-personal-domain.com/my-github-user?base=0&base.repositories=1
|
||||
<th nowrap="nowrap" align="center" data-plugin="languages">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="lines">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="music">❌</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="nightscout">❌</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="pagespeed">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="people">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="posts">❌</th>
|
||||
@@ -620,6 +626,7 @@ https://my-personal-domain.com/my-github-user?base=0&base.repositories=1
|
||||
<th nowrap="nowrap" align="center" data-plugin="languages">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="lines">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="music">❌</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="nightscout">❌</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="pagespeed">✔️</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="people">❌</th>
|
||||
<th nowrap="nowrap" align="center" data-plugin="posts">❌</th>
|
||||
@@ -659,6 +666,7 @@ See their respective documentation for more informations about how to setup them
|
||||
* [🈷️ Most used languages](/source/plugins/languages/README.md)
|
||||
* [👨💻 Lines of code changed](/source/plugins/lines/README.md)
|
||||
* [🎼 Music plugin](/source/plugins/music/README.md)
|
||||
* [💉 Nightscout](/source/plugins/nightscout/README.md)
|
||||
* [⏱️ Website performances](/source/plugins/pagespeed/README.md)
|
||||
* [🧑🤝🧑 People plugin](/source/plugins/people/README.md)
|
||||
* [✒️ Recent posts](/source/plugins/posts/README.md)
|
||||
|
||||
+38
@@ -365,6 +365,44 @@ inputs:
|
||||
description: Music provider username
|
||||
default: .user.login
|
||||
|
||||
# ====================================================================================
|
||||
# 💉 Nightscout
|
||||
|
||||
# Enable or disable plugin
|
||||
plugin_nightscout:
|
||||
description: Displays Blood Glucose
|
||||
default: no
|
||||
|
||||
# Nightscout site URL
|
||||
plugin_nightscout_url:
|
||||
description: Your Nightscout site URL
|
||||
default: https://example.herokuapp.com
|
||||
|
||||
# Controls how big the graph is
|
||||
plugin_nightscout_datapoints:
|
||||
description: How many datapoints to show on the graph. 0 and 1 disable the graph.
|
||||
default: 12
|
||||
|
||||
# Low value used for colors and text alerts
|
||||
plugin_nightscout_lowalert:
|
||||
description: When the blood sugar is considered low
|
||||
default: 80
|
||||
|
||||
# High value used for colors and text alerts
|
||||
plugin_nightscout_highalert:
|
||||
description: When the blood sugar is considered high
|
||||
default: 180
|
||||
|
||||
# Urgent low value used for colors and text alerts
|
||||
plugin_nightscout_urgentlowalert:
|
||||
description: When the blood sugar is considered urgently low
|
||||
default: 50
|
||||
|
||||
# Urgent high value used for colors and text alerts
|
||||
plugin_nightscout_urgenthighalert:
|
||||
description: When the blood sugar is considered urgently high
|
||||
default: 250
|
||||
|
||||
# ====================================================================================
|
||||
# ⏱️ Website performances
|
||||
|
||||
|
||||
@@ -49,6 +49,9 @@
|
||||
"token": null, "//":"Music provider personal token",
|
||||
"enabled": false, "//": "Display your music tracks"
|
||||
},
|
||||
"nightscout":{
|
||||
"enabled": false, "//": "Displays Blood Glucose"
|
||||
},
|
||||
"pagespeed":{
|
||||
"token": null, "//":"PageSpeed token",
|
||||
"enabled": false, "//": "Display a website Google PageSpeed metrics"
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/**Mocked data */
|
||||
export default function({faker, url}) {
|
||||
//Last.fm api
|
||||
if (/^https:..testapp.herokuapp.com.*$/.test(url)) {
|
||||
//Get Nightscout Data
|
||||
console.debug(`metrics/compute/mocks > mocking nightscout api result > ${url}`)
|
||||
const lastInterval = Math.floor(new Date() / 300000) * 300000
|
||||
const directionArray = ["SingleUp", "DoubleUp", "FortyFiveUp", "Flat", "FortyFiveDown", "SingleDown", "DoubleDown"]
|
||||
return ({
|
||||
status:200,
|
||||
data:{
|
||||
data:[{
|
||||
_id:faker.git.commitSha().substring(0, 23),
|
||||
device:"xDrip-DexcomG5",
|
||||
date:lastInterval,
|
||||
dateString:new Date(lastInterval).toISOString(),
|
||||
sgv:faker.random.number({min:40, max:400}),
|
||||
delta:faker.random.number({min:-10, max:10}),
|
||||
direction:directionArray[Math.floor(Math.random() * directionArray.length)],
|
||||
type:"sgv",
|
||||
filtered:0,
|
||||
unfiltered:0,
|
||||
rssi:100,
|
||||
noise:1,
|
||||
sysTime:new Date(lastInterval).toISOString(),
|
||||
utcOffset:faker.random.number({min:-12, max:14})*60,
|
||||
}],
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -257,6 +257,17 @@
|
||||
}))
|
||||
}
|
||||
}) : null),
|
||||
//Nightscout
|
||||
...(set.plugins.enabled.nightscout ? ({
|
||||
nightscout:{
|
||||
url: options["nightscout.url"] != null && options["nightscout.url"] != "https://example.herokuapp.com" ? options["nightscout.url"]: "https://testapp.herokuapp.com/",
|
||||
datapoints: faker.random.number({min: 8, max: 12}),
|
||||
lowalert: faker.random.number({min: 60, max: 90}),
|
||||
highalert: faker.random.number({min: 150, max: 200}),
|
||||
urgentlowalert: faker.random.number({min: 40, max: 59}),
|
||||
urgenthighalert: faker.random.number({min: 201, max: 300})
|
||||
}
|
||||
}) : null),
|
||||
//Pagespeed
|
||||
...(set.plugins.enabled.pagespeed ? ({
|
||||
pagespeed:{
|
||||
|
||||
@@ -14,6 +14,7 @@ See their respective documentation for more informations about how to setup them
|
||||
* [🈷️ Most used languages](/source/plugins/languages/README.md)
|
||||
* [👨💻 Lines of code changed](/source/plugins/lines/README.md)
|
||||
* [🎼 Music plugin](/source/plugins/music/README.md)
|
||||
* [💉 Nightscout](/source/plugins/nightscout/README.md)
|
||||
* [⏱️ Website performances](/source/plugins/pagespeed/README.md)
|
||||
* [🧑🤝🧑 People plugin](/source/plugins/people/README.md)
|
||||
* [✒️ Recent posts](/source/plugins/posts/README.md)
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
### 💉 Nightscout
|
||||
|
||||
The *Nightscout* plugin lets you display blood sugar values from a [Nightscout](http://nightscout.info) site.
|
||||
|
||||
<table>
|
||||
<td align="center">
|
||||
<img src="https://github.com/legoandmars/legoandmars/blob/master/metrics.plugin.nightscout.svg">
|
||||
<img width="900" height="1" alt="">
|
||||
</td>
|
||||
</table>
|
||||
|
||||
<details>
|
||||
<summary>💬 Setting up a nightscout site</summary>
|
||||
|
||||
The [nightscout website](http://www.nightscout.info/) details how to self-host a nightscout site. Check out the instructions there.
|
||||
|
||||
</details>
|
||||
|
||||
#### ℹ️ Examples workflows
|
||||
|
||||
[➡️ Available options for this plugin](metadata.yml)
|
||||
|
||||
```yaml
|
||||
- uses: lowlighter/metrics@master
|
||||
with:
|
||||
# ... other options
|
||||
plugin_nightscout: yes
|
||||
plugin_nightscout_url: ${{ secrets.NIGHTSCOUT_URL }} # Use the github actions "NIGHTSCOUT_URL" secret as your nightscout site
|
||||
plugin_nightscout_datapoints: 12 # Use the latest 12 blood sugar datapoints to create a graph
|
||||
plugin_nightscout_lowalert: 80 # Blood sugars below 80 will be considered low
|
||||
plugin_nightscout_highalert: 180 # Blood sugars above 180 will be considered high
|
||||
plugin_nightscout_urgentlowalert: 50 # Blood sugars below 50 will be considered urgently low
|
||||
plugin_nightscout_urgenthighalert: 250 # Blood sugars above 250 will be considered urgently high
|
||||
```
|
||||
@@ -0,0 +1,83 @@
|
||||
//Setup
|
||||
export default async function({q, imports, data, account}, {enabled = false} = {}) {
|
||||
//Plugin execution
|
||||
try {
|
||||
//Check if plugin is enabled and requirements are met
|
||||
if ((!enabled)||(!q.nightscout))
|
||||
return null
|
||||
|
||||
//Load inputs
|
||||
let {url, datapoints, lowalert, highalert, urgentlowalert, urgenthighalert} = imports.metadata.plugins.nightscout.inputs({data, account, q})
|
||||
|
||||
if (!url || url === "https://example.herokuapp.com") throw "Nightscout site URL isn't set!"
|
||||
if (url.substring(url.length - 1) !== "/") url += "/"
|
||||
if (url.substring(0, 7) === "http://") url = `https://${url.substring(7)}`
|
||||
if (url.substring(0, 8) !== "https://") url = `https://${url}`
|
||||
if (datapoints <= 0) datapoints = 1
|
||||
//Get nightscout data from axios
|
||||
const resp = await imports.axios.get(`${url}api/v1/entries.json?count=${datapoints}`)
|
||||
for (let i = 0; i < resp.data.length; i++){
|
||||
const {sgv} = resp.data[i]
|
||||
//Add human readable timestamps and arrows
|
||||
const date = new Date(resp.data[i].dateString)
|
||||
resp.data[i].arrowHumanReadable = directionArrow(resp.data[i].direction)
|
||||
resp.data[i].timeUTCHumanReadable = `${addZero(date.getUTCHours())}:${addZero(date.getUTCMinutes())}`
|
||||
/*
|
||||
* Add colors and alert names
|
||||
* TODO: Maybe make colors better themed instead of just the "github style" - red and yellow could fit better than darker shades of green
|
||||
*/
|
||||
let color = "#40c463"
|
||||
let alertName = "Normal"
|
||||
if (sgv >= urgenthighalert || sgv <= urgentlowalert){
|
||||
color = "#216e39"
|
||||
alertName = sgv >= urgenthighalert ? "Urgent High" : "Urgent Low"
|
||||
}
|
||||
else if (sgv >= highalert || sgv <= lowalert){
|
||||
color = "#30a14e"
|
||||
alertName = sgv >= highalert ? "High" : "Low"
|
||||
}
|
||||
resp.data[i].color = color
|
||||
resp.data[i].alert = alertName
|
||||
}
|
||||
return {data:resp.data.reverse()}
|
||||
}
|
||||
//Handle errors
|
||||
catch (error) {
|
||||
throw {error:{message:"An error occured", instance:error}}
|
||||
}
|
||||
}
|
||||
|
||||
function addZero(i) {
|
||||
if (i < 10)
|
||||
i = `0${i}`
|
||||
|
||||
return i
|
||||
}
|
||||
|
||||
function directionArrow(direction) {
|
||||
const dir = direction.toUpperCase()
|
||||
switch (dir) {
|
||||
case "NONE":
|
||||
return ""
|
||||
case "DOUBLEUP":
|
||||
return "↑↑"
|
||||
case "SINGLEUP":
|
||||
return "↑"
|
||||
case "FORTYFIVEUP":
|
||||
return "↗"
|
||||
case "FLAT":
|
||||
return "→"
|
||||
case "FORTYFIVEDOWN":
|
||||
return "↘"
|
||||
case "SINGLEDOWN":
|
||||
return "↓"
|
||||
case "DOUBLEDOWN":
|
||||
return "↓↓"
|
||||
case "NOT COMPUTABLE":
|
||||
return ""
|
||||
case "RATE OUT OF RANGE":
|
||||
return ""
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
name: "💉 Nightscout"
|
||||
cost: N/A
|
||||
supports:
|
||||
- user
|
||||
- organization
|
||||
inputs:
|
||||
|
||||
# Enable or disable plugin
|
||||
plugin_nightscout:
|
||||
description: Displays Blood Glucose
|
||||
type: boolean
|
||||
default: no
|
||||
|
||||
# Nightscout site URL
|
||||
plugin_nightscout_url:
|
||||
description: Your Nightscout site URL
|
||||
type: string
|
||||
default: https://example.herokuapp.com
|
||||
|
||||
# Controls how big the graph is
|
||||
plugin_nightscout_datapoints:
|
||||
description: How many datapoints to show on the graph. 0 and 1 disable the graph.
|
||||
type: number
|
||||
default: 12
|
||||
min: 0
|
||||
|
||||
# Low value used for colors and text alerts
|
||||
plugin_nightscout_lowalert:
|
||||
description: When the blood sugar is considered low
|
||||
type: number
|
||||
default: 80
|
||||
min: 0
|
||||
|
||||
# High value used for colors and text alerts
|
||||
plugin_nightscout_highalert:
|
||||
description: When the blood sugar is considered high
|
||||
type: number
|
||||
default: 180
|
||||
min: 0
|
||||
|
||||
# Urgent low value used for colors and text alerts
|
||||
plugin_nightscout_urgentlowalert:
|
||||
description: When the blood sugar is considered urgently low
|
||||
type: number
|
||||
default: 50
|
||||
min: 0
|
||||
|
||||
# Urgent high value used for colors and text alerts
|
||||
plugin_nightscout_urgenthighalert:
|
||||
description: When the blood sugar is considered urgently high
|
||||
type: number
|
||||
default: 250
|
||||
min: 0
|
||||
@@ -0,0 +1,14 @@
|
||||
- name: Nightscout plugin (default)
|
||||
uses: lowlighter/metrics@master
|
||||
with:
|
||||
token: NOT_NEEDED
|
||||
plugin_nightscout: yes
|
||||
plugin_nightscout_url: https://testapp.herokuapp.com/
|
||||
|
||||
- name: Nightscout plugin (without graph)
|
||||
uses: lowlighter/metrics@master
|
||||
with:
|
||||
token: NOT_NEEDED
|
||||
plugin_nightscout: yes
|
||||
plugin_nightscout_url: https://testapp.herokuapp.com/
|
||||
plugin_nightscout_datapoints: 0
|
||||
@@ -10,6 +10,7 @@
|
||||
"habits",
|
||||
"topics",
|
||||
"music",
|
||||
"nightscout",
|
||||
"posts",
|
||||
"tweets",
|
||||
"isocalendar",
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<% if (plugins.nightscout) { %>
|
||||
<section>
|
||||
<div class="row">
|
||||
<% if (plugins.nightscout.error) { %>
|
||||
<section>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2.343 13.657A8 8 0 1113.657 2.343 8 8 0 012.343 13.657zM6.03 4.97a.75.75 0 00-1.06 1.06L6.94 8 4.97 9.97a.75.75 0 101.06 1.06L8 9.06l1.97 1.97a.75.75 0 101.06-1.06L9.06 8l1.97-1.97a.75.75 0 10-1.06-1.06L8 6.94 6.03 4.97z"></path></svg>
|
||||
<%= plugins.nightscout.error.message %>
|
||||
</div>
|
||||
</section>
|
||||
<% } else { %>
|
||||
<section>
|
||||
<h2 class="field">
|
||||
<svg version="1.1" id="Layer_1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;" xmlns="http://www.w3.org/2000/svg" width="16px" height="19.25px" viewBox="0 0 409.086 563.171" fill="#959da5"> <g i:extraneous="self"> <pattern x="-100.987" y="781.562" width="69" height="69" patternUnits="userSpaceOnUse" id="Polka_Dot_Pattern" viewBox="2.125 -70.896 69 69" overflow="visible"> <g> <polygon fill="none" points="71.125,-1.896 2.125,-1.896 2.125,-70.896 71.125,-70.896 "/> <polygon fill="#F7BC60" points="71.125,-1.896 2.125,-1.896 2.125,-70.896 71.125,-70.896 "/> <g> <path fill="#FFFFFF" d="M61.772-71.653c0.018,0.072,0.007,0.127-0.026,0.19c-0.053,0.101-0.112,0.062-0.165,0.128 c-0.05,0.062-0.099,0.276-0.079,0.362c-0.169,0.058-0.01,0.227-0.015,0.35c-0.002,0.05-0.041,0.105-0.045,0.161 c-0.01,0.119,0.017,0.266,0.068,0.37c0.097,0.198,0.268,0.413,0.435,0.544c0.19,0.148,0.365,0.572,0.608,0.631 c0.177,0.042,0.384-0.104,0.543-0.143c0.18-0.043,0.397,0.01,0.571-0.053c0.222-0.079,0.127-0.337,0.288-0.45 c0.104-0.074,0.287-0.01,0.406-0.051c0.2-0.069,0.339-0.263,0.376-0.46c0.016-0.082,0.01-0.145,0.039-0.221 c0.039-0.103,0.111-0.16,0.09-0.293c-0.01-0.062-0.052-0.12-0.064-0.187c-0.022-0.114,0.002-0.224,0-0.337 c-0.003-0.2,0.017-0.379-0.078-0.55c-0.38-0.688-1.236-0.929-1.975-0.789c-0.18,0.034-0.287,0.126-0.442,0.207 c-0.17,0.088-0.139,0.166-0.318,0.224c-0.081,0.026-0.216,0.124-0.215,0.224c0.001,0.115,0.005,0.051,0.012,0.169 c-0.021,0.011-0.021-0.005-0.03-0.025"/> <path fill="#FFFFFF" d="M54.105-71.653c0.018,0.072,0.007,0.127-0.026,0.19c-0.053,0.101-0.112,0.062-0.165,0.128 c-0.05,0.062-0.099,0.276-0.079,0.362c-0.169,0.058-0.01,0.227-0.015,0.35c-0.002,0.05-0.041,0.105-0.045,0.161 c-0.01,0.119,0.017,0.266,0.068,0.37c0.097,0.198,0.268,0.413,0.435,0.544c0.19,0.148,0.365,0.572,0.608,0.631 c0.177,0.042,0.384-0.104,0.543-0.143c0.18-0.043,0.397,0.01,0.571-0.053c0.222-0.079,0.127-0.337,0.288-0.45 c0.104-0.074,0.287-0.01,0.406-0.051c0.2-0.069,0.339-0.263,0.376-0.46c0.016-0.082,0.01-0.145,0.039-0.221 c0.039-0.103,0.111-0.16,0.09-0.293c-0.01-0.062-0.052-0.12-0.064-0.187c-0.022-0.114,0.002-0.224,0-0.337 c-0.003-0.2,0.017-0.379-0.078-0.55c-0.38-0.688-1.236-0.929-1.975-0.789c-0.18,0.034-0.287,0.126-0.442,0.207 c-0.17,0.088-0.139,0.166-0.318,0.224c-0.081,0.026-0.216,0.124-0.215,0.224c0.001,0.115,0.005,0.051,0.012,0.169 c-0.021,0.011-0.021-0.005-0.03-0.025"/> <path fill="#FFFFFF" d="M46.439-71.653c0.018,0.072,0.007,0.127-0.026,0.19c-0.053,0.101-0.112,0.062-0.165,0.128 c-0.05,0.062-0.099,0.276-0.079,0.362c-0.169,0.058-0.01,0.227-0.015,0.35c-0.002,0.05-0.041,0.105-0.045,0.161 c-0.01,0.119,0.017,0.266,0.068,0.37c0.097,0.198,0.268,0.413,0.435,0.544c0.19,0.148,0.365,0.572,0.608,0.631 c0.177,0.042,0.384-0.104,0.543-0.143c0.18-0.043,0.397,0.01,0.571-0.053c0.222-0.079,0.127-0.337,0.288-0.45 c0.104-0.074,0.287-0.01,0.406-0.051c0.2-0.069,0.339-0.263,0.376-0.46c0.016-0.082,0.01-0.145,0.039-0.221 c0.039-0.103,0.111-0.16,0.09-0.293c-0.01-0.062-0.052-0.12-0.064-0.187c-0.022-0.114,0.002-0.224,0-0.337 c-0.003-0.2,0.017-0.379-0.078-0.55c-0.38-0.688-1.236-0.929-1.975-0.789c-0.18,0.034-0.287,0.126-0.442,0.207 c-0.17,0.088-0.139,0.166-0.318,0.224c-0.081,0.026-0.216,0.124-0.215,0.224c0.001,0.115,0.005,0.051,0.012,0.169 c-0.021,0.011-0.021-0.005-0.03-0.025"/> <path fill="#FFFFFF" d="M38.772-71.653c0.018,0.072,0.007,0.127-0.026,0.19c-0.053,0.101-0.112,0.062-0.165,0.128 c-0.05,0.062-0.099,0.276-0.079,0.362c-0.169,0.058-0.01,0.227-0.015,0.35c-0.002,0.05-0.041,0.105-0.045,0.161 c-0.01,0.119,0.017,0.266,0.068,0.37c0.097,0.198,0.268,0.413,0.435,0.544c0.19,0.148,0.365,0.572,0.608,0.631 c0.177,0.042,0.384-0.104,0.543-0.143c0.18-0.043,0.397,0.01,0.571-0.053c0.222-0.079,0.127-0.337,0.288-0.45 c0.104-0.074,0.287-0.01,0.406-0.051c0.2-0.069,0.339-0.263,0.376-0.46c0.016-0.082,0.01-0.145,0.039-0.221 c0.039-0.103,0.111-0.16,0.09-0.293c-0.01-0.062-0.052-0.12-0.064-0.187c-0.022-0.114,0.002-0.224,0-0.337 c-0.003-0.2,0.017-0.379-0.078-0.55c-0.38-0.688-1.236-0.929-1.975-0.789c-0.18,0.034-0.287,0.126-0.442,0.207 c-0.17,0.088-0.139,0.166-0.318,0.224c-0.081,0.026-0.216,0.124-0.215,0.224c0.001,0.115,0.005,0.051,0.012,0.169 c-0.021,0.011-0.021-0.005-0.03-0.025"/> <path fill="#FFFFFF" d="M31.105-71.653c0.018,0.072,0.007,0.127-0.026,0.19c-0.053,0.101-0.112,0.062-0.165,0.128 c-0.05,0.062-0.099,0.276-0.079,0.362c-0.169,0.058-0.01,0.227-0.015,0.35c-0.002,0.05-0.041,0.105-0.045,0.161 c-0.01,0.119,0.017,0.266,0.068,0.37c0.097,0.198,0.268,0.413,0.435,0.544c0.19,0.148,0.365,0.572,0.608,0.631 c0.177,0.042,0.384-0.104,0.543-0.143c0.18-0.043,0.397,0.01,0.571-0.053c0.222-0.079,0.127-0.337,0.288-0.45 c0.104-0.074,0.287-0.01,0.406-0.051c0.2-0.069,0.339-0.263,0.376-0.46c0.016-0.082,0.01-0.145,0.039-0.221 c0.039-0.103,0.111-0.16,0.09-0.293c-0.01-0.062-0.052-0.12-0.064-0.187c-0.022-0.114,0.002-0.224,0-0.337 c-0.003-0.2,0.017-0.379-0.078-0.55c-0.38-0.688-1.236-0.929-1.975-0.789c-0.18,0.034-0.287,0.126-0.442,0.207 c-0.17,0.088-0.139,0.166-0.318,0.224c-0.081,0.026-0.216,0.124-0.215,0.2Line truncated
|
||||
Blood Sugar: <%= `${plugins.nightscout.data[plugins.nightscout.data.length-1].sgv}${plugins.nightscout.data[plugins.nightscout.data.length-1].arrowHumanReadable} (${plugins.nightscout.data[plugins.nightscout.data.length-1].alert})`%>
|
||||
</h2>
|
||||
<% if (plugins.nightscout.data.length > 1) { %>
|
||||
<section class="column chart">
|
||||
<div class="chart-bars" style="margin-top: 0px; margin-bottom:0px;">
|
||||
<div class="field" style="width: 200%;">
|
||||
<% { let previous = null; for (const dataObject of Object.values(plugins.nightscout.data)) { const p = dataObject.sgv/Math.max.apply(Math, Object.values(plugins.nightscout.data).map(function(o) { return o.sgv; })); %>
|
||||
<div class="entry" style="margin-top: auto;">
|
||||
<span class="value" style="font-size: <%= 125*(10/plugins.nightscout.data.length) %>%;"><%= dataObject.sgv != 0 ? f(dataObject.sgv, {sign:false}) : "" %></span>
|
||||
<div class="bar" style="height: <%= p*75 %>px; width: 50%; background-color: <%= dataObject.color %>"></div>
|
||||
<div style="font-size: <%= 125*(10/plugins.nightscout.data.length) %>%;">
|
||||
<%= dataObject.timeUTCHumanReadable %>
|
||||
</div>
|
||||
</div>
|
||||
<% previous = dataObject.sgv } } %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom"><i>All times are in UTC.</i></div>
|
||||
|
||||
</section>
|
||||
<%# Do stuff in there -%>
|
||||
</section>
|
||||
<% } %>
|
||||
<% } %>
|
||||
</div>
|
||||
</section>
|
||||
<% } %>
|
||||
|
||||
Reference in new issue
Block a user