(name: string, mod: TModule, newName?: string)
| 39 | } |
| 40 | |
| 41 | protected async loadJS(name: string, mod: TModule, newName?: string): Promise<void> { |
| 42 | try { |
| 43 | removeExternalDefinitions(name); |
| 44 | |
| 45 | const definitions = Array.isArray(mod) ? mod : [mod]; |
| 46 | |
| 47 | for (const definition of definitions) { |
| 48 | definition.externalConverterName = newName ?? name; |
| 49 | |
| 50 | addExternalDefinition(definition); |
| 51 | logger.info(`Loaded external converter '${newName ?? name}'.`); |
| 52 | } |
| 53 | |
| 54 | await this.zigbee.resolveDevicesDefinitions(true); |
| 55 | } catch (error) { |
| 56 | logger.error( |
| 57 | /* v8 ignore next */ |
| 58 | `Failed to load external converter '${newName ?? name}'. Check the code for syntax error and make sure it is up to date with the current Zigbee2MQTT version.`, |
| 59 | ); |
| 60 | logger.warning( |
| 61 | "External converters are not meant for long term usage, but for local testing after which a pull request should be created to add out-of-the-box support for the device", |
| 62 | ); |
| 63 | |
| 64 | throw error; |
| 65 | } |
| 66 | } |
| 67 | } |
nothing calls this directly
no test coverage detected