Trouble adding external definition

Hey All,

For the life of me I cant figure out what I’m doing wrong. I have an unsupported thermostat I’m trying to get working. Trying to follow the guide to add external definitions:

But whatever I do, no new expose appears for the device. The guide says to save the new js file next to the configuration.yaml for z2m which I did. (in this case dvr.js)


Then add it as external converter in the same file as:
external_converters:
- dvr.js

But doesnt matter what I try to put in dvr.js nothing shows up or changes for the unsupported thermostat in zigbee2mqtt. I would understand if the exposes I set up did not work because they are incorrect, but it looks like the z2m doesnt even pick up my file. Any tips what I’m doing wrong?

@nemlehet4 here’s a handy trick I use to confirm the file is picked up.

Edit your description: field and add something at the end. After reloading z2m, check the description in the device page - if it shows your edit, then the converter has been loaded and your problem is elsewhere.

Here’s one of mine where I added “CUSTOM plus 11”:

Good tip!

It looks like its not picking up anything:

const definition = {
    // Since a lot of Tuya devices use the same modelID, but use different datapoints
    // it's necessary to provide a fingerprint instead of a zigbeeModel
   fingerprint: [
       {
        modelID: 'TS0601',
        manufacturerName: '_TZE200_mzik0ov2',
           
          },
       ],
        model: 'TS0601'
        vendor: 'Tuya',
        description: 'Zigbee thermostat for electric floors',

Any suggestions or thoughts what I’m doing wrong?

Its a bit hard to tell from your post but make sure you have two spaces before the - dvr.js in your configuration.yaml file.
It needs to be indented.

You can also check your log file (with log level at least set to info).
It will show whether it loaded right at the startup of zigbee2mqtt.
e.g.

Starting Zigbee2MQTT without watchdog.
[2024-09-20 18:13:24] info:     z2m: Logging to console, file (filename: log.log)
[2024-09-20 18:13:24] info:     z2m: Loaded external converter 'abcdef.js'
[2024-09-20 18:13:24] debug:    z2m: Loaded state from file H:\zigbee\zigbee2mqtt\data\state.json

I checked but it should be correctly indented.
image

This whats really bogging me, I dont see anything. No error, nothing, like the file is not even there.

Startup logs show nothing.

[2024-09-20 13:24:04] info: 	z2m: Starting Zigbee2MQTT version 1.40.1 (commit #unknown)
[2024-09-20 13:24:04] info: 	z2m: Starting zigbee-herdsman (0.57.3)
[2024-09-20 13:24:04] debug: 	z2m: Using zigbee-herdsman with settings: '"{\"network\":{\"panID\":41477,\"extendedPanID\":[187,1,228,55,90,118,192,32],\"channelList\":[25],\"networkKey\":\"HIDDEN\"},\"databasePath\":\"/config/zigbee2mqtt/database.db\",\"databaseBackupPath\":\"/config/zigbee2mqtt/database.db.backup\",\"backupPath\":\"/config/zigbee2mqtt/coordinator_backup.json\",\"serialPort\":{\"path\":\"/dev/ttyUSB0\"},\"adapter\":{\"concurrent\":null,\"delay\":null,\"disableLED\":false}}"'
[2024-09-20 13:24:04] debug: 	zh:adapter: Failed to validate path: 'Error: spawn udevadm ENOENT'
[2024-09-20 13:24:04] debug: 	zh:controller: Starting with options '{"network":{"networkKeyDistribute":false,"networkKey":"HIDDEN","panID":41477,"extendedPanID":[187,1,228,55,90,118,192,32],"channelList":[25]},"serialPort":{"path":"/dev/ttyUSB0"},"adapter":{"disableLED":false,"concurrent":null,"delay":null},"databasePath":"/config/zigbee2mqtt/database.db","databaseBackupPath":"/config/zigbee2mqtt/database.db.backup","backupPath":"/config/zigbee2mqtt/coordinator_backup.json"}'
[2024-09-20 13:24:04] info: 	zh:zstack:znp: Opening SerialPort with {"path":"/dev/ttyUSB0","baudRate":115200,"rtscts":false,"autoOpen":false}
[2024-09-20 13:24:04] info: 	zh:zstack:znp: Serialport opened
[2024-09-20 13:24:04] debug: 	zh:zstack:znp: SREQ: --> SYS - ping - {"capabilities":1}

The only thing I can think of is that I created the dvr.js file with the file editor addon and that caused some kind of weird ownership issue, but I’m unsure how to check it.

Okay, I figured it out.

On the above screenshot, in row 3 I tried to put external_converters: as a parameter for the advanced options.

It should be the same level as its separate config option, not a subparamer.
image

Now its getting picked up, I can see it in the logs.

1 Like

Glad you figured it out. Next time, save yourself the hassle and just add the external converters via the Z2M frontend.

2 Likes