diff --git a/converters/fromZigbee.js b/converters/fromZigbee.js index 90bf460c9f77c..af8699bad7523 100644 --- a/converters/fromZigbee.js +++ b/converters/fromZigbee.js @@ -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]}; } } diff --git a/converters/toZigbee.js b/converters/toZigbee.js index b253b85ec95d8..5554776b1ecee 100644 --- a/converters/toZigbee.js +++ b/converters/toZigbee.js @@ -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]; diff --git a/devices/lonsonho.js b/devices/lonsonho.js index 42e2cf106aaa9..b0a0e10f2a2ea 100644 --- a/devices/lonsonho.js +++ b/devices/lonsonho.js @@ -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); diff --git a/lib/extend.js b/lib/extend.js index bb048bce7e7d2..15859a08f56e7 100644 --- a/lib/extend.js +++ b/lib/extend.js @@ -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);