Skip to content

Commit

Permalink
Refs Koenkk/zigbee2mqtt#12952: fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gorbunovav committed Jun 29, 2022
1 parent 0c84e0e commit c3082e5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
10 changes: 5 additions & 5 deletions converters/fromZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -4900,13 +4900,13 @@ const converters = {
if (msg.data.hasOwnProperty(property)) {
const value = msg.data[property];
const lookup = {
0: 'momentary',
1: 'toggle',
2: 'state'
};
0: 'momentary',
1: 'toggle',
2: 'state',
};

if (lookup.hasOwnProperty(value)) {
const propertyName = postfixWithEndpointName('switch_type', msg, model)
const propertyName = postfixWithEndpointName('switch_type', msg, model);
return {[propertyName]: lookup[value]};
}
}
Expand Down
2 changes: 1 addition & 1 deletion converters/toZigbee.js
Original file line number Diff line number Diff line change
Expand Up @@ -3888,7 +3888,7 @@ const converters = {
convertSet: async (entity, key, value, meta) => {
value = value.toLowerCase();
const lookup = {'momentary': 0, 'toggle': 1, 'state': 2};

utils.validateValue(value, Object.keys(lookup));
const payload = lookup[value];

Expand Down
16 changes: 8 additions & 8 deletions devices/lonsonho.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,26 +221,26 @@ module.exports = [
model: 'TS110E_2gang',
vendor: 'Lonsonho',
description: 'Zigbee smart dimmer module 2 gang with neutral',
fromZigbee: extend.light_onoff_brightness({ disablePowerOnBehavior: true }).fromZigbee.concat([
fromZigbee: extend.light_onoff_brightness({disablePowerOnBehavior: true}).fromZigbee.concat([
fz.tuya_switch_power_outage_memory,
fz.TS110E_switch_type,
]),
toZigbee: extend.light_onoff_brightness({ disablePowerOnBehavior: true }).toZigbee.concat([
toZigbee: extend.light_onoff_brightness({disablePowerOnBehavior: true}).toZigbee.concat([
tz.tuya_switch_power_outage_memory,
tz.TS110E_switch_type,
]),
meta: {multiEndpoint: true},
exposes: [
e.light_brightness().withEndpoint('l1'),
e.light_brightness().withEndpoint('l1'),
e.light_brightness().withEndpoint('l2'),
exposes.enum(
'power_outage_memory',
ea.STATE_SET,
['on', 'off', 'restore']
).withDescription('Recover state after power outage')
'power_outage_memory',
ea.STATE_SET,
['on', 'off', 'restore'],
).withDescription('Recover state after power outage')
.withEndpoint('l1'),
exposes.presets.switch_type_2().withEndpoint('l1'),
exposes.presets.switch_type_2().withEndpoint('l2')
exposes.presets.switch_type_2().withEndpoint('l2'),
],
configure: async (device, coordinatorEndpoint, logger) => {
await extend.light_onoff_brightness().configure(device, coordinatorEndpoint, logger);
Expand Down
34 changes: 17 additions & 17 deletions lib/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ const extend = {
},
light_onoff_brightness: (options={}) => {
options = {
disableEffect: false,
disablePowerOnBehavior: false,
...options
disableEffect: false,
disablePowerOnBehavior: false,
...options,
};

const exposes = [
e.light_brightness(),
...(!options.disableEffect ? [e.effect()] : [])
e.light_brightness(),
...(!options.disableEffect ? [e.effect()] : []),
];

const fromZigbee = [
fz.on_off,
fz.brightness,
fz.level_config,
fz.on_off,
fz.brightness,
fz.level_config,
...(!options.disablePowerOnBehavior ? [fz.power_on_behavior] : []),
fz.ignore_basic_report
fz.ignore_basic_report,
];

const toZigbee = [
tz.light_onoff_brightness,
tz.ignore_transition,
tz.ignore_rate,
tz.light_onoff_brightness,
tz.ignore_transition,
tz.ignore_rate,
tz.light_brightness_move,
tz.light_brightness_step,
tz.level_config,
tz.light_brightness_step,
tz.level_config,
...(!options.disablePowerOnBehavior ? [tz.power_on_behavior] : []),
...(!options.disableEffect ? [tz.effect] : [])
...(!options.disableEffect ? [tz.effect] : []),
];

const result = {exposes, fromZigbee, toZigbee};

if (!options.noConfigure) {
result.configure = async (device, coordinatorEndpoint, logger) => {
await light.configure(device, coordinatorEndpoint, logger, true);
Expand Down

0 comments on commit c3082e5

Please sign in to comment.