Skip to content

Commit

Permalink
Add travis and eslint config.
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed May 24, 2018
1 parent 5d2ddb8 commit 029f651
Show file tree
Hide file tree
Showing 8 changed files with 1,309 additions and 35 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/*
test/*
17 changes: 17 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"env": {
"node": true
},
"extends": ["eslint:recommended", "google"],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true
},
"sourceType": "module"
},
"rules": {
"require-jsdoc": "off",
"indent": ["error", 4],
"max-len": ["error", { "code": 120 }]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: node_js

node_js:
- "8"

install:
- npm install

script:
- npm run verify
- npm run eslint
70 changes: 35 additions & 35 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const converters = {
xiaomi_battery_3v: {
cid: 'genBasic',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
let voltage = null;

if (msg.data.data['65281']) {
Expand All @@ -59,7 +59,7 @@ const converters = {
WXKG01LM_click: {
cid: 'genOnOff',
type: 'attReport',
convert: (model, msg, publish) => {
convert: (model, msg, publish, options) => {
const deviceID = msg.endpoints[0].device.ieeeAddr;
const state = msg.data.data['onOff'];

Expand All @@ -85,14 +85,14 @@ const converters = {
xiaomi_temperature: {
cid: 'msTemperatureMeasurement',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {temperature: parseFloat(msg.data.data['measuredValue']) / 100.0};
},
},
MFKZQ01LM_action_multistate: {
cid: 'genMultistateInput',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
/*
Source: https://github.com/kirovilya/ioBroker.zigbee
+---+
Expand Down Expand Up @@ -130,7 +130,7 @@ const converters = {
MFKZQ01LM_action_analog: {
cid: 'genAnalogInput',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
/*
Source: https://github.com/kirovilya/ioBroker.zigbee
presentValue = rotation angel left < 0, rigth > 0
Expand All @@ -142,7 +142,7 @@ const converters = {
xiaomi_humidity: {
cid: 'msRelativeHumidity',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {humidity: parseFloat(msg.data.data['measuredValue']) / 100.0};
},
},
Expand Down Expand Up @@ -171,21 +171,21 @@ const converters = {
xiaomi_contact: {
cid: 'genOnOff',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {contact: msg.data.data['onOff'] === 0};
},
},
light_brightness: {
cid: 'genLevelCtrl',
type: 'devChange',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {brightness: msg.data.data['currentLevel']};
},
},
light_color_colortemp: {
cid: 'lightingColorCtrl',
type: 'devChange',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
const result = {};

if (msg.data.data['colorTemperature']) {
Expand All @@ -205,7 +205,7 @@ const converters = {
WXKG11LM_click: {
cid: 'genOnOff',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
const data = msg.data.data;
let clicks;

Expand All @@ -223,63 +223,63 @@ const converters = {
xiaomi_illuminance: {
cid: 'msIlluminanceMeasurement',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {illuminance: msg.data.data['measuredValue']};
},
},
xiaomi_pressure: {
cid: 'msPressureMeasurement',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {pressure: msg.data.data['measuredValue']};
},
},
WXKG02LM_click: {
cid: 'genOnOff',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {click: getKey(model.ep, msg.endpoints[0].epId)};
},
},
WXKG03LM_click: {
cid: 'genOnOff',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {click: 'single'};
},
},
SJCGQ11LM_water_leak_basic: {
cid: 'genBasic',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {water_leak: msg.data.data['65281']['100'] === 1};
},
},
SJCGQ11LM_water_leak_iaszone: {
cid: 'ssIasZone',
type: 'statusChange',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {water_leak: msg.data.zoneStatus === 1};
},
},
xiaomi_state: {
cid: 'genOnOff',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {state: msg.data.data['onOff'] === 1 ? 'ON' : 'OFF'};
},
},
xiaomi_power: {
cid: 'genAnalogInput',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {power: precisionRound(msg.data.data['presentValue'], 2)};
},
},
ZNCZ02LM_state: {
cid: 'genBasic',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
if (msg.data.data['65281']) {
const data = msg.data.data['65281'];
return {
Expand All @@ -295,7 +295,7 @@ const converters = {
QBKG04LM_state: {
cid: 'genOnOff',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
if (msg.data.data['61440']) {
return {state: msg.data.data['onOff'] === 1 ? 'ON' : 'OFF'};
}
Expand All @@ -304,7 +304,7 @@ const converters = {
QBKG03LM_state: {
cid: 'genOnOff',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
if (msg.data.data['61440']) {
const key = `state_${getKey(model.ep, msg.endpoints[0].epId)}`;
const payload = {};
Expand All @@ -316,28 +316,28 @@ const converters = {
JTYJGD01LMBW_smoke: {
cid: 'ssIasZone',
type: 'statusChange',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {smoke: msg.data.zoneStatus === 1};
},
},
EDP_power: {
cid: 'seMetering',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {power: precisionRound(msg.data.data['instantaneousDemand'], 2)};
},
},
CC2530ROUTER_state: {
cid: 'genOnOff',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
return {state: msg.data.data['onOff'] === 1};
},
},
CC2530ROUTER_meta: {
cid: 'genBinaryValue',
type: 'attReport',
convert: (model, msg) => {
convert: (model, msg, publish, options) => {
const data = msg.data.data;
return {
description: data['description'],
Expand All @@ -351,52 +351,52 @@ const converters = {
ignore_onoff_change: {
cid: 'genOnOff',
type: 'devChange',
convert: () => null,
convert: (model, msg, publish, options) => null,
},
ignore_basic_change: {
cid: 'genBasic',
type: 'devChange',
convert: () => null,
convert: (model, msg, publish, options) => null,
},
ignore_illuminance_change: {
cid: 'msIlluminanceMeasurement',
type: 'devChange',
convert: () => null,
convert: (model, msg, publish, options) => null,
},
ignore_occupancy_change: {
cid: 'msOccupancySensing',
type: 'devChange',
convert: () => null,
convert: (model, msg, publish, options) => null,
},
ignore_temperature_change: {
cid: 'msTemperatureMeasurement',
type: 'devChange',
convert: () => null,
convert: (model, msg, publish, options) => null,
},
ignore_humidity_change: {
cid: 'msRelativeHumidity',
type: 'devChange',
convert: () => null,
convert: (model, msg, publish, options) => null,
},
ignore_pressure_change: {
cid: 'msPressureMeasurement',
type: 'devChange',
convert: () => null,
convert: (model, msg, publish, options) => null,
},
ignore_analog_change: {
cid: 'genAnalogInput',
type: 'devChange',
convert: () => null,
convert: (model, msg, publish, options) => null,
},
ignore_multistate_change: {
cid: 'genMultistateInput',
type: 'devChange',
convert: () => null,
convert: (model, msg, publish, options) => null,
},
ignore_metering_change: {
cid: 'seMetering',
type: 'devChange',
convert: () => null,
convert: (model, msg, publish, options) => null,
},
};

Expand Down
Loading

0 comments on commit 029f651

Please sign in to comment.