danielwelch / hassio-zigbee2mqtt

Hass.io add-on for zigbee2mqtt
Apache License 2.0
565 stars 190 forks source link

Syntax error when adding new device #534

Closed HASSHUN closed 3 years ago

HASSHUN commented 3 years ago

zigbee2mqtt add-on version (if edge, please report commit hash): 1.17.1.0 Operating environment (HassOS, Virtual Machine, Device/platform running Home Assistant):

Home Assistant (Hassbian) **Description of problem:** I've tried to add a Linkind keypad to the devices.js, but got an error back. According to the guide, the steps were the following: 1. I looked up the latest version of device.js I am using now and copied it 2. I've added the following to the "Linkind" section. ( I reused one of the exising keypad's as example {Xfinity} ) ( hope it won't appear in red as in the preview :-) ) ``` { zigbeeModel: ['ZB-KeypadGeneric-D0002'], model: 'ZS130000078', vendor: 'Linkind', description: 'Security keypad battery', fromZigbee: [fz.command_arm, fz.battery, fz.identify, fz.ias_sos_alarm_2], exposes: [e.battery(), e.voltage(), e.occupancy(), e.battery_low() exposes.numeric('action_code', ea.STATE), exposes.text('action_zone', ea.STATE), e.action([ 'disarm', 'arm_day_zones', 'identify', 'arm_night_zones', 'arm_all_zones', 'invalid_code', 'emergency', ])], toZigbee: [tz.arm_mode], configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); const clusters = ['genPowerCfg', 'ssIasZone', 'ssIasAce', 'genBasic', 'genIdentify']; await reporting.bind(endpoint, coordinatorEndpoint, clusters); await reporting.batteryVoltage(endpoint); }, onEvent: async (type, data, device) => { if (type === 'message' && data.type === 'commandGetPanelStatus' && data.cluster === 'ssIasAce' && globalStore.hasValue(device.getEndpoint(1), 'panelStatus')) { const payload = { panelstatus: globalStore.getValue(device.getEndpoint(1), 'panelStatus'), secondsremain: 0x00, audiblenotif: 0x00, alarmstatus: 0x00, }; await device.getEndpoint(1).commandResponse( 'ssIasAce', 'getPanelStatusRsp', payload, {}, data.meta.zclTransactionSequenceNumber, ); } }, }, ``` 3. Added "zigbee_shepherd_devices: true" to my configuration.yaml 4. And uploaded my modified devices.js to data path ( /share/zigbee2mqtt ) Restarted my add-on and got back this: **Your logs from Home Assistant** > node index.js 2021-02-08T15:36:52: PM2 log: App [npm:0] exited with code [1] via signal [SIGINT] 2021-02-08T15:36:52: PM2 log: App [npm:0] starting in -fork mode- 2021-02-08T15:36:52: PM2 log: App [npm:0] online > zigbee2mqtt@1.17.1 start /zigbee2mqtt-1.17.1 > node index.js /zigbee2mqtt-1.17.1/node_modules/zigbee-herdsman-converters/devices.js:14478 exposes.numeric('action_code', ea.STATE), exposes.text('action_zone', ea.STATE), e.action([ ^^^^^^^ SyntaxError: Unexpected identifier at wrapSafe (internal/modules/cjs/loader.js:979:16) at Module._compile (internal/modules/cjs/loader.js:1027:27) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at Object. (/zigbee2mqtt-1.17.1/node_modules/zigbee-herdsman-converters/index.js:3:17) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! zigbee2mqtt@1.17.1 start: `node index.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zigbee2mqtt@1.17.1 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2021-02-08T14_36_55_986Z-debug.log Can you also check whether my device is configured properly, please?
HASSHUN commented 3 years ago

... and a few words about the device itself. https://www.linkind.com/product/smart-home-security-system-kit-ring-alarm/ Originally it came with a siren Hub. What I experienced that if the device is connected to the hub it cannot communicate with my Conbee II adapter. Once I reset the device and the interview is finished. I cannot make it connect to the hub again. Am I doing sg wrong or just have little chance to get this panel work?

Thank you for spending time with my issue! 👍

HASSHUN commented 3 years ago

Okay I have the code checked , and corrected some mistakes, removed some parts as well. My device is configured now but can't see any actions, no log in debug mode. So once the device is paired it disappears from the field. I think I rather go to Koenkk with this issue.