Skip to content

Commit

Permalink
## 0.10.0 (2020-02-27)
Browse files Browse the repository at this point in the history
* (Volker Richert) Added the possibility to use the external nightscout server again
* (Volker Richert) Added the cage & sage to the objects
  • Loading branch information
GermanBluefox committed Feb 26, 2020
1 parent 861365b commit fd49aec
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 23 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ on('nightscout.0.data.mgdl', obj => {


## Changelog
## 0.10.0 (2020-02-27)
* (Volker Richert) Added the possibility to use the external nightscout server again
* (Volker Richert) Added the cage & sage to the objects

### 0.9.10 (2020-02-14)
* (Volker Richert) Fixed last Updated value

Expand Down
14 changes: 13 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"common": {
"name": "nightscout",
"version": "0.9.7",
"version": "0.10.0",
"news": {
"0.10.0": {
"en": "Added the possibility to use the external nightscout server again\nAdded the cage & sage to the objects",
"de": "Es wurde die Möglichkeit hinzugefügt, den externen Nightcout-Server erneut zu verwenden\nKäfig & Salbei zu den Objekten hinzugefügt",
"ru": "Добавлена возможность снова использовать внешний сервер nightcout\nДобавил клетку и шалфей к объектам",
"pt": "Foi adicionada a possibilidade de usar o servidor externo noturno novamente\nAdicionado gaiola e sálvia aos objetos",
"nl": "De mogelijkheid toegevoegd om de externe nightscout-server opnieuw te gebruiken\nDe kooi en salie toegevoegd aan de objecten",
"fr": "Ajout de la possibilité d'utiliser à nouveau le serveur de nightcout externe\nAjout de la cage et de la sauge aux objets",
"it": "Aggiunta la possibilità di utilizzare nuovamente il server nightscout esterno\nAggiunta la gabbia e la salvia agli oggetti",
"es": "Se agregó la posibilidad de volver a usar el servidor externo de nightcout\nSe agregó la jaula y la salvia a los objetos.",
"pl": "Dodano możliwość ponownego korzystania z zewnętrznego serwera nightscout\nDodano klatkę i szałwię do obiektów",
"zh-cn": "添加了再次使用外部Nightscout服务器的可能性\n将笼子和鼠尾草添加到对象中"
},
"0.9.7": {
"en": "Fixed last Updated value",
"de": "Letzter aktualisierter Wert behoben",
Expand Down
29 changes: 14 additions & 15 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,16 @@ function NightscoutClient(adapter, URL, secretHash) {

let prevDate = 0;

sitechangeTreatments.forEach((treatment) => {
sitechangeTreatments.forEach(treatment => {
const treatmentDate = treatment.mills;

if (treatmentDate > prevDate && treatmentDate <= now) {
prevDate = treatmentDate;

const b = moment(treatmentDate),
days = a.diff(b, 'days'),
hours = a.diff(b, 'hours') - days * 24,
age = a.diff(b, 'hours');
const b = moment(treatmentDate);
const days = a.diff(b, 'days');
const hours = a.diff(b, 'hours') - days * 24;
const age = a.diff(b, 'hours');

if (!cannulaInfo.found || (age >= 0 && age < cannulaInfo.age)) {
cannulaInfo.found = true;
Expand All @@ -178,10 +178,9 @@ function NightscoutClient(adapter, URL, secretHash) {
}
}

const sensorTreatments = dataUpdate.treatments.filter((treatment) => {
return treatment.eventType.indexOf('Sensor Start') > -1 ||
treatment.eventType.indexOf('Sensor Change') > -1;
});
const sensorTreatments = dataUpdate.treatments.filter(treatment =>
treatment.eventType.indexOf('Sensor Start') > -1 ||
treatment.eventType.indexOf('Sensor Change') > -1);

if (sensorTreatments.length) {
const sensorInfo = {
Expand All @@ -194,16 +193,16 @@ function NightscoutClient(adapter, URL, secretHash) {

let prevDate = 0;

sensorTreatments.forEach((treatment) => {
sensorTreatments.forEach(treatment => {
const treatmentDate = treatment.mills;

if (treatmentDate > prevDate && treatmentDate <= now) {
prevDate = treatmentDate;

const b = moment(treatmentDate),
days = a.diff(b, 'days'),
hours = a.diff(b, 'hours') - days * 24,
age = a.diff(b, 'hours');
const b = moment(treatmentDate);
const days = a.diff(b, 'days');
const hours = a.diff(b, 'hours') - days * 24;
const age = a.diff(b, 'hours');

if (!sensorInfo.found || (age >= 0 && age < sensorInfo.age)) {
sensorInfo.found = true;
Expand Down Expand Up @@ -243,4 +242,4 @@ function NightscoutClient(adapter, URL, secretHash) {
// extend the EventEmitter class using our class
util.inherits(NightscoutClient, EventEmitter);

module.exports = NightscoutClient;
module.exports = NightscoutClient;
12 changes: 6 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,19 @@ function startAdapter(options) {

online: true // default value
}, result => {
if (result.error) {
adapter.log.error('Cannot render website: ' + JSON.stringify(result.error));
if (!result || result.error) {
adapter.log.error('Cannot render website: ' + JSON.stringify(result && result.error));
adapter.setState('trigger.picture', false, true);
} else {
adapter.setState('trigger.picture', true, true);
}
if (result.stderr) {
if (result && result.stderr) {
adapter.log.error('Cannot render website: ' + result.stderr);
}
if (result.stdout) {
if (result && result.stdout) {
adapter.log.debug('Nightscout rendered: ' + result.stdout);
}
adapter.log.debug('Nightscout rendered: ' + result.output);
adapter.log.debug('Nightscout rendered: ' + (result && result.output));
adapter.log.debug('Picture can be find under phantomjs.0.pictures.nightscout_png');
});
})
Expand Down Expand Up @@ -273,4 +273,4 @@ if (module.parent) {
} else {
// otherwise start the instance directly
startAdapter();
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.nightscout",
"version": "0.9.7",
"version": "0.10.0",
"description": "Provides nightscout server for sugar monitoring",
"author": {
"name": "bluefox",
Expand Down

0 comments on commit fd49aec

Please sign in to comment.