From b2eeb13f839a5d2f9f5fcbf606964f6730378ef3 Mon Sep 17 00:00:00 2001 From: zhongjin Date: Wed, 16 Jan 2019 09:09:54 +0800 Subject: [PATCH] sonoff --- .travis.yml | 2 +- README.md | 10 ++-- appveyor.yml | 2 +- io-package.json | 126 +-------------------------------------- lib/server.js | 6 +- lib/utils.js | 4 +- main.js | 2 +- package.json | 15 +++-- test/lib/objects.js | 2 +- test/lib/setup.js | 2 +- test/lib/states.js | 2 +- test/testPackageFiles.js | 6 +- 12 files changed, 29 insertions(+), 150 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0066549..ac22ae3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ before_script: - npm -v - npm install winston@2.3.1 - npm install mqtt@2.13.0 - - 'npm install https://github.com/ioBroker/ioBroker.js-controller/tarball/master --production' + - 'npm install https://github.com/yunkong2/yunkong2.js-controller/tarball/master --production' env: - CXX=g++-4.8 addons: diff --git a/README.md b/README.md index 575b75b..d622b17 100755 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ ![Logo](admin/sonoff.png) -# ioBroker Sonoff +# yunkong2 Sonoff ============== -[![NPM version](http://img.shields.io/npm/v/iobroker.sonoff.svg)](https://www.npmjs.com/package/iobroker.sonoff) -[![Downloads](https://img.shields.io/npm/dm/iobroker.sonoff.svg)](https://www.npmjs.com/package/iobroker.sonoff) -[![Tests](https://travis-ci.org/ioBroker/ioBroker.sonoff.svg?branch=master)](https://travis-ci.org/ioBroker/ioBroker.sonoff) +[![NPM version](http://img.shields.io/npm/v/yunkong2.sonoff.svg)](https://www.npmjs.com/package/yunkong2.sonoff) +[![Downloads](https://img.shields.io/npm/dm/yunkong2.sonoff.svg)](https://www.npmjs.com/package/yunkong2.sonoff) +[![Tests](https://travis-ci.org/yunkong2/yunkong2.sonoff.svg?branch=master)](https://travis-ci.org/yunkong2/yunkong2.sonoff) -[![NPM](https://nodei.co/npm/iobroker.sonoff.png?downloads=true)](https://nodei.co/npm/iobroker.sonoff/) +[![NPM](https://nodei.co/npm/yunkong2.sonoff.png?downloads=true)](https://nodei.co/npm/yunkong2.sonoff/) Requires node.js 4.0 or higher. diff --git a/appveyor.yml b/appveyor.yml index 79a3a51..dedab55 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,7 +17,7 @@ install: - npm install - npm install winston@2.3.1 - npm install mqtt@2.13.0 - - 'npm install https://github.com/ioBroker/ioBroker.js-controller/tarball/master --production' + - 'npm install https://github.com/yunkong2/yunkong2.js-controller/tarball/master --production' test_script: - echo %cd% - node --version diff --git a/io-package.json b/io-package.json index b4ffb52..523cddd 100755 --- a/io-package.json +++ b/io-package.json @@ -2,129 +2,9 @@ "common": { "name": "sonoff", "version": "2.2.3", - "news": { - "2.2.3": { - "en": "Support for compact mode", - "de": "Unterstützung für den Kompaktmodus", - "ru": "Поддержка компактного режима", - "pt": "Suporte para o modo compacto", - "nl": "Ondersteuning voor de compacte modus", - "fr": "Prise en charge du mode compact", - "it": "Supporto per la modalità compatta", - "es": "Soporte para modo compacto", - "pl": "Obsługa trybu kompaktowego" - }, - "2.2.2": { - "en": "Configuration was fixed", - "de": "Die Konfiguration wurde repariert", - "ru": "Конфигурация была исправлена", - "pt": "Configuração foi corrigida", - "nl": "Configuratie was opgelost", - "fr": "La configuration a été corrigée", - "it": "La configurazione è stata riparata", - "es": "La configuración fue arreglada", - "pl": "Konfiguracja została naprawiona" - }, - "2.2.1": { - "en": "- in names was allowed again", - "de": "- in Namen wurde wieder erlaubt", - "ru": "- в именах снова было разрешено", - "pt": "- nos nomes foi permitido novamente", - "nl": "- in namen was weer toegestaan", - "fr": "- dans les noms a été autorisé à nouveau", - "it": "- nei nomi è stato permesso di nuovo", - "es": "- en los nombres se permitió de nuevo", - "pl": "- w nazwach było ponownie dozwolone" - }, - "2.2.0": { - "en": "Auto generate of objects was implemented", - "de": "Auto-Generierung von Objekten wurde implementiert", - "ru": "Была реализована автоматическая генерация объектов", - "pt": "Geração automática de objetos foi implementada", - "nl": "Automatisch genereren van objecten is geïmplementeerd", - "fr": "La génération automatique d'objets a été implémentée", - "it": "È stata implementata la generazione automatica di oggetti", - "es": "Generación automática de objetos fue implementado", - "pl": "Automatycznie generowano obiekty" - }, - "2.1.3": { - "en": "Added HC-SR04 Ultrasonic Sensor", - "de": "HC-SR04 Ultraschallsensor hinzugefügt", - "ru": "Добавлен ультразвуковой датчик HC-SR04", - "pt": "Adicionado Sensor Ultrassônico HC-SR04", - "nl": "HC-SR04 ultrasone sensor toegevoegd", - "fr": "Capteur à ultrasons HC-SR04 ajouté", - "it": "Aggiunto il sensore a ultrasuoni HC-SR04", - "es": "Sensor ultrasónico HC-SR04 agregado", - "pl": "Dodano czujnik ultradźwiękowy HC-SR04" - }, - "2.1.2": { - "en": "Added support of UvLight, Longitude and Latitude", - "de": "Zusätzliche Unterstützung von UvLight, Longitude und Latitude", - "ru": "Добавлена ​​поддержка UvLight, долготы и широты", - "pt": "Adicionado suporte de UvLight, Longitude e Latitude", - "nl": "Ondersteuning toegevoegd van UvLight, Longitude en Latitude", - "fr": "Ajout du support de UvLight, Longitude et Latitude", - "it": "Aggiunto il supporto di UvLight, Longitude e Latitude", - "es": "Se agregó soporte de UvLight, Longitude y Latitude", - "pl": "Dodano obsługę UvLight, długości i szerokości geograficznej" - }, - "2.1.1": { - "en": "Support of the particle concentration sensor", - "de": "Unterstützung des Partikelkonzentrationssensors", - "ru": "Поддержка датчика концентрации частиц", - "pt": "Suporte do sensor de concentração de partículas", - "nl": "Ondersteuning van de deeltjesconcentratiesensor", - "fr": "Support du capteur de concentration de particules", - "it": "Supporto del sensore di concentrazione di particelle", - "es": "Soporte del sensor de concentración de partículas", - "pl": "Wsparcie czujnika stężenia cząstek" - }, - "2.1.0": { - "en": "Support of the devices control", - "de": "Unterstützung der Gerätekontrolle", - "ru": "Поддержка управления устройствами", - "pt": "Suporte do controle de dispositivos", - "nl": "Ondersteuning van de apparatencontrole", - "fr": "Prise en charge du contrôle des appareils", - "it": "Supporto del controllo dei dispositivi", - "es": "Soporte del control de dispositivos", - "pl": "Obsługa sterowania urządzeniami" - }, - "2.0.2": { - "en": "Fixing re-connection of clients\nSeaPressure was added", - "de": "Reparieren der Neuverbindung von Clients\nSeaPressure wurde hinzugefügt", - "ru": "Фиксация повторного подключения клиентов\nДобавлено SeaPressure", - "pt": "Reparando conexão de clientes\nA SeaPressure foi adicionada", - "nl": "Bevestiging van opnieuw verbinden van clients\nSeaPressure is toegevoegd", - "fr": "Correction de la reconnexion des clients\nSeaPressure a été ajouté", - "it": "Risolvere la riconnessione dei client\nSeaPressure è stato aggiunto", - "es": "Reparar la reconexión de los clientes\nSeaPressure fue agregado", - "pl": "Naprawianie ponownego połączenia klientów\nSeaPressure zostało dodane" - }, - "2.0.1": { - "en": "Add Light/Noise/AirQuality\nDo not send pingresp for invalid clients", - "de": "Fügen Sie den Light/Noise/AirQuality hinzu\nSendet keine Pingresp für ungültige Clients", - "ru": "Добавлены Light/Noise/AirQuality\nНе отправляen pingresp для недействительных клиентов", - "pt": "Adicionar Light/Noise/AirQuality", - "nl": "Light/Noise/AirQuality toevoegen", - "fr": "Ajouter un capteur Light/Noise/AirQuality", - "it": "Aggiungi il Light/Noise/AirQuality", - "es": "Agregar Light/Noise/AirQuality", - "pl": "Dodaj Light/Noise/AirQuality" - } - }, "title": "Sonoff", "desc": { - "en": "This adapter allows to connect sonoff components via MQTT", - "de": "Dieser Adapter ermöglicht den Anschluss von Sonoff-Komponenten über MQTT", - "ru": "Этот адаптер позволяет подключать компоненты Sonoff через MQTT", - "pt": "Este adaptador permite conectar os componentes do sonoff via MQTT", - "nl": "Met deze adapter kunnen sonoff-componenten via MQTT worden aangesloten", - "fr": "Cet adaptateur permet de connecter des composants sonoff via MQTT", - "it": "Questo adattatore consente di collegare i componenti Sonoff via MQTT", - "es": "Este adaptador permite conectar componentes de sonof a través de MQTT", - "pl": "Ten adapter umożliwia łączenie komponentów sonoff za pośrednictwem MQTT" + "en": "This adapter allows to connect sonoff components via MQTT" }, "authors": [ "bluefox " @@ -134,12 +14,12 @@ "mode": "daemon", "compact": true, "enabled": true, - "readme": "https://github.com/ioBroker/ioBroker.sonoff/blob/master/README.md", + "readme": "https://github.com/yunkong2/yunkong2.sonoff/blob/master/README.md", "loglevel": "info", "icon": "sonoff.png", "materialize": true, "keywords": ["ITEAD", "MQTT", "Sonoff", "Tasmota"], - "extIcon": "https://raw.githubusercontent.com/ioBroker/ioBroker.sonoff/master/admin/sonoff.png", + "extIcon": "https://git.spacen.net/yunkong2/yunkong2.sonoff/master/admin/sonoff.png", "type": "lighting" }, "native": { diff --git a/lib/server.js b/lib/server.js index 273520d..ca2cff4 100644 --- a/lib/server.js +++ b/lib/server.js @@ -164,7 +164,7 @@ function MQTTServer(adapter) { memwatch.on('leak', (info) => { //console.error('Memory leak detected:\n', info); adapter.log.info('Memory leak detected:\n', info); - var filename='/opt/iobroker/dumps/' + Date.now() + '.heapsnapshot'; + var filename='/opt/yunkong2/dumps/' + Date.now() + '.heapsnapshot'; heapdump.writeSnapshot((err,filename) => { if (err) { console.error(err); @@ -1074,10 +1074,10 @@ function MQTTServer(adapter) { adapter.log.info('mem: ' + state.val + ' MB'); if (heapTest==0 || (heapTest==1 && state.val>37.5)) { heapTest+=1; - heapdump.writeSnapshot('/opt/iobroker/' + Date.now() + '.heapsnapshot'); + heapdump.writeSnapshot('/opt/yunkong2/' + Date.now() + '.heapsnapshot'); adapter.log.info('Wrote snapshot: '); - var filename='/opt/iobroker/' + Date.now() + '.heapsnapshot'; + var filename='/opt/yunkong2/' + Date.now() + '.heapsnapshot'; heapdump.writeSnapshot((err,filename) => { if (err) { adapter.log.info('heap: ' + err); diff --git a/lib/utils.js b/lib/utils.js index e649d00..a40fe76 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -27,8 +27,8 @@ let appName; function getControllerDir(isInstall) { // Find the js-controller location const possibilities = [ - 'iobroker.js-controller', - 'ioBroker.js-controller', + 'yunkong2.js-controller', + 'yunkong2.js-controller', ]; /** @type {string} */ let controllerPath; diff --git a/main.js b/main.js index 1b205a9..061960d 100644 --- a/main.js +++ b/main.js @@ -5,7 +5,7 @@ /** * - * ioBroker sonoff Adapter + * yunkong2 sonoff Adapter * * (c) 2017-2019 bluefox * diff --git a/package.json b/package.json index a4bf2d1..803cb06 100755 --- a/package.json +++ b/package.json @@ -1,21 +1,20 @@ { - "name": "iobroker.sonoff", - "description": "The adapter allows to send and receive MQTT messages from ioBroker and to be a broker.", + "name": "yunkong2.sonoff", + "description": "The adapter allows to send and receive MQTT messages from yunkong2 and to be a broker.", "version": "2.2.3", - "author": "bluefox ", - "homepage": "https://github.com/ioBroker/ioBroker.sonoff", + "homepage": "https://github.com/yunkong2/yunkong2.sonoff", "repository": { "type": "git", - "url": "https://github.com/ioBroker/ioBroker.sonoff" + "url": "https://github.com/yunkong2/yunkong2.sonoff" }, "licenses": [ { "type": "MIT", - "url": "https://github.com/ioBroker/ioBroker.sonoff/blob/master/LICENSE" + "url": "https://github.com/yunkong2/yunkong2.sonoff/blob/master/LICENSE" } ], "keywords": [ - "iobroker", + "yunkong2", "sonoff", "MQTT", "tasmota", @@ -33,7 +32,7 @@ "chai": "^4.1.2" }, "bugs": { - "url": "https://github.com/ioBroker/ioBroker.sonoff/issues" + "url": "https://github.com/yunkong2/yunkong2.sonoff/issues" }, "main": "main.js", "scripts": { diff --git a/test/lib/objects.js b/test/lib/objects.js index 273a0a7..926be59 100644 --- a/test/lib/objects.js +++ b/test/lib/objects.js @@ -22,7 +22,7 @@ const logger = { function Objects(cb) { if (!(this instanceof Objects)) return new Objects(cb); - const _Objects = require(rootDir + 'tmp/node_modules/iobroker.js-controller/lib/objects'); + const _Objects = require(rootDir + 'tmp/node_modules/yunkong2.js-controller/lib/objects'); this.connected = false; const that = this; diff --git a/test/lib/setup.js b/test/lib/setup.js index 69be60b..8c62a69 100644 --- a/test/lib/setup.js +++ b/test/lib/setup.js @@ -407,7 +407,7 @@ function clearControllerLog() { } function clearDB() { - const dirPath = rootDir + 'tmp/iobroker-data/sqlite'; + const dirPath = rootDir + 'tmp/yunkong2-data/sqlite'; let files; try { if (fs.existsSync(dirPath)) { diff --git a/test/lib/states.js b/test/lib/states.js index 5ccb11e..02a0b0a 100644 --- a/test/lib/states.js +++ b/test/lib/states.js @@ -21,7 +21,7 @@ const logger = { function States(cb, stateChange) { const that = this; - const _States = require(rootDir + 'tmp/node_modules/iobroker.js-controller/lib/states'); + const _States = require(rootDir + 'tmp/node_modules/yunkong2.js-controller/lib/states'); let callbackId = 0; const options = { diff --git a/test/testPackageFiles.js b/test/testPackageFiles.js index 8b4e595..456dd63 100644 --- a/test/testPackageFiles.js +++ b/test/testPackageFiles.js @@ -53,12 +53,12 @@ describe('Test package.json and io-package.json', () => { console.log(); } if ( - ioPackage.common.title.indexOf('iobroker') !== -1 || - ioPackage.common.title.indexOf('ioBroker') !== -1 || + ioPackage.common.title.indexOf('yunkong2') !== -1 || + ioPackage.common.title.indexOf('yunkong2') !== -1 || ioPackage.common.title.indexOf('adapter') !== -1 || ioPackage.common.title.indexOf('Adapter') !== -1 ) { - console.log('WARNING: title contains Adapter or ioBroker. It is clear anyway, that it is adapter for ioBroker.'); + console.log('WARNING: title contains Adapter or yunkong2. It is clear anyway, that it is adapter for yunkong2.'); console.log(); }