iobroker.netatmo
Advanced tools
Comparing version 1.4.0 to 1.4.2
{ | ||
"common": { | ||
"name": "netatmo", | ||
"version": "1.4.0", | ||
"version": "1.4.2", | ||
"title": "Netatmo", | ||
@@ -10,2 +10,26 @@ "titleLang": { | ||
"news": { | ||
"1.4.2": { | ||
"en": "Removed warnings about the type of states", | ||
"de": "Warnungen über die Art der Zustände entfernt", | ||
"ru": "Убраны предупреждения о типе состояний", | ||
"pt": "Remoção de avisos sobre o tipo de estado", | ||
"nl": "Waarschuwingen over het type toestanden verwijderd", | ||
"fr": "Suppression des avertissements sur le type d'états", | ||
"it": "Rimossi gli avvisi sul tipo di stati", | ||
"es": "Se eliminaron las advertencias sobre el tipo de estados.", | ||
"pl": "Usunięto ostrzeżenia o rodzaju stanów", | ||
"zh-cn": "删除了关于状态类型的警告" | ||
}, | ||
"1.4.1": { | ||
"en": "Removed warnings about the type of states", | ||
"de": "Warnungen über die Art der Zustände entfernt", | ||
"ru": "Убраны предупреждения о типе состояний", | ||
"pt": "Remoção de avisos sobre o tipo de estado", | ||
"nl": "Waarschuwingen over het type toestanden verwijderd", | ||
"fr": "Suppression des avertissements sur le type d'états", | ||
"it": "Rimossi gli avvisi sul tipo di stati", | ||
"es": "Se eliminaron las advertencias sobre el tipo de estados.", | ||
"pl": "Usunięto ostrzeżenia o rodzaju stanów", | ||
"zh-cn": "删除了关于状态类型的警告" | ||
}, | ||
"1.4.0": { | ||
@@ -50,3 +74,4 @@ "en": "Added the support of admin5 \nRemoved warnings about the type of states", | ||
"connectionType": "cloud", | ||
"dataSource": "push", | ||
"dataSource": "poll", | ||
"tier": 2, | ||
"enabled": false, | ||
@@ -53,0 +78,0 @@ "messagebox": true, |
@@ -36,8 +36,6 @@ module.exports = function (myapi, myadapter) { | ||
name: deviceName, | ||
type: aDevice.type, | ||
read: true, | ||
write: false | ||
}, | ||
native: { | ||
id: aDevice._id | ||
id: aDevice._id, | ||
type: aDevice.type | ||
} | ||
@@ -269,2 +267,10 @@ }, () => handleCoachModule(aDevice, aParent) | ||
if (typeof aModule.dashboard_data.Temperature !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Temperature', | ||
role: 'temperature' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.Temperature', { | ||
@@ -444,6 +450,15 @@ type: 'state', | ||
if (!aModule.dashboard_data) | ||
if (!aModule.dashboard_data) { | ||
return; | ||
} | ||
if (typeof aModule.dashboard_data.CO2 !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'CO2', | ||
role: 'co2' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.CO2', { | ||
@@ -483,6 +498,15 @@ type: 'state', | ||
if (!aModule.dashboard_data) | ||
if (!aModule.dashboard_data) { | ||
return; | ||
} | ||
if (typeof aModule.dashboard_data.Humidity !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Humidity', | ||
role: 'humidity' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.Humidity', { | ||
@@ -507,6 +531,15 @@ type: 'state', | ||
if (!aModule.dashboard_data) | ||
if (!aModule.dashboard_data) { | ||
return; | ||
} | ||
if (typeof aModule.dashboard_data.Noise !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Noise', | ||
role: 'noise' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.Noise', { | ||
@@ -531,6 +564,15 @@ type: 'state', | ||
if (!aModule.dashboard_data) | ||
if (!aModule.dashboard_data) { | ||
return; | ||
} | ||
if (typeof aModule.dashboard_data.health_idx !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Health index', | ||
role: 'health' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.HealthIdx', { | ||
@@ -589,3 +631,15 @@ type: 'state', | ||
if (!aModule.place) { | ||
return; | ||
} | ||
if (typeof aModule.place.city !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Place', | ||
role: 'location' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.city', { | ||
@@ -655,2 +709,10 @@ type: 'state', | ||
if (typeof aModule.dashboard_data.Pressure !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Pressure', | ||
role: 'pressure' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.Pressure', { | ||
@@ -657,0 +719,0 @@ type: 'state', |
@@ -9,2 +9,3 @@ module.exports = function (myapi, myadapter) { | ||
api.getStationsData({}, async (err, data) => { | ||
adapter.logLevel.debug('Received data: ' + JSON.stringify(data)); | ||
if (err === null) { | ||
@@ -42,7 +43,5 @@ if (Array.isArray(data)) { | ||
name: deviceName, | ||
type: aDevice.type, | ||
read: true, | ||
write: false | ||
}, | ||
native: { | ||
type: aDevice.type, | ||
id: aDevice._id | ||
@@ -223,6 +222,15 @@ } | ||
if (!aModule.dashboard_data) | ||
if (!aModule.dashboard_data) { | ||
return; | ||
} | ||
if (typeof aModule.dashboard_data.Temperature !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Temperature', | ||
role: 'temperature' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.Temperature', { | ||
@@ -403,6 +411,15 @@ type: 'state', | ||
if (!aModule.dashboard_data) | ||
if (!aModule.dashboard_data) { | ||
return; | ||
} | ||
if (typeof aModule.dashboard_data.CO2 !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'CO2', | ||
role: 'co2' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.CO2', { | ||
@@ -442,6 +459,15 @@ type: 'state', | ||
if (!aModule.dashboard_data) | ||
if (!aModule.dashboard_data) { | ||
return; | ||
} | ||
if (typeof aModule.dashboard_data.Humidity !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Humidity', | ||
role: 'humidity' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.Humidity', { | ||
@@ -466,6 +492,15 @@ type: 'state', | ||
if (!aModule.dashboard_data) | ||
if (!aModule.dashboard_data) { | ||
return; | ||
} | ||
if (typeof aModule.dashboard_data.Noise !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Noise', | ||
role: 'noise' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.Noise', { | ||
@@ -490,6 +525,15 @@ type: 'state', | ||
if (!aModule.dashboard_data) | ||
if (!aModule.dashboard_data) { | ||
return; | ||
} | ||
if (typeof aModule.dashboard_data.Pressure !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Pressure', | ||
role: 'pressure' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.Pressure', { | ||
@@ -550,2 +594,10 @@ type: 'state', | ||
if (typeof aModule.dashboard_data.Rain !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Rain', | ||
role: 'rain' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.Rain', { | ||
@@ -667,2 +719,10 @@ type: 'state', | ||
if (typeof aModule.dashboard_data.WindStrength !== 'undefined') { | ||
await adapter.setObjectNotExistsAsync(aParent, { | ||
type: 'channel', | ||
common: { | ||
name: 'Wind', | ||
role: 'wind' | ||
} | ||
}); | ||
await adapter.setObjectNotExistsAsync(aParent + '.WindStrength', { | ||
@@ -669,0 +729,0 @@ type: 'state', |
@@ -8,4 +8,4 @@ module.exports = function (myapi, myadapter) { | ||
const EventCleanUpTimer = {}; | ||
const PersonCleanUpTimer = {}; | ||
const eventCleanUpTimer = {}; | ||
const personCleanUpTimer = {}; | ||
@@ -37,2 +37,4 @@ let knownPeople = []; | ||
} | ||
Object.keys(eventCleanUpTimer).forEach(id => clearInterval(eventCleanUpTimer[id])); | ||
Object.keys(personCleanUpTimer).forEach(id => clearInterval(personCleanUpTimer[id])); | ||
}; | ||
@@ -52,30 +54,27 @@ | ||
this.requestUpdateIndoorCamera = function () { | ||
api.getHomeData({}, (err, data) => { | ||
if (err !== null) { | ||
adapter.log.error(err); | ||
} | ||
else { | ||
const homes = data.homes; | ||
homeIds = []; | ||
return new Promise(resolve => { | ||
api.getHomeData({}, async (err, data) => { | ||
if (err !== null) { | ||
adapter.log.error(err); | ||
} else { | ||
const homes = data.homes; | ||
homeIds = []; | ||
if (Array.isArray(homes)) { | ||
homes.forEach(async aHome => { | ||
await handleHome(aHome); | ||
if (Array.isArray(homes)) { | ||
for (let h = 0; h < homes.length; h++) { | ||
const aHome = homes[h]; | ||
await handleHome(aHome); | ||
const homeName = getHomeName(aHome.name); | ||
const homeName = getHomeName(aHome.name); | ||
if (!EventCleanUpTimer[homeName]) { | ||
const _welcomeCleanUpTimer = setInterval(() => | ||
eventCleanUpTimer[homeName] = eventCleanUpTimer[homeName] || setInterval(() => | ||
cleanUpEvents(homeName), cleanUpInterval * 60 * 1000); | ||
EventCleanUpTimer[homeName] = _welcomeCleanUpTimer; | ||
} | ||
if (!PersonCleanUpTimer[homeName]) { | ||
const _welcomeCleanUpTimer = setInterval(() => | ||
personCleanUpTimer[homeName] = personCleanUpTimer[homeName] || setInterval(() => | ||
cleanUpUnknownPersons(homeName), cleanUpInterval * 60 * 1000); | ||
PersonCleanUpTimer[homeName] = _welcomeCleanUpTimer; | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
resolve(); | ||
}); | ||
}); | ||
@@ -85,4 +84,6 @@ }; | ||
async function onSocketAlert(data) { | ||
adapter.log.info(JSON.stringify(data)); | ||
adapter.log.debug(JSON.stringify(data)); | ||
await that.requestUpdateIndoorCamera(); | ||
const now = new Date().toISOString(); | ||
@@ -192,4 +193,2 @@ | ||
await adapter.setStateAsync(path + 'LastEventId', {val: data.event_id, ack: true}); | ||
that.requestUpdateIndoorCamera(); | ||
} | ||
@@ -223,4 +222,2 @@ } | ||
await adapter.setStateAsync(homeName, aHome.id, true); | ||
await adapter.setObjectNotExistsAsync(homeName + '.LastEventData.LastMovementDetected', { | ||
@@ -550,3 +547,2 @@ type: 'state', | ||
async function handleCamera(aCamera, aHome) { | ||
const aParent = getHomeName(aHome.name); | ||
@@ -557,3 +553,2 @@ const fullPath = aParent + '.' + aCamera.name; | ||
await adapter.setObjectNotExistsAsync(fullPath, { | ||
@@ -636,3 +631,3 @@ type: 'device', | ||
name: 'Camera name', | ||
type: 'state', | ||
type: 'string', | ||
read: true, | ||
@@ -1137,3 +1132,2 @@ write: false | ||
aEvent.event_list.forEach(async aEventList => { | ||
// adapter.log.info(JSON.stringify(aEvent)); | ||
EventList = aEventList; | ||
@@ -1140,0 +1134,0 @@ counter++; |
17
main.js
@@ -21,4 +21,5 @@ /* jshint -W097 */ | ||
let _deviceUpdateTimer; | ||
let _welcomeUpdateTimer; | ||
let _coachUpdateInterval; | ||
let _weatherUpdateInterval; | ||
let _welcomeUpdateInterval; | ||
@@ -62,4 +63,8 @@ String.prototype.replaceAll = function (search, replacement) { | ||
adapter.on('unload', function (callback) { | ||
adapter.on('unload', callback => { | ||
try { | ||
_coachUpdateInterval && clearInterval(_coachUpdateInterval); | ||
_weatherUpdateInterval && clearInterval(_weatherUpdateInterval); | ||
_welcomeUpdateInterval && clearInterval(_welcomeUpdateInterval); | ||
welcome && welcome.finalize(); | ||
@@ -140,3 +145,3 @@ | ||
_deviceUpdateTimer = setInterval(() => | ||
_coachUpdateInterval = setInterval(() => | ||
coach.requestUpdateCoachStation(), adapter.config.check_interval * 60 * 1000); | ||
@@ -150,3 +155,3 @@ } | ||
_deviceUpdateTimer = setInterval(() => | ||
_weatherUpdateInterval = setInterval(() => | ||
station.requestUpdateWeatherStation(), adapter.config.check_interval * 60 * 1000); | ||
@@ -160,3 +165,3 @@ } | ||
_welcomeUpdateTimer = setInterval(() => | ||
_welcomeUpdateInterval = setInterval(() => | ||
welcome.requestUpdateIndoorCamera(), adapter.config.check_interval * 2 * 60 * 1000); | ||
@@ -163,0 +168,0 @@ } |
{ | ||
"name": "iobroker.netatmo", | ||
"version": "1.4.0", | ||
"version": "1.4.2", | ||
"description": "ioBroker netatmo Adapter", | ||
"authors": { | ||
"name": "Patrick Arns", | ||
"email": "iobroker@patrick-arns.de" | ||
}, | ||
"author": "Patrick Arns <iobroker@patrick-arns.de>", | ||
"contributors": [ | ||
@@ -40,2 +37,3 @@ { | ||
}, | ||
"main": "main.js", | ||
"devDependencies": { | ||
@@ -42,0 +40,0 @@ "@alcalzone/release-script": "^2.0.0", |
@@ -37,2 +37,5 @@ ![Logo](admin/netatmo.png) | ||
## Changelog | ||
### 1.4.2 (2021-06-27) | ||
* (bluefox) Removed warnings about the type of states | ||
### 1.4.0 (2021-06-24) | ||
@@ -124,12 +127,12 @@ * (bluefox) Added the support of admin5 | ||
#### 0.2.1 | ||
### 0.2.1 | ||
* (PArns) Corrected DateTime values & object types | ||
#### 0.2.0 | ||
### 0.2.0 | ||
* (PArns) Added SumRain1Max/SumRain1MaxDate & SumRain24Max/SumRain24MaxDate to get overall rain max since adapter installation | ||
#### 0.1.1 | ||
### 0.1.1 | ||
* (PArns) Fixed TemperatureAbsoluteMin/TemperatureAbsoluteMax | ||
#### 0.1.0 | ||
### 0.1.0 | ||
* (PArns) Fixed CO2 calibrating status | ||
@@ -139,12 +142,12 @@ * (PArns) Added last update for devices | ||
#### 0.0.4 | ||
### 0.0.4 | ||
* (PArns) Fixed typo/missing parameter in GustStrength | ||
#### 0.0.3 | ||
### 0.0.3 | ||
* (PArns) Added error handling to prevent exceptions for missing parameters | ||
#### 0.0.2 | ||
### 0.0.2 | ||
* (PArns) Fixed rain sensor | ||
#### 0.0.1 | ||
### 0.0.1 | ||
* (PArns) Initial release | ||
@@ -155,2 +158,2 @@ | ||
Copyright (c) 2016-2017 Patrick Arns <iobroker@patrick-arns.de> | ||
Copyright (c) 2016-2021 Patrick Arns <iobroker@patrick-arns.de> |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
203679
4015
155
0