Hola @zedyxer,
De mi lado, utilizo Gladys con K8S, por lo que no tengo acceso al montaje automático de Docker.
Para Zigbee, como tú, utilizo un contenedor aparte que está conectado a Gladys. Para hacer que ambos se comuniquen, modifico los valores de conexión directamente en Docker.
Paso los archivos:
/src/server/services/zigbee2mqtt/lib/init.js
/src/server/services/zigbee2mqtt/lib/getConfiguration.js
Después, no es la mejor técnica, pero la he estado usando desde hace mucho tiempo y nunca he tenido problemas. Sin embargo, hay que verificar de vez en cuando las actualizaciones del código Zigbee en caso de que haya cambios importantes (1 vez hasta ahora)
Aquí están los archivos en cuestión:
init.js
Resumen
const logger = require('../../../utils/logger');
const { CONFIGURATION } = require('./constants');
const { generate } = require('../../../utils/password');
const { PlatformNotCompatible } = require('../../../utils/coreErrors');
/**
* @description Prepares service and starts connection with broker if needed.
* @example
* await z2m.init();
*/
async function init() {
// Load stored configuration
const configuration = await this.getConfiguration();
this.mqttRunning = true
await this.connect(configuration);
await this.saveConfiguration(configuration);
return null;
}
module.exports = {
init,
};
getConfiguration.js
Resumen
const logger = require('../../../utils/logger');
const { CONFIGURATION } = require('./constants');
/**
* @description Get MQTT configuration.
* @returns {Promise} Current MQTT network configuration.
* @example
* getConfiguration();
*/
async function getConfiguration() {
logger.debug('Zigbee2mqtt: loading stored configuration...');
// Load z2m parameters
const z2mDriverPath = await this.gladys.variable.getValue(CONFIGURATION.Z2M_DRIVER_PATH, this.serviceId);
//const z2mMqttUsername = await this.gladys.variable.getValue(CONFIGURATION.Z2M_MQTT_USERNAME_KEY, this.serviceId);
//const z2mMqttPassword = await this.gladys.variable.getValue(CONFIGURATION.Z2M_MQTT_PASSWORD_KEY, this.serviceId);
const z2mMqttUsername = '<username>';
const z2mMqttPassword = '<password>';
// Load MQTT parameters
// const mqttUrl = await this.gladys.variable.getValue(CONFIGURATION.MQTT_URL_KEY, this.serviceId);
const mqttUrl = 'mqtt://<IP>:1883';
const mqttUsername = '<username>';
const mqttPassword = '<password>';
// const mqttUsername = await this.gladys.variable.getValue(CONFIGURATION.GLADYS_MQTT_USERNAME_KEY, this.serviceId);
// const mqttPassword = await this.gladys.variable.getValue(CONFIGURATION.GLADYS_MQTT_PASSWORD_KEY, this.serviceId);
return {
z2mDriverPath,
z2mMqttUsername,
z2mMqttPassword,
mqttUrl,
mqttUsername,
mqttPassword,
};
}
module.exports = {
getConfiguration,
}