iobroker.wifilight
Advanced tools
Comparing version 0.2.0 to 1.1.0
@@ -47,3 +47,4 @@ "use strict"; | ||
'AK001-ZJ100': { type: 'LD382A' /*, magichome port: 5577*/ }, | ||
'AK001-ZJ200': { type: 'LD382A' /*, magichome port: 5577*/ } | ||
'AK001-ZJ200': { type: 'LD382A' /*, magichome port: 5577*/ }, | ||
'AK001-ZJ200': { type: 'LD686' /*, magichome port: 5577*/ } | ||
}; | ||
@@ -121,2 +122,39 @@ | ||
exports.LD686 = { | ||
useCheckSum: true, | ||
port: 5577, | ||
//onlyConnectOnWrite: true, | ||
delay: 10, | ||
responseLen: 14, | ||
on: [0x71, 0x23, 0x0f], | ||
off: [0x71, 0x24, 0x0f], | ||
//additional HEX field for RGBW. 0xF0 = RGB only; 0x0F WW only; 0xFF RGBW | ||
rgb: [0x31, VARS.red, VARS.green, VARS.blue, 0x00 /*VARS.white*/, 0x00, 0xf0, 0x0f], | ||
rgbw: [0x31, VARS.red, VARS.green, VARS.blue, VARS.white, 0x00, 0xff, 0x0f], | ||
progOn: [0x71, 0x21, 0x0f], | ||
progOff: [0x71, 0x20, 0x0f], | ||
progNo: [97, VARS.prog, VARS.speed, 0x0f], | ||
statusRequest: [0x81, 0x8A, 0x8B], | ||
programNames: programNames, | ||
decodeResponse: function(data) { | ||
if (data[0] !== 129) return null; | ||
//[129, 4, 35, 97, 33, 9, 11, 22, 33, 255, 3, 0, 0, 119] | ||
return { | ||
//power: ((data[2] === 0x23) ? true : false), | ||
on: ((data[2] === 0x23) ? true : false), | ||
//power: ((data[13] & 0x01) ? true : false), | ||
//power: ((data[13] & 0x01) ? false : true), | ||
progNo: data[3],//mode | ||
progOn: data[4] === 33, //modeRun | ||
preogSpeed: data[5], //modeSpeed | ||
red: data[6], | ||
green: data[7], | ||
blue: data[8], | ||
white: data[9] | ||
}; | ||
} | ||
}; | ||
exports.LD382 = Object.assign({}, exports.LD382A, { // not tested | ||
@@ -123,0 +161,0 @@ }); |
{ | ||
"common": { | ||
"name": "wifilight", | ||
"version": "0.2.0", | ||
"version": "1.1.0", | ||
"news": { | ||
"0.2.0": { | ||
"en": "device config handling changed", | ||
"de": "Handhabung der Gerätekonfiguration geändert" | ||
"1.1.0": { | ||
"en": "compatibility for js-controller 3", | ||
"de": "Kompatibilität für js-controller 3", | ||
"ru": "совместимость для js-controller 3", | ||
"pt": "compatibilidade para js-controller 3", | ||
"nl": "compatibiliteit voor js-controller 3", | ||
"fr": "compatibilité pour js-controller 3", | ||
"it": "compatibilità per js-controller 3", | ||
"es": "compatibilidad para js-controller 3", | ||
"pl": "kompatybilność z js-kontrolerem 3", | ||
"zh-cn": "js-controller 3的兼容性" | ||
}, | ||
"0.1.10": { | ||
"en": "AK001-ZJ200 added (matze1708)", | ||
"de": "AK001-ZJ200 hinzugefügt (matze1708)" | ||
}, | ||
"0.1.9": { | ||
"en": "update basic package-file testing (Apollon77)", | ||
"de": "Erweiterung der Tests (Apollon77)" | ||
}, | ||
"0.1.8": { | ||
"en": "node 0.12 removed from testing", | ||
"de": "node 0.12 auf testing entfernt" | ||
}, | ||
"0.1.7": { | ||
"en": "Enhance CI testing", | ||
"de": "CI testing erweitert" | ||
}, | ||
"0.1.6": { | ||
"en": "fixed typo. Caused an object change which caused an adapter restart", | ||
"de": "Tippfehler korrigiert. Führte zu einer Object-Änderung die wiederum zum Adapterneustart führte" | ||
}, | ||
"0.1.5": { | ||
"en": "Possible exception, if wrong device name configured, fixed. Reason is added to the error log.", | ||
"de": "Mögliche Schutzverletzung, wenn falscher Geräte Name/Type angegeben, behoben, Grund steht im error log." | ||
}, | ||
"0.1.4": { | ||
"en": "Misplaced komma in io-package.json", | ||
"de": "Falsche Komma in io-package.json" | ||
}, | ||
"0.1.3": { | ||
"en": "Normalize devices for devices added by discovery", | ||
"de": "Daten-Normalisierung der von Discovery hinzugefügten Geräte" | ||
}, | ||
"0.1.2": { | ||
"en": "possible exception when deleting unused devices", | ||
"de": "Möglicher Ausnahmefehler beim Löschen unbenutzter Geräte" | ||
"1.0.0": { | ||
"en": "first version for the community", | ||
"de": "erste Version für die Community", | ||
"ru": "первая версия для сообщества", | ||
"pt": "primeira versão para a comunidade", | ||
"nl": "eerste versie voor de gemeenschap", | ||
"fr": "première version pour la communauté", | ||
"it": "prima versione per la comunità", | ||
"es": "Primera versión para la comunidad.", | ||
"pl": "pierwsza wersja dla społeczności", | ||
"zh-cn": "社区的第一个版本" | ||
} | ||
}, | ||
"title": "WiFi Light", | ||
"titleLang": { | ||
"en": "WiFi Light", | ||
"de": "WiFi Light", | ||
"ru": "WiFi Light", | ||
"pt": "WiFi Light", | ||
"nl": "WiFi Light", | ||
"fr": "WiFi Light", | ||
"it": "WiFi Light", | ||
"es": "WiFi Light", | ||
"pl": "WiFi Light", | ||
"zh-cn": "WiFi Light" | ||
}, | ||
"desc": { | ||
"en": "WiFi Light Devices", | ||
"de": "WiFi Light Devices", | ||
"ru": "WiFi Light Devices" | ||
"de": "WiFi-Licht-Geräte", | ||
"ru": "Световые Приборы Беспроводной Доступ В Интернет ", | ||
"pt": "Luz Wi-Fi De Dispositivos", | ||
"nl": "WiFi-Apparaten Licht", | ||
"fr": "WiFi Des Appareils Légers", | ||
"it": "WiFi Luce Di Dispositivi", | ||
"es": "WiFi De Los Dispositivos De Luz", | ||
"pl": "Oświetlenie Bezprzewodowy Dostęp Do Internetu ", | ||
"zh-cn": "无线光设备" | ||
}, | ||
@@ -60,7 +62,8 @@ "keywords": [ | ||
], | ||
"license": "MIT", | ||
"platform": "Javascript/Node.js", | ||
"mode": "daemon", | ||
"icon": "wifilight.png", | ||
"extIcon": "https://raw.githubusercontent.com/soef/iobroker.wifilight/master/admin/wifilight.png", | ||
"readme": "https://github.com/soef/iobroker.wifilight/blob/master/README.md", | ||
"extIcon": "https://raw.githubusercontent.com/iobroker-community-adapters/iobroker.wifilight/master/admin/wifilight.png", | ||
"readme": "https://github.com/iobroker-community-adapters/iobroker.wifilight/blob/master/README.md", | ||
"loglevel": "info", | ||
@@ -67,0 +70,0 @@ "type": "lighting", |
@@ -0,0 +0,0 @@ |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -1,28 +0,45 @@ | ||
var controllerDir; | ||
'use strict'; | ||
// Get js-controller directory to load libs | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
let controllerDir; | ||
let appName; | ||
/** | ||
* returns application name | ||
* | ||
* The name of the application can be different and this function finds it out. | ||
* | ||
* @returns {string} | ||
*/ | ||
function getAppName() { | ||
const parts = __dirname.replace(/\\/g, '/').split('/'); | ||
return parts[parts.length - 2].split('.')[0]; | ||
} | ||
/** | ||
* looks for js-controller home folder | ||
* | ||
* @param {boolean} isInstall | ||
* @returns {string} | ||
*/ | ||
function getControllerDir(isInstall) { | ||
var fs = require('fs'); | ||
// Find the js-controller location | ||
var controllerDir = __dirname.replace(/\\/g, '/'); | ||
controllerDir = controllerDir.split('/'); | ||
if (controllerDir[controllerDir.length - 3] == 'adapter') { | ||
controllerDir.splice(controllerDir.length - 3, 3); | ||
controllerDir = controllerDir.join('/'); | ||
} else if (controllerDir[controllerDir.length - 3] == 'node_modules') { | ||
controllerDir.splice(controllerDir.length - 3, 3); | ||
controllerDir = controllerDir.join('/'); | ||
if (fs.existsSync(controllerDir + '/node_modules/iobroker.js-controller')) { | ||
controllerDir += '/node_modules/iobroker.js-controller'; | ||
} else if (fs.existsSync(controllerDir + '/node_modules/ioBroker.js-controller')) { | ||
controllerDir += '/node_modules/ioBroker.js-controller'; | ||
} else if (!fs.existsSync(controllerDir + '/controller.js')) { | ||
if (!isInstall) { | ||
console.log('Cannot find js-controller'); | ||
process.exit(10); | ||
} else { | ||
process.exit(); | ||
const possibilities = [ | ||
'iobroker.js-controller', | ||
'ioBroker.js-controller', | ||
]; | ||
/** @type {string} */ | ||
let controllerPath; | ||
for (const pkg of possibilities) { | ||
try { | ||
const possiblePath = require.resolve(pkg); | ||
if (fs.existsSync(possiblePath)) { | ||
controllerPath = possiblePath; | ||
break; | ||
} | ||
} | ||
} else { | ||
} catch (e) { /* not found */ } | ||
} | ||
if (controllerPath == null) { | ||
if (!isInstall) { | ||
@@ -35,13 +52,33 @@ console.log('Cannot find js-controller'); | ||
} | ||
return controllerDir; | ||
// we found the controller | ||
return path.dirname(controllerPath); | ||
} | ||
// Read controller configuration file | ||
function getConfig() { | ||
return JSON.parse(fs.readFileSync(controllerDir + '/conf/iobroker.json')); | ||
/** | ||
* reads controller base settings | ||
* | ||
* @alias getConfig | ||
* @returns {object} | ||
*/ | ||
function getConfig() { | ||
let configPath; | ||
if (fs.existsSync( | ||
configPath = path.join(controllerDir, 'conf', appName + '.json') | ||
)) { | ||
return JSON.parse(fs.readFileSync(configPath, 'utf8')); | ||
} else if (fs.existsSync( | ||
configPath = path.join(controllerDir, 'conf', + appName.toLowerCase() + '.json') | ||
)) { | ||
return JSON.parse(fs.readFileSync(configPath, 'utf8')); | ||
} else { | ||
throw new Error('Cannot find ' + controllerDir + '/conf/' + appName + '.json'); | ||
} | ||
} | ||
controllerDir = getControllerDir(typeof process != 'undefined' && process.argv && process.argv.indexOf('--install') != -1); | ||
appName = getAppName(); | ||
controllerDir = getControllerDir(typeof process !== 'undefined' && process.argv && process.argv.indexOf('--install') !== -1); | ||
const adapter = require(path.join(controllerDir, 'lib/adapter.js')); | ||
exports.controllerDir = controllerDir; | ||
exports.getConfig = getConfig; | ||
exports.adapter = require(controllerDir + '/lib/adapter.js'); | ||
exports.Adapter = adapter; | ||
exports.appName = appName; |
112
package.json
{ | ||
"name": "iobroker.wifilight", | ||
"version": "0.2.0", | ||
"description": "WiFi Light Adapter", | ||
"author": { | ||
"name": "soef", | ||
"email": "soef@gmx.net" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "soef", | ||
"email": "soef@gmx.net" | ||
} | ||
], | ||
"homepage": "https://github.com/soef/iobroker.wifilight", | ||
"license": "MIT", | ||
"keywords": [ | ||
"ioBroker", | ||
"wifilight", | ||
"lw12", | ||
"ld382" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/soef/iobroker.wifilight" | ||
}, | ||
"optionalDependencies": { | ||
"mdns-discovery": "^0.1.12" | ||
}, | ||
"dependencies": { | ||
"netmask": "^1.0.6", | ||
"soef": "^0.1.21" | ||
}, | ||
"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", | ||
"mocha": "^3.5.3", | ||
"chai": "^4.1.2" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/soef/iobroker.wifilight/issues" | ||
}, | ||
"readmeFilename": "README.md", | ||
"main": "wifilight.js", | ||
"scripts": { | ||
"test": "node node_modules/mocha/bin/mocha" | ||
} | ||
"name": "iobroker.wifilight", | ||
"version": "1.1.0", | ||
"description": "WiFi Light Adapter", | ||
"author": { | ||
"name": "soef", | ||
"email": "soef@gmx.net" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "soef", | ||
"email": "soef@gmx.net" | ||
} | ||
], | ||
"homepage": "https://github.com/iobroker-community-adapters/iobroker.wifilight", | ||
"license": "MIT", | ||
"keywords": [ | ||
"ioBroker", | ||
"wifilight", | ||
"lw12", | ||
"ld382" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/iobroker-community-adapters/iobroker.wifilight" | ||
}, | ||
"optionalDependencies": { | ||
"mdns-discovery": "^0.1.12" | ||
}, | ||
"dependencies": { | ||
"netmask": "^1.0.6", | ||
"@iobroker/adapter-core": "^1.0.3", | ||
"sprintf-js": "^1.0.3", | ||
"array-ext": "^0.1.0" | ||
}, | ||
"devDependencies": { | ||
"@iobroker/testing": "^1.2.6", | ||
"@types/chai": "^4.2.3", | ||
"@types/chai-as-promised": "^7.1.2", | ||
"@types/gulp": "^4.0.6", | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^10.14.21", | ||
"@types/proxyquire": "^1.3.28", | ||
"@types/sinon": "^7.5.0", | ||
"@types/sinon-chai": "^3.2.3", | ||
"axios": "^0.19.0", | ||
"chai": "^4.2.0", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^6.5.1", | ||
"gulp": "^4.0.2", | ||
"mocha": "^6.2.1", | ||
"proxyquire": "^2.1.3", | ||
"sinon": "^7.5.0", | ||
"sinon-chai": "^3.3.0" | ||
}, | ||
"main": "main.js", | ||
"scripts": { | ||
"test": "node node_modules/mocha/bin/mocha --exit" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/iobroker-community-adapters/iobroker.wifilight/issues" | ||
}, | ||
"readmeFilename": "README.md" | ||
} | ||
![Logo](admin/wifilight.png) | ||
# ioBroker.wifilight | ||
#### ioBroker.wifilight | ||
[![NPM version](http://img.shields.io/npm/v/iobroker.wifilight.svg)](https://www.npmjs.com/package/iobroker.wifilight) | ||
![Number of Installations](http://iobroker.live/badges/wifilight-community-installed.svg) ![Number of Installations](http://iobroker.live/badges/wifilight-community-stable.svg) [![NPM version](http://img.shields.io/npm/v/iobroker.wifilight.svg)](https://www.npmjs.com/package/iobroker.wifilight) | ||
[![Tests](http://img.shields.io/travis/soef/ioBroker.wifilight/master.svg)](https://travis-ci.org/soef/ioBroker.wifilight) | ||
@@ -10,11 +9,14 @@ [![Build status](https://ci.appveyor.com/api/projects/status/2hvs4fvfms7xhmnw?svg=true)](https://ci.appveyor.com/project/soef/iobroker-wifilight) | ||
#### Description | ||
## Description | ||
ioBroker Adapter for WiFi Light | ||
#### Info | ||
## Info | ||
Supports LW12, LD382 and LD382A. | ||
Support for Mi-Light/LimitlessLED RGBW added. | ||
###### How to use the command state: | ||
## Initial Creation | ||
This adapter was initialy created by @soef at https://github.com/soef/ioBroker.wifilight but not maintained any more, so we moved it to iobroker-community so that bugs could be fixed. thanks @soef for his work. | ||
### How to use the command state: | ||
+ Possible identifiers are: ``red, r, green, g, blue, b, bri, sat, transition, on, off`` | ||
@@ -39,16 +41,32 @@ + The string can be a JSON with or without parentheses. | ||
###### r, g, b, w States: | ||
### r, g, b, w States: | ||
+ Values 0..255 | ||
+ \#rrggbb[ww] | ||
#### Installation | ||
Execute the following command in the iobroker root directory (e.g. in /opt/iobroker) | ||
## Installation | ||
Use the Adapter panel in iobroker to add an instance. | ||
If not exists execute the following command in the iobroker root directory (e.g. in /opt/iobroker). | ||
``` | ||
npm install iobroker.wifilight | ||
``` | ||
<!-- | ||
### License | ||
### Error fixing | ||
In case of not working try to install the soef npm package | ||
``` | ||
cd /opt/iobroker/node_modules/iobroker.wifilight | ||
sudo npm install soef | ||
``` | ||
## Changelog | ||
### 1.1.0 (2020-04-09) | ||
* (foxriver76) compatibility for js-c 3 | ||
### 1.0.0 (2019-10-18) | ||
* (ldittmar) first version for the community | ||
## License | ||
The MIT License (MIT) | ||
Copyright (c) 2016 soef <soef@gmx.net> | ||
Copyright (c) 2019-2020 soef <soef@gmx.net> | ||
@@ -72,2 +90,1 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
THE SOFTWARE. | ||
--> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Network access
Supply chain riskThis module accesses the network.
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
294821
54
6135
0
88
6
18
16
9
+ Addedarray-ext@^0.1.0
+ Addedsprintf-js@^1.0.3
+ Added@iobroker/adapter-core@1.0.3(transitive)
+ Added@types/iobroker@1.4.13(transitive)
+ Added@types/node@20.12.12(transitive)
+ Addedundici-types@5.26.5(transitive)
- Removedsoef@^0.1.21
- Removedsoef@0.1.55(transitive)