Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge πŸŒ‰, get rid of your proprietary Zigbee bridges πŸ”¨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.78k stars 1.64k forks source link

Unable to add support for new devices #2139

Closed indubwestep closed 4 years ago

indubwestep commented 4 years ago

zigbee2mqtt version: 1.6.0 CC2652R firmware version: CC26X2R1_20191011

Previously the same devices.js, fromZigbee.js, and homeassistant.js was working and support for custom devices that was added was working properly. I understand the folder structure has changed and I am wondering whether I have the correct structure. In opt/zigbee2mqtt I ran "npm install zigbee-shepherd-converters" which added a "node_modules" folder which contains zigbee-shepherd converters. Permissions are correct.

In devices.js the following was added:

 {
    zigbeeModel: ['SLC605-LEVELCTR'], 
    model: 'SLC605-LEVELCTR', 
    vendor: 'OWON', 
    description: 'Zigbee Switch', 
    supports: 'on/off', 
    fromZigbee: [fz.SLC605, fz.ignore_onoff_change, fz.ignore_metering_change, fz.state], 
    toZigbee: [tz.on_off, tz.ignore_transition],
    configure: (ieeeAddr, shepherd, coordinator, callback) => {
        const cfg = {direction: 0, attrId: 0, dataType: 16, minRepIntval: 0, maxRepIntval: 1000, repChange: 0};
        const device = shepherd.find(ieeeAddr, 1);
        const actions = [
            (cb) => device.bind('genOnOff', coordinator, cb),          
            (cb) => device.bind('genBasic', coordinator, cb),
            (cb) => device.bind('genGroups', coordinator, cb),
            (cb) => device.bind('genIdentify', coordinator, cb),
            (cb) => device.report('seMetering', 'instantaneousDemand', 1, 100, 1, cb),
        ];

        execute(device, actions, callback);
    },
},

In fromZigbee.js the following was added:

SLC605: {
    cid: 'seMetering',
    type: 'attReport',
    convert: (model, msg, publish, options) => {
        return {power: precisionRound(msg.data.data['instantaneousDemand'], 2)};
    },    
},

In homeassistant.js the following was added (is this file supposed to be located in opt/zigbee2mqtt/data/lib/extension ?):

 SLC605-LEVELCTR': [configurations.switch, configurations.sensor_power, configurations.sensor_linkquality],

However the log is still showing lack of support:

zigbee2mqtt:debug 2019-10-14T22:02:49: Received Zigbee message from '0x000d6f000d8155c1', type 'attributeReport', cluster 'genOnOff', data '{"onOff":0}' from endpoint 1 with groupID 0

zigbee2mqtt:warn 2019-10-14T22:02:49: Received message from unsupported device with Zigbee model 'SLC605-LEVELCTR'

zigbee2mqtt:warn 2019-10-14T22:02:49: Please see: https://www.zigbee2mqtt.io/how_tos/how_to_support_new_devices.html.

zigbee2mqtt:debug 2019-10-14T22:07:42: Saving state to file /app/data/state.json

I noticed that in the logs 'zigbee-herdsman started' replaced 'zigbee-shepherd-converters started' and I am wondering whether that could be the issue?

As a side note I am getting some npm warnings and wondering whether 'npm audit fix' should be run:

=== npm audit security report ===

Run npm install zigbee-herdsman@0.9.2 to resolve 1 vulnerability

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Moderate β”‚ Memory Exposure β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Package β”‚ bl β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Dependency of β”‚ zigbee-herdsman β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Path β”‚ zigbee-herdsman > dissolve > bl β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ More info β”‚ https://npmjs.com/advisories/596 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Run npm update eslint-utils --depth 2 to resolve 1 vulnerability

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Critical β”‚ Arbitrary Code Execution β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Package β”‚ eslint-utils β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Dependency of β”‚ eslint [dev] β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Path β”‚ eslint > eslint-utils β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ More info β”‚ https://npmjs.com/advisories/1118 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Koenkk commented 4 years ago

You need to look at node_modules/zigbee-herdsman-converters instead of zigbee-shepherd-converters.

indubwestep commented 4 years ago

But now with zigbee-herdsman I'm getting the error 'Error: SRSP - SYS - version after 6000ms'

indubwestep commented 4 years ago

Did a fresh install again but now I can't get rid of the error:

zigbee2mqtt:info 2019-10-15T16:04:45: Logging to directory: '/app/data/log/2019-10-15.10-04-44'

zigbee2mqtt:debug 2019-10-15T16:04:45: Removing old log directory '/app/data/log/2019-10-15.09-58-26'

zigbee2mqtt:debug 2019-10-15T16:04:45: Can't load state from file /app/data/state.json (doesn't exist)

zigbee2mqtt:info 2019-10-15T16:04:45: Starting zigbee2mqtt version 1.6.0 (commit #9ebb1b9)

zigbee2mqtt:info 2019-10-15T16:04:45: Starting zigbee-herdsman...

zigbee2mqtt:debug 2019-10-15T16:04:45: Using zigbee-herdsman with settings: '{"network":{"panID":6754,"extenedPanID":[221,221,221,221,221,221,221,221],"channelList":[11],"networkKey":"HIDDEN"},"databasePath":"/app/data/database.db","backupPath":"/app/data/coordinator_backup.json","serialPort":{"baudRate":115200,"rtscts":true,"path":"/dev/ttyACM0"}}'

zigbee2mqtt:error 2019-10-15T16:04:52: Error while starting zigbee-herdsman

zigbee2mqtt:error 2019-10-15T16:04:52: Error: SRSP - SYS - version after 6000ms

at Timeout.object.timer.setTimeout [as _onTimeout] (/app/node_modules/zigbee-herdsman/dist/utils/waitress.js:44:24)

at ontimeout (timers.js:436:11)

at tryOnTimeout (timers.js:300:5)

at listOnTimeout (timers.js:263:5)

at Timer.processTimers (timers.js:223:10)

zigbee2mqtt:error 2019-10-15T16:04:52: Failed to start zigbee

zigbee2mqtt:error 2019-10-15T16:04:52: Exiting...

zigbee2mqtt:error 2019-10-15T16:04:52: Error: SRSP - SYS - version after 6000ms

at Timeout.object.timer.setTimeout [as _onTimeout] (/app/node_modules/zigbee-herdsman/dist/utils/waitress.js:44:24)

at ontimeout (timers.js:436:11)

at tryOnTimeout (timers.js:300:5)

at listOnTimeout (timers.js:263:5)

at Timer.processTimers (timers.js:223:10)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! zigbee2mqtt@1.6.0 start: `node index.js`

npm ERR! Exit status 1

npm ERR! Failed at the zigbee2mqtt@1.6.0 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/2019-10-15T16_04_52_216Z-debug.log

Using '/app/data' as data directory
indubwestep commented 4 years ago

Update: somehow my dev/tty device swapped to the second port of the CC2652 so changing to the other one fixed the above particular error. However, there is still the issue where adding entries to devices.js in zigbee2mqtt/node_modules/zigbee-herdsman-converters produces no change and I still receive errors of device unsupported for every device I try to add. Ive done npm install in that folder and permissions are correct. Hit a dead end..

Koenkk commented 4 years ago

Can you post the content of your devices.js? (post it on pastebin.com and link it here)

indubwestep commented 4 years ago

@Koenkk here you go : https://pastebin.com/JgViBb1Y

Koenkk commented 4 years ago

This is a zigbee-shepherd-converts devices.js.

I would recommand to

ayushjain4484 commented 4 years ago

Hey Koenkk, I am getting same issue and also not able to locate devices.js file. under node_module i can see below dir: zigbee-herdsman/ zigbee-shepherd-converters/

Please let me know if i am looking under correct path: /opt/zigbee2mqtt/node_modules

Koenkk commented 4 years ago

@ayushjain4484 first make sure you are on the latest zigbee2mqtt (1.7.1), after that do:

cd /opt/zigbee2mqtt
rm -rf node_modules && npm install

Now you will find the devices.js in /opt/zigbee2mqtt/node_modules/zigbee-herdsman-converters/devices.js.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.