iobroker.netatmo
Advanced tools
Comparing version 1.3.3 to 1.4.0
{ | ||
"common": { | ||
"name": "netatmo", | ||
"version": "1.3.3", | ||
"title": "Netatmo Adapter", | ||
"desc": { | ||
"en": "ioBroker netatmo Adapter", | ||
"de": "ioBroker Netatmo Adapter", | ||
"ru": "ioBroker Netatmo драйвер как образец" | ||
"common": { | ||
"name": "netatmo", | ||
"version": "1.4.0", | ||
"title": "Netatmo", | ||
"titleLang": { | ||
"en": "Netatmo" | ||
}, | ||
"news": { | ||
"1.4.0": { | ||
"en": "Added the support of admin5 \nRemoved warnings about the type of states", | ||
"de": "Unterstützung von admin5 . hinzugefügt\nWarnungen über die Art der Zustände entfernt", | ||
"ru": "Добавлена поддержка admin5\nУбраны предупреждения о типе состояний", | ||
"pt": "Adicionado o suporte de admin5\nRemoção de avisos sobre o tipo de estado", | ||
"nl": "Ondersteuning toegevoegd van admin5\nWaarschuwingen over het type toestanden verwijderd", | ||
"fr": "Ajout du support d'admin5\nSuppression des avertissements sur le type d'états", | ||
"it": "Aggiunto il supporto di admin5\nRimossi gli avvisi sul tipo di stati", | ||
"es": "Se agregó el soporte de admin5.\nSe eliminaron las advertencias sobre el tipo de estados.", | ||
"pl": "Dodano wsparcie admin5\nUsunięto ostrzeżenia o rodzaju stanów", | ||
"zh-cn": "增加了admin5的支持\n删除了关于状态类型的警告" | ||
}, | ||
"1.3.4": { | ||
"en": "Added the support of admin5 \nRemoved warnings about the type of states", | ||
"de": "Unterstützung von admin5 . hinzugefügt\nWarnungen über die Art der Zustände entfernt", | ||
"ru": "Добавлена поддержка admin5\nУбраны предупреждения о типе состояний", | ||
"pt": "Adicionado o suporte de admin5\nRemoção de avisos sobre o tipo de estado", | ||
"nl": "Ondersteuning toegevoegd van admin5\nWaarschuwingen over het type toestanden verwijderd", | ||
"fr": "Ajout du support d'admin5\nSuppression des avertissements sur le type d'états", | ||
"it": "Aggiunto il supporto di admin5\nRimossi gli avvisi sul tipo di stati", | ||
"es": "Se agregó el soporte de admin5.\nSe eliminaron las advertencias sobre el tipo de estados.", | ||
"pl": "Dodano wsparcie admin5\nUsunięto ostrzeżenia o rodzaju stanów", | ||
"zh-cn": "增加了admin5的支持\n删除了关于状态类型的警告" | ||
}, | ||
"1.3.3": { | ||
"en": "removed person history" | ||
} | ||
}, | ||
"desc": { | ||
"en": "netatmo", | ||
"de": "Netatmo", | ||
"ru": "Netatmo" | ||
}, | ||
"license": "MIT", | ||
"platform": "Javascript/Node.js", | ||
"mode": "daemon", | ||
"icon": "netatmo.png", | ||
"compact": true, | ||
"connectionType": "cloud", | ||
"dataSource": "push", | ||
"enabled": false, | ||
"messagebox": true, | ||
"adminUI": { | ||
"config": "json" | ||
}, | ||
"extIcon": "https://raw.githubusercontent.com/PArns/ioBroker.netatmo/master/admin/netatmo.png", | ||
"keywords": [ | ||
"netatmo" | ||
], | ||
"readme": "https://github.com/PArns/ioBroker.netatmo/blob/master/README.md", | ||
"loglevel": "info", | ||
"type": "weather", | ||
"authors": [ | ||
"Patrick Arns <iobroker@patrick-arns.de>" | ||
] | ||
}, | ||
"license": "MIT", | ||
"platform": "Javascript/Node.js", | ||
"mode": "daemon", | ||
"icon": "netatmo.png", | ||
"enabled": false, | ||
"messagebox": true, | ||
"extIcon": "https://raw.githubusercontent.com/PArns/ioBroker.netatmo/master/admin/netatmo.png", | ||
"keywords": [ | ||
"netatmo" | ||
"protectedNative": [ | ||
"secret", | ||
"id", | ||
"username", | ||
"password" | ||
], | ||
"readme": "https://github.com/PArns/ioBroker.netatmo/blob/master/README.md", | ||
"loglevel": "info", | ||
"type": "weather", | ||
"authors": [ | ||
"Patrick Arns <iobroker@patrick-arns.de>" | ||
] | ||
}, | ||
"native": { | ||
"netatmoWeather": true, | ||
"netatmoWelcome": false, | ||
"netatmoCoach": false, | ||
"username": "", | ||
"password": "", | ||
"check_interval": 5, | ||
"cleanup_interval": 60, | ||
"event_time": 12, | ||
"unknown_person_time": 24, | ||
"location_elevation": 0, | ||
"id": "", | ||
"secret": "" | ||
}, | ||
"objects": [ | ||
] | ||
} | ||
"native": { | ||
"netatmoWeather": true, | ||
"netatmoWelcome": false, | ||
"netatmoCoach": false, | ||
"username": "", | ||
"password": "", | ||
"check_interval": 5, | ||
"cleanup_interval": 60, | ||
"event_time": 12, | ||
"unknown_person_time": 24, | ||
"location_elevation": 0, | ||
"id": "", | ||
"secret": "" | ||
}, | ||
"objects": [] | ||
} |
172
main.js
@@ -1,74 +0,80 @@ | ||
/* jshint -W097 */// jshint strict:false | ||
/*jslint node: true */ | ||
"use strict"; | ||
/* jshint -W097 */ | ||
/* jshint strict: false */ | ||
/* jslint node: true */ | ||
'use strict'; | ||
var utils = require('@iobroker/adapter-core'); | ||
var adapter = utils.Adapter('netatmo'); | ||
const adapterName = require('./package.json').name.split('.').pop(); | ||
const utils = require('@iobroker/adapter-core'); | ||
var netatmo = require('./netatmoLib'); | ||
var api = null; | ||
const netatmo = require('./lib/netatmoLib'); | ||
let api = null; | ||
var NetatmoCoach = require("./netatmoCoach"); | ||
var coach = null; | ||
const NetatmoCoach = require('./lib/netatmoCoach'); | ||
let coach = null; | ||
var NetatmoStation = require("./netatmoStation"); | ||
var station = null; | ||
const NetatmoStation = require('./lib/netatmoStation'); | ||
let station = null; | ||
var NetatmoWelcome = require("./netatmoWelcome"); | ||
var welcome = null; | ||
const NetatmoWelcome = require('./lib/netatmoWelcome'); | ||
let welcome = null; | ||
var _deviceUpdateTimer; | ||
var _welcomeUpdateTimer; | ||
let _deviceUpdateTimer; | ||
let _welcomeUpdateTimer; | ||
String.prototype.replaceAll = function (search, replacement) { | ||
var target = this; | ||
const target = this; | ||
return target.replace(new RegExp(search, 'g'), replacement); | ||
}; | ||
adapter.on('message', function (obj) { | ||
let adapter; | ||
adapter.log.info(JSON.stringify(obj)); | ||
function startAdapter(options) { | ||
options = options || {}; | ||
Object.assign(options, { | ||
name: adapterName, // adapter name | ||
}); | ||
if (obj.command === "send") { | ||
obj.command = obj.message; | ||
obj.message = null; | ||
} | ||
adapter = new utils.Adapter(options); | ||
adapter.on('message', obj => { | ||
if (obj.command === 'send') { | ||
obj.command = obj.message; | ||
obj.message = null; | ||
} | ||
if (obj) { | ||
switch (obj.command) { | ||
case 'setAway': | ||
if (welcome) { | ||
welcome.setAway(obj.message); | ||
} | ||
if (obj) { | ||
switch (obj.command) { | ||
case 'setAway': | ||
welcome && welcome.setAway(obj.message); | ||
if (obj.callback) | ||
adapter.sendTo(obj.from, obj.command, {}, obj.callback); | ||
obj.callback && adapter.sendTo(obj.from, obj.command, {}, obj.callback); | ||
break; | ||
default: | ||
adapter.log.warn("Unknown command: " + obj.command); | ||
break; | ||
break; | ||
default: | ||
adapter.log.warn('Unknown command: ' + obj.command); | ||
break; | ||
} | ||
} | ||
} | ||
return true; | ||
}); | ||
return true; | ||
}); | ||
adapter.on('unload', function (callback) { | ||
try { | ||
if (welcome) | ||
welcome.finalize(); | ||
adapter.on('unload', function (callback) { | ||
try { | ||
welcome && welcome.finalize(); | ||
adapter.log.info('cleaned everything up...'); | ||
callback(); | ||
} catch (e) { | ||
callback(); | ||
} | ||
}); | ||
adapter.log.info('cleaned everything up...'); | ||
callback(); | ||
} catch (e) { | ||
callback(); | ||
} | ||
}); | ||
adapter.on('ready', function () { | ||
adapter.on('ready', main); | ||
} | ||
function main() { | ||
if (adapter.config.username && adapter.config.password) { | ||
var scope = ""; | ||
var id = "574ddd152baa3cf9598b46cd"; | ||
var secret = "6e3UcBKp005k9N0tpwp69fGYECqOpuhtEE9sWJW"; | ||
let scope = ''; | ||
let id = '574ddd152baa3cf9598b46cd'; | ||
let secret = '6e3UcBKp005k9N0tpwp69fGYECqOpuhtEE9sWJW'; | ||
@@ -79,24 +85,20 @@ // Backward compatibility begin ... | ||
if (!(adapter.config.netatmoCoach || adapter.config.netatmoWeather || adapter.config.netatmoWelcome)) { | ||
adapter.log.info("No product was choosen, using Weatherstation as default!"); | ||
adapter.log.info('No product was chosen, using Weatherstation as default!'); | ||
adapter.config.netatmoWeather = true; | ||
} | ||
if (!adapter.config.check_interval) | ||
adapter.config.check_interval = 10; | ||
adapter.config.check_interval = adapter.config.check_interval || 10; | ||
if (!adapter.config.cleanup_interval) | ||
adapter.config.cleanup_interval = 60; | ||
adapter.config.cleanup_interval = adapter.config.cleanup_interval || 60; | ||
if (!adapter.config.unknown_person_time) | ||
adapter.config.unknown_person_time = 24; | ||
adapter.config.unknown_person_time = adapter.config.unknown_person_time || 24; | ||
if (!adapter.config.location_elevation) | ||
adapter.config.location_elevation = 0; | ||
adapter.config.location_elevation = adapter.config.location_elevation || 0; | ||
if (adapter.config.netatmoWeather) { | ||
scope += " read_station"; | ||
scope += ' read_station'; | ||
} | ||
if (adapter.config.netatmoCoach) { | ||
scope += " read_homecoach"; | ||
scope += ' read_homecoach'; | ||
} | ||
@@ -108,3 +110,3 @@ | ||
if (adapter.config.netatmoWelcome) { | ||
scope += " read_camera read_presence"; | ||
scope += ' read_camera read_presence'; | ||
@@ -115,3 +117,3 @@ if (adapter.config.id && adapter.config.secret) { | ||
scope += " access_camera access_presence write_camera" | ||
scope += ' access_camera access_presence write_camera' | ||
} | ||
@@ -122,8 +124,8 @@ } | ||
var auth = { | ||
"client_id": id, | ||
"client_secret": secret, | ||
"scope": scope, | ||
"username": adapter.config.username, | ||
"password": adapter.config.password | ||
const auth = { | ||
'client_id': id, | ||
'client_secret': secret, | ||
'scope': scope, | ||
'username': adapter.config.username, | ||
'password': adapter.config.password | ||
}; | ||
@@ -140,5 +142,4 @@ | ||
_deviceUpdateTimer = setInterval(function () { | ||
coach.requestUpdateCoachStation(); | ||
}, adapter.config.check_interval * 60 * 1000); | ||
_deviceUpdateTimer = setInterval(() => | ||
coach.requestUpdateCoachStation(), adapter.config.check_interval * 60 * 1000); | ||
} | ||
@@ -151,5 +152,4 @@ | ||
_deviceUpdateTimer = setInterval(function () { | ||
station.requestUpdateWeatherStation(); | ||
}, adapter.config.check_interval * 60 * 1000); | ||
_deviceUpdateTimer = setInterval(() => | ||
station.requestUpdateWeatherStation(), adapter.config.check_interval * 60 * 1000); | ||
} | ||
@@ -162,9 +162,17 @@ | ||
_welcomeUpdateTimer = setInterval(function () { | ||
welcome.requestUpdateIndoorCamera(); | ||
}, adapter.config.check_interval * 2 * 60 * 1000); | ||
_welcomeUpdateTimer = setInterval(() => | ||
welcome.requestUpdateIndoorCamera(), adapter.config.check_interval * 2 * 60 * 1000); | ||
} | ||
} else { | ||
adapter.log.error('Please add username, password and choose at least one product within the adapter settings!'); | ||
} | ||
} | ||
} else | ||
adapter.log.error("Please add username, password and choose at least one product within the adapter settings!"); | ||
}); | ||
// If started as allInOne mode => return function to create instance | ||
if (module && module.parent) { | ||
module.exports = startAdapter; | ||
} else { | ||
// or start the instance directly | ||
startAdapter(); | ||
} | ||
{ | ||
"name": "iobroker.netatmo", | ||
"version": "1.3.3", | ||
"version": "1.4.0", | ||
"description": "ioBroker netatmo Adapter", | ||
@@ -34,20 +34,12 @@ "authors": { | ||
"dependencies": { | ||
"@iobroker/adapter-core": "^1.0.3", | ||
"@iobroker/adapter-core": "^2.5.0", | ||
"dewpoint": "^1.0.0", | ||
"moment": "^2.18.1", | ||
"request": "^2.81.0", | ||
"moment": "^2.29.1", | ||
"request": "^2.88.2", | ||
"socket.io-client": "^2.3.0" | ||
}, | ||
"devDependencies": { | ||
"grunt": "^1.0.1", | ||
"grunt-replace": "^1.0.1", | ||
"grunt-contrib-jshint": "^1.1.0", | ||
"grunt-jscs": "^3.0.1", | ||
"grunt-http": "^2.2.0", | ||
"grunt-contrib-clean": "^1.1.0", | ||
"grunt-contrib-compress": "^1.4.3", | ||
"grunt-contrib-copy": "^1.0.0", | ||
"grunt-exec": "^3.0.0", | ||
"mocha": "^6.0.2", | ||
"chai": "^4.2.0" | ||
"@alcalzone/release-script": "^2.0.0", | ||
"mocha": "^9.0.1", | ||
"chai": "^4.3.4" | ||
}, | ||
@@ -59,4 +51,4 @@ "bugs": { | ||
"scripts": { | ||
"test": "node node_modules/mocha/bin/mocha --exit" | ||
"release": "release-script" | ||
} | ||
} |
@@ -32,3 +32,10 @@ ![Logo](admin/netatmo.png) | ||
<!-- | ||
Placeholder for the next version (at the beginning of the line): | ||
### __WORK IN PROGRESS__ | ||
--> | ||
## Changelog | ||
### 1.4.0 (2021-06-24) | ||
* (bluefox) Added the support of admin5 | ||
* (bluefox) Removed warnings about the type of states | ||
@@ -35,0 +42,0 @@ ### 1.3.3 |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
198338
3
152
0
12
2
+ Added@iobroker/adapter-core@2.6.12(transitive)
+ Added@iobroker/types@7.0.6(transitive)
- Removed@iobroker/adapter-core@1.0.3(transitive)
- Removed@types/iobroker@1.4.13(transitive)
- Removed@types/node@22.10.8(transitive)
- Removedundici-types@6.20.0(transitive)
Updatedmoment@^2.29.1
Updatedrequest@^2.88.2