This new update of Z2MQTT gives hell of a time… It looks like its much more difficult to load external converters now.
It doesnt look like adding the external_converters:
yourfile.js*
does anything.
Reading the new support page it looks like the file should be loaded via MQTT message, but I cant figure it out how it works. This is what I supposed to do: To save a converter at runtime, send a message to zigbee2mqtt/bridge/request/converter/save with payload {"name": "my-first-converter.js", "code": <HERE COMES YOUR CONVERTER CODE>}. The code will be saved in data/external_converters/ in the file with the given name.
Whatever I try I only see this in the logs:
2025-01-04 22:35:09z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/response/converter/save', payload '{"data":{},"error":"Invalid payload","status":"error"}'
I cant even save a test message in this file, let alone my full converter…
I tried to manually find the save location to just put my already existing file there, but couldnt. Any help would be appreciated especially some of the unsupported devices are thermostats and currently they dont function.
External converters and extensions
The external_converters setting is no longer used. Instead all external converters inside data/external_converters directory are now automatically loaded. Make sure to move all your external converters to this directory.
External extensions are now loaded from data/external_extensions instead of data/extension. Make sure to rename your data/extension directory (if present) to data/external_extensions.
/data ist the folder, which holds the configuration of z2m, so you should create there a new folder “external_extensions” and put your converts .js file in it.
There should also be a “log” folder there with your logs and there should be a migration log.
Okay this helped a lot.
In the log file under z2m:mqtt: Received MQTT message on ‘zigbee2mqtt/bridge/info’ with data I can see:
“external_converters”:[“dvr.js”]
So it seem to be picking up the file, but the my thermostat is still unsupported and doesnt have any exposes. This was working perfectly before the update the update, so I dont think its the file that is wrong.
I dont see any error related converters or dvr.js in the logs either. Any tips how to troubleshoot this further?
I figured it out. I’m not sure what was the issue, but my suspicion is some kind of weird folder ownership issue.
Originally I created the data/external_converters folder with the file editor addon. It was not working.
I saw a post on github that you should do it via CLI. So I deleted the folder via CLI first, then re-created it via the command line and it worked.
@Arnen if this makes you feel any better, your simple instructions got it working for me. Thanks for taking the time to post them.
Ironically, Z2M has very detailed documentation but this is definitely a fail on their part. There seems to be a lot of discrepancies and missing information on how to do this.
Using zigbee2mqtt has ha integration “data/external_converters” is a new directory “external_converters” in the zigbee2mqtt directory.
Just create external_converters directory in the zigbee2mqtt directory and move your js files to this new directory.
Hope this help…