External converters
See original GitHub issueHi, @Koenkk
I’ve noticed a little pain in diy community. Each and every DIY developer needs to write/modify converters, some times this devices are in very limited quantity or not even meant to be published. So many guys are modifying fromZigbee.js
straight from node_modules
folder, which eventually causes all changes are lost during update. What if we implement mechanism to support external converters?
We can create base package with some interfaces, like this
interface FromZigbeeConverter {
cluster: string;
type: string[];
convert(model, msg, publish, options, meta): unknown;
}
interface ToZigbeeConverter {
key: string[];
convertSet(entity, key, value, meta): Promise<void>;
convertGet(entity, key, meta): Promise<unknown>;
}
interface DeviceDescriptor {
zigbeeModel: string[];
model: string;
vendor: string;
description: string;
supports: string;
fromZigbee: FromZigbeeConverter[];
toZigbee: ToZigbeeConverter[];
meta?: { configureKey: number },
configure?(device, coordinatorEndpoint): Promise<void>
}
- package.json declaration
{
"name": "my-awesome-converter"
"main": "custom-converter.js"
}
users could install their packages like this, or even from their github repositories
npm install ~/my-super-converter
And implement loading js modules who are implementing this interfaces. This configuration can be placed in z2m configuration files, where we can just list of packages ex:
external_converters:
- my-awesome-converter
If this idea is good enough, I’m ready to invest my time into implementation.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (9 by maintainers)
Hi, @ciotlosm! Can you try to prepend
NODE_PATH=/app/node_modules
env variable beforeZIGBEE2MQTT_DATA
in Dockerfile?Done, documentation: https://github.com/Koenkk/zigbee2mqtt.io/blob/develop/docs/externalConvertersExample/dummy-converter.js#L66