Skip to content

Instantly share code, notes, and snippets.

@ralmn
Last active July 28, 2023 00:33
Show Gist options
  • Save ralmn/02de46e193bf111062f15be07d3e9bd2 to your computer and use it in GitHub Desktop.
Save ralmn/02de46e193bf111062f15be07d3e9bd2 to your computer and use it in GitHub Desktop.
Lixee ZLinky_TIC - Zigbee2MQTT

Intégration du Lixee ZLinky_TIC dans Zigbee2MQTT

Le module Zlinky_TIC est maintenant intégré officillement dans Zigbee2MQTT grâce au travail de @vk496 !

Pour archives :

Information

Le temps que je fininalise l'intégration, et que je la propose en PR sur le dépot de zigbee2mqtt pour qu'elle soit intégré officiellement voici une 1er version de l'intégration que vous pouvez ajouter manuellement.

En cas de problème, merci de les indiquer en commentaire ou sur twitter @ralmn45

Depot avec toutes les infos : https://github.com/fairecasoimeme/Zlinky_TIC Achat du module : https://lixee.fr/produits/37-zigate-usb-ttl-3770014375148.html

Instruction

  1. Dans le dossier de votre configuration de zigbee2mqtt, creer un dossier avec converters
  2. Placer le fichier lixee.js dans le dossier converters
  3. Dans le fichier configuration.yaml ajouter:
external_converters:
  - converters/lixee.js
  1. Relancer zigbee2mqtt

A faire avant de proposer l'intégration

  • Faire ajouter dans Z2M le cluster custom (merci @vk496 Koenkk/zigbee-herdsman#464)
  • Traduire en anglais les descriptions
  • Voir si tous les champs sont necessaires
  • Mettre un minimum sur l'option measurement_poll_interval

ChangeLog

  • 5 decembre 2021
    • 21h20
      • Ajout des traduction (merci @Gael67350 :) )
  • 4 decembre 2021
    • 00h17
      • Correction PTEC (utilisation du nom de l'attribut)
  • 3 decembre 2021
    • 21h27
      • Options measurement_poll_interval :
        • Minimum a 60
        • Prise en compte du changement sans reboot Z2M
      • Tentative de bind 2 endpoint
  • 15 nov 2021
    • 21h56
      • Correction pour PTEC qui a un attribut qui n'est pas dans la lib ni dans la norme 🤔
    • 18h55
    • Configuration des attributs reportable en async sans blocage.
  • 13 nov 2021
    • 22h20
      • Remise des valeurs filtré ;) mais en desactivant le reportable
    • 19h06
      • Retrait de toutes les versions
      • Test avec des reportings
      • Retrait des options => recup tout le temps des valeurs
      • Retrait de certainnes valeurs (SMAXN*, EASF,, UMOY)
  • 10 nov 2021
    • 18h55
      • Ajout d'un lixee3.js avec des options pour limité la récupération d'info quand c'est pas necessaire. ATTENTION : il faut restart z2m pour qu'une options soit prise en compte pour le moment !
  • 08 nov 2021
    • 18h22
      • Corrige les données null dans le lixee2.js
    • 15h50
      • Ajout d'un lixee2.js avec l'ensemble des valeurs
  • 07 nov 2021
    • 12h40
      • Ajout des index HP HC
    • 14h05
      • Inversion index HP / HC
    • 16h05
      • Fusion HC/HP dans l'index energy
  • 06 nov 2021
    • 1ere versions
/*
CETTE INTEGRATION NEST PLUS SUPPORTER ! MERCI D'UTILISER L'INTEGRATION OFFICILELLE
*/
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const { repInterval } = require('zigbee-herdsman-converters/lib/constants');
const { precisionRound, postfixWithEndpointName } = require('zigbee-herdsman-converters/lib/utils');
const e = exposes.presets;
const ea = exposes.access;
const options_measurement_poll_interval = exposes.numeric(`measurement_poll_interval`, ea.SET).withValueMin(60).withDescription(`This device does not support reporting electric measurements so it is polled instead. The default poll interval is 120 seconds. Min value is 60 seconds`);
// full list available on https://github.com/fairecasoimeme/Zlinky_TIC/blob/master/README.md
// Thanks for the translation of the descriptions to @Gael67350 (https://github.com/Gael67350)
let dataReportable = [
{"name":"PAPP","unit":"VA","clusterId":2820,"attributId":1295,"description":"Apparent power","cluster":"haElectricalMeasurement","attribut":"apparentPower","standard":false,"reportable":true,"onetime":false},
{"name":"IINST","unit":"A","clusterId":2820,"attributId":1288,"description":"RMS current","cluster":"haElectricalMeasurement","attribut":"rmsCurrent","standard":false,"reportable":true,"onetime":false},
{"name":"IINST1","unit":"A","clusterId":2820,"attributId":1288,"description":"RMS current (phase 1)","cluster":"haElectricalMeasurement","attribut":"rmsCurrent","standard":false,"reportable":true,"onetime":false},
{"name":"IINST2","unit":"A","clusterId":2820,"attributId":2312,"description":"RMS current (phase 2)","cluster":"haElectricalMeasurement","attribut":"rmsCurrentPhB","standard":false,"reportable":true,"onetime":false},
{"name":"IINST3","unit":"A","clusterId":2820,"attributId":2568,"description":"RMS current (phase 3)","cluster":"haElectricalMeasurement","attribut":"rmsCurrentPhC","standard":false,"reportable":true,"onetime":false},
{"name":"EAST","unit":"Wh","clusterId":1794,"attributId":0,"description":"Total active power delivered","cluster":"seMetering","attribut":"currentSummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"EASF10","unit":"Wh","clusterId":1794,"attributId":274,"description":"Total provider active power delivered (index10)","cluster":"seMetering","attribut":"currentTier10SummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"EASF01","unit":"Wh","clusterId":1794,"attributId":256,"description":"Total provider active power delivered (index 01)","cluster":"seMetering","attribut":"currentTier1SummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"EASF02","unit":"Wh","clusterId":1794,"attributId":258,"description":"Provider active power delivered (index 02)","cluster":"seMetering","attribut":"currentTier2SummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"EASF03","unit":"Wh","clusterId":1794,"attributId":260,"description":"Provider active power delivered (index 03)","cluster":"seMetering","attribut":"currentTier3SummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"EASF07","unit":"Wh","clusterId":1794,"attributId":268,"description":"Provider active power delivered (index 07)","cluster":"seMetering","attribut":"currentTier7SummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"EASF09","unit":"Wh","clusterId":1794,"attributId":272,"description":"Provider active power delivered (index 09)","cluster":"seMetering","attribut":"currentTier9SummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"EASF04","unit":"Wh","clusterId":1794,"attributId":262,"description":"Provider active power delivered (index 04)","cluster":"seMetering","attribut":"currentTier4SummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"EASF05","unit":"Wh","clusterId":1794,"attributId":264,"description":"Provider active power delivered (index 05)","cluster":"seMetering","attribut":"currentTier5SummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"EASF06","unit":"Wh","clusterId":1794,"attributId":266,"description":"Provider active power delivered (index 06)","cluster":"seMetering","attribut":"currentTier6SummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"EASF08","unit":"Wh","clusterId":1794,"attributId":270,"description":"Provider active power delivered (index 08)","cluster":"seMetering","attribut":"currentTier8SummDelivered","standard":true,"reportable":true,"onetime":false},
{"name":"CCASN","unit":"W","clusterId":2820,"attributId":1291,"description":"Current point of the active load curve drawn","cluster":"haElectricalMeasurement","attribut":"activePower","standard":true,"reportable":true,"onetime":false},
{"name":"SMAXN","unit":"VA","clusterId":2820,"attributId":1293,"description":"Apparent power delivered peak","cluster":"haElectricalMeasurement","attribut":"activePowerMax","standard":true,"reportable":true,"onetime":false},
{"name":"SMAXN1","unit":"VA","clusterId":2820,"attributId":1293,"description":"Apparent power delivered peak (phase 1)","cluster":"haElectricalMeasurement","attribut":"activePowerMax","standard":true,"reportable":true,"onetime":false},
{"name":"SMAXN2","unit":"VA","clusterId":2820,"attributId":2317,"description":"Apparent power delivered peak (phase 2)","cluster":"haElectricalMeasurement","attribut":"activePowerMaxPhB","standard":true,"reportable":true,"onetime":false},
{"name":"SMAXN3","unit":"VA","clusterId":2820,"attributId":2573,"description":"Apparent power delivered peak (phase 3)","cluster":"haElectricalMeasurement","attribut":"activePowerMaxPhC","standard":true,"reportable":true,"onetime":false},
{"name":"CCASN-1","unit":"W","clusterId":2820,"attributId":2315,"description":"Previous point of the active load curve drawn","cluster":"haElectricalMeasurement","attribut":"activePowerPhB","standard":true,"reportable":true,"onetime":false},
{"name":"SINSTS","unit":"VA","clusterId":2820,"attributId":1295,"description":"Immediate apparent power delivered","cluster":"haElectricalMeasurement","attribut":"apparentPower","standard":true,"reportable":true,"onetime":false},
{"name":"SINSTS1","unit":"VA","clusterId":2820,"attributId":1295,"description":"Immediate apparent power delivered (phase 1)","cluster":"haElectricalMeasurement","attribut":"apparentPower","standard":true,"reportable":true,"onetime":false},
{"name":"SINSTS2","unit":"VA","clusterId":2820,"attributId":2319,"description":"Immediate apparent power delivered (phase 2)","cluster":"haElectricalMeasurement","attribut":"apparentPowerPhB","standard":true,"reportable":true,"onetime":false},
{"name":"SINSTS3","unit":"VA","clusterId":2820,"attributId":2575,"description":"Immediate apparent power delivered (phase 3)","cluster":"haElectricalMeasurement","attribut":"apparentPowerPhC","standard":true,"reportable":true,"onetime":false},
{"name":"UMOY1","unit":"V","clusterId":2820,"attributId":1297,"description":"Average RMS voltage (phase 1)","cluster":"haElectricalMeasurement","attribut":"averageRmsVoltageMeasPeriod","standard":true,"reportable":true,"onetime":false},
{"name":"UMOY3","unit":"V","clusterId":2820,"attributId":2577,"description":"Average RMS voltage (phase 3)","cluster":"haElectricalMeasurement","attribut":"averageRmsVoltageMeasPeriodPhC","standard":true,"reportable":true,"onetime":false},
{"name":"UMOY2","unit":"V","clusterId":2820,"attributId":2321,"description":"Average RMS voltage (phase 2)","cluster":"haElectricalMeasurement","attribut":"averageRmsVoltageMeasurePeriodPhB","standard":true,"reportable":true,"onetime":false},
{"name":"ERQ2","unit":"VArh","clusterId":2820,"attributId":1294,"description":"Total reactive power (Q2)","cluster":"haElectricalMeasurement","attribut":"reactivePower","standard":true,"reportable":true,"onetime":false},
{"name":"ERQ3","unit":"VArh","clusterId":2820,"attributId":2318,"description":"Total reactive power (Q3)","cluster":"haElectricalMeasurement","attribut":"reactivePowerPhB","standard":true,"reportable":true,"onetime":false},
{"name":"ERQ4","unit":"VArh","clusterId":2820,"attributId":2574,"description":"Total reactive power (Q4)","cluster":"haElectricalMeasurement","attribut":"reactivePowerPhC","standard":true,"reportable":true,"onetime":false},
{"name":"IRMS1","unit":"A","clusterId":2820,"attributId":1288,"description":"RMS current (phase 1)","cluster":"haElectricalMeasurement","attribut":"rmsCurrent","standard":true,"reportable":true,"onetime":false},
{"name":"IRMS2","unit":"A","clusterId":2820,"attributId":2312,"description":"RMS current (phase 2)","cluster":"haElectricalMeasurement","attribut":"rmsCurrentPhB","standard":true,"reportable":true,"onetime":false},
{"name":"IRMS3","unit":"A","clusterId":2820,"attributId":2568,"description":"RMS current (phase 3)","cluster":"haElectricalMeasurement","attribut":"rmsCurrentPhC","standard":true,"reportable":true,"onetime":false},
{"name":"URMS1","unit":"V","clusterId":2820,"attributId":1285,"description":"RMS voltage (phase 1)","cluster":"haElectricalMeasurement","attribut":"rmsVoltage","standard":true,"reportable":true,"onetime":false},
{"name":"URMS2","unit":"V","clusterId":2820,"attributId":2309,"description":"RMS voltage (phase 2)","cluster":"haElectricalMeasurement","attribut":"rmsVoltagePhB","standard":true,"reportable":true,"onetime":false},
{"name":"URMS3","unit":"V","clusterId":2820,"attributId":2565,"description":"RMS voltage (phase 3)","cluster":"haElectricalMeasurement","attribut":"rmsVoltagePhC","standard":true,"reportable":true,"onetime":false},
{"name":"ERQ1","unit":"VArh","clusterId":2820,"attributId":773,"description":"Total reactive power (Q1)","cluster":"haElectricalMeasurement","attribut":"totalReactivePower","standard":true,"reportable":true,"onetime":false},
{"name":"EAIT","unit":"Wh","clusterId":1794,"attributId":1,"description":"Total active power injected","cluster":"seMetering","attribut":"currentSummReceived","standard":true,"reportable":true,"onetime":false},
];
let dataNonReportable = [
{"name":"BASE","unit":"Wh","clusterId":1794,"attributId":0,"description":"Base index","cluster":"seMetering","attribut":"currentSummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"PMAX","unit":"W","clusterId":2820,"attributId":1293,"description":"Three-phase power peak","cluster":"haElectricalMeasurement","attribut":"activePowerMax","standard":false,"reportable":false,"onetime":false},
{"name":"IMAX","unit":"A","clusterId":2820,"attributId":1290,"description":"RMS current peak","cluster":"haElectricalMeasurement","attribut":"rmsCurrentMax","standard":false,"reportable":false,"onetime":false},
{"name":"IMAX1","unit":"A","clusterId":2820,"attributId":1290,"description":"RMS current peak (phase 1)","cluster":"haElectricalMeasurement","attribut":"rmsCurrentMax","standard":false,"reportable":false,"onetime":false},
{"name":"IMAX2","unit":"A","clusterId":2820,"attributId":2314,"description":"RMS current peak (phase 2)","cluster":"haElectricalMeasurement","attribut":"rmsCurrentMaxPhB","standard":false,"reportable":false,"onetime":false},
{"name":"IMAX3","unit":"A","clusterId":2820,"attributId":2570,"description":"RMS current peak (phase 3)","cluster":"haElectricalMeasurement","attribut":"rmsCurrentMaxPhC","standard":false,"reportable":false,"onetime":false},
{"name":"ISOUSC","unit":"A","clusterId":2817,"attributId":13,"description":"Subscribed intensity level","cluster":"haMeterIdentification","attribut":"availablePower","standard":false,"reportable":false,"onetime":false},
{"name":"VTIC","unit":"-","clusterId":2817,"attributId":10,"description":"Customer tele-information protocol version","cluster":"haMeterIdentification","attribut":"softwareRevision","standard":true,"reportable":false,"onetime":true},
{"name":"PTEC","unit":"-","clusterId":1794,"attributId":32,"description":"Current pricing period","cluster":"seMetering","attribut":"activeRegisterTierDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"HCHC","unit":"Wh","clusterId":1794,"attributId":256,"description":"HCHC index","cluster":"seMetering","attribut":"currentTier1SummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"EJPHN","unit":"Wh","clusterId":1794,"attributId":256,"description":"EJPHN index","cluster":"seMetering","attribut":"currentTier1SummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"BBRHCJB","unit":"Wh","clusterId":1794,"attributId":256,"description":"BBRHCJB index","cluster":"seMetering","attribut":"currentTier1SummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"BBRHCJW","unit":"Wh","clusterId":1794,"attributId":260,"description":"BBRHCJW index","cluster":"seMetering","attribut":"currentTier3SummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"BBRHCJR","unit":"Wh","clusterId":1794,"attributId":264,"description":"BBRHCJR index","cluster":"seMetering","attribut":"currentTier5SummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"ADC0","unit":"-","clusterId":1794,"attributId":776,"description":"Serial Number","cluster":"seMetering","attribut":"meterSerialNumber","standard":false,"reportable":false,"onetime":true},
{"name":"HCHP","unit":"Wh","clusterId":1794,"attributId":258,"description":"HCHP index","cluster":"seMetering","attribut":"currentTier2SummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"EJPHPM","unit":"Wh","clusterId":1794,"attributId":258,"description":"EJPHPM index","cluster":"seMetering","attribut":"currentTier2SummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"BBRHPJB","unit":"Wh","clusterId":1794,"attributId":258,"description":"BBRHPJB index","cluster":"seMetering","attribut":"currentTier2SummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"BBRHPJW","unit":"Wh","clusterId":1794,"attributId":262,"description":"BBRHPJW index","cluster":"seMetering","attribut":"currentTier4SummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"BBRHPJR","unit":"Wh","clusterId":1794,"attributId":266,"description":"BBRHPJR index","cluster":"seMetering","attribut":"currentTier6SummDelivered","standard":false,"reportable":false,"onetime":false},
{"name":"ADSC","unit":"-","clusterId":1794,"attributId":776,"description":"Secondary meter address","cluster":"seMetering","attribut":"meterSerialNumber","standard":true,"reportable":false,"onetime":true},
{"name":"PREF","unit":"kVA","clusterId":2817,"attributId":13,"description":"Apparent power of reference (PREF)","cluster":"haMeterIdentification","attribut":"availablePower","standard":true,"reportable":false,"onetime":false},
{"name":"PCOUP","unit":"kVA","clusterId":2817,"attributId":14,"description":"Apparent power threshold (PCOUP)","cluster":"haMeterIdentification","attribut":"powerThreshold","standard":true,"reportable":false,"onetime":false},
{"name":"PRM","unit":"-","clusterId":1794,"attributId":775,"description":"PRM","cluster":"seMetering","attribut":"siteId","standard":true,"reportable":false,"onetime":true},
];
// All attributes avaialables
let data = [
...dataReportable,
...dataNonReportable
];
function extractAttribute(cluster, nonReportableOnly){
let attributes = (nonReportableOnly ? dataNonReportable : data).filter(item => item.cluster === cluster);
return attributes
.filter(a => a.onetime == false)
.map(i => i.attribut)
.filter(a=>a != null)
.filter((value, index, self) => self.indexOf(value) === index); // Unique attributs
}
// For HomeAssistant
const indexEnergy = () => exposes.numeric('energy', ea.STATE).withUnit('Wh').withDescription('Index Base').withProperty('currentSummDelivered');
// Generate all metrics from attributs list
let exposesData = data.map(item => {
if(item.unit != null && item.unit != '-' && item.unit != ''){
return exposes.numeric(item.name, ea.STATE).withDescription(item.description).withProperty(item.attribut).withUnit(item.unit);
}else{
return exposes.text(item.name, ea.STATE).withDescription(item.description).withProperty(item.attribut);
}
}).filter(e => e != null);
function parsingResponse(model, msg, entries) {
let payload = {}
console.log(msg.cluster, msg.type);
for (let entry in msg.data) {
if(msg.data[entry] != null){
const val = msg.data[entry]
if(typeof(val) == "number"){
payload[postfixWithEndpointName(entry, msg, model)] = precisionRound(val, 2)
}else {
payload[postfixWithEndpointName(entry, msg, model)] = val;
}
}
}
console.log(payload, msg.data);
return payload;
}
const haMeterIdentificationFZ = {
cluster: 'haMeterIdentification',
type: ['attributeReport', 'readResponse', 'write'],
convert: (model, msg, publish, options, meta) => {
return parsingResponse(model, msg, extractAttribute('haMeterIdentification', false))
}
};
const haElectricalMeasurementFZ = {
cluster: 'haElectricalMeasurement',
type: ['attributeReport', 'readResponse', 'write'],
convert: (model, msg, publish, options, meta) => {
return parsingResponse(model, msg, extractAttribute('haElectricalMeasurement', false))
}
};
const seMeteringFZ = {
cluster: 'seMetering',
type: ['attributeReport', 'readResponse', 'write'],
convert: (model, msg, publish, options, meta) => {
let payload = parsingResponse(model, msg, extractAttribute('seMetering', false))
// merging of off-peak and peak hour meter
if (payload['currentSummDelivered'] == 0 && (payload['currentTier1SummDelivered'] > 0 || payload['currentTier2SummDelivered'] > 0)) {
payload['currentSummDelivered'] = payload['currentTier1SummDelivered'] + payload['currentTier2SummDelivered'];
}
return payload;
}
};
function createChunk(array, chunkSize) {
let R = [];
for (let i = 0; i < array.length; i += chunkSize) {
R.push(array.slice(i, i + chunkSize));
}
return R;
}
// Read attributs when are not reportable
async function poll(endpoint) {
console.log("POLL ");
// let attrs = extractAttribute('haMeterIdentification', true);
// await endpoint.read('haMeterIdentification', attrs);
// let chunks = [
// [
// "rmsCurrent",
// "rmsCurrentPhB",
// "rmsCurrentPhC",
// ],
// [
// "apparentPower",
// // ],
// // [
// "activePower",
// "activePowerPhB",
// ],
// [
// "apparentPowerPhB",
// "apparentPowerPhC",
// ],
// [
// "reactivePower",
// "reactivePowerPhB",
// "reactivePowerPhC",
// ],
// [
// "rmsVoltage",
// "rmsVoltagePhB",
// "rmsVoltagePhC",
// // ],
// // [
// "totalReactivePower"
// ]
// ];
attrs = extractAttribute('haElectricalMeasurement', true).sort((a, b)=> a.localeCompare(b));
let chunks = createChunk(attrs, 5);
for(let chunk of chunks)
await endpoint.read('haElectricalMeasurement', chunk);
// attrs = extractAttribute('seMetering', true).sort((a, b)=> a.localeCompare(b));
// chunks = [
// [
// "currentSummDelivered",
// "currentTier1SummDelivered",
// "currentTier2SummDelivered",
// "currentTier3SummDelivered",
// // ],
// // [
// //"meterSerialNumber",
// "ptec", // 32
// // ],
// // [
// "currentSummReceived",
// //"siteId"
// ]
// ];
// let othersAttrs = attrs.filter(a => !chunks[0].includes(a));
// if(othersAttrs.length > 0)
// chunks.push(othersAttrs);
attrs = extractAttribute('seMetering', true).sort((a, b)=> a.localeCompare(b));
chunks = createChunk(attrs, 5);
for(let chunk of chunks)
await endpoint.read('seMetering', chunk);
}
const definition = {
zigbeeModel: ['ZLinky_TIC'],
model: 'ZLinky_TIC',
vendor: 'LiXee',
description: 'Lixee ZLinky',
fromZigbee: [haMeterIdentificationFZ, seMeteringFZ, haElectricalMeasurementFZ],
toZigbee: [],
exposes: [indexEnergy(), ...exposesData],
configure: async (device, coordinatorEndpoint, logger) => {
const SW1_ENDPOINT = 1;
const endpoint = device.getEndpoint(SW1_ENDPOINT);
// ZLinky don't emit divisor and multiplier
endpoint.saveClusterAttributeKeyValue('haElectricalMeasurement', { acCurrentDivisor: 1, acCurrentMultiplier: 1 });
endpoint.saveClusterAttributeKeyValue('seMetering', { divisor: 1, multiplier: 1 });
reporting.bind(endpoint, coordinatorEndpoint, ['haElectricalMeasurement']).then(() => {}).catch(e => {
logger.error(`ZLINKY_TIC : failed to bind haElectricalMeasurement ${e.message}`);
});
reporting.bind(endpoint, coordinatorEndpoint, ['seMetering']).then(() => {}).catch(e => {
logger.error(`ZLINKY_TIC : failed to bind haElectricalMeasurement ${e.message}`);
});
for(let reportable of dataReportable){
logger.debug(`ZLINKY_TIC: Start configure reporting for ${reportable.name} (${reportable.cluster}/${reportable.attribut}).`);
//await endpoint.read(reportable.cluster, [reportable.attribut]);
endpoint.configureReporting(reportable.cluster || reportable.clusterId,
[{
attribute: reportable.attribut || reportable.attributId,
minimumReportInterval: 1,
maximumReportInterval: repInterval.MINUTES_5,
reportableChange: 1,
}]).then(() => {
logger.debug(`ZLINKY_TIC: ${reportable.name} (${reportable.cluster}/${reportable.attribut}) report successfully configured.`);
}).catch(e => { // Bug on firmware v1.0.0 (2021 11 01) -> Some attributs reportable cannot be configured
logger.warning(`ZLINKY_TIC: Failed to configure reporting for ${reportable.name} (${reportable.cluster}/${reportable.attribut}). Adding in polling attributs list.`)
dataNonReportable.push(reportable);
});
}
for(let data of dataNonReportable.filter(d => d.cluster).filter(d => d.attribut).filter(d => d.onetime)){
console.log(data.cluster, data.attribut);
endpoint.read(data.cluster, [data.attribut]);
}
},
options: [options_measurement_poll_interval],
onEvent: async (type, data, device, options) => {
const endpoint = device.getEndpoint(1);
const intervalDefined = globalStore.hasValue(device, 'interval');
if (type === 'stop') {
clearInterval(globalStore.getValue(device, 'interval'));
globalStore.clearValue(device, 'interval');
} else if (!intervalDefined) {
// periodic scan for non-reportable attributs
const seconds = options && options.measurement_poll_interval ? options.measurement_poll_interval : 120;
const interval = setInterval(async () => {
try {
await poll(endpoint);
} catch (error) {/* Do nothing*/ }
}, seconds * 1000);
globalStore.putValue(device, 'interval', interval);
globalStore.putValue(device, 'interval_seconds', seconds);
try{
await poll(endpoint);
}catch(e){ }
}else{
if(intervalDefined){
const seconds = options && options.measurement_poll_interval ? options.measurement_poll_interval : 120;
const defined_seconds = globalStore.getValue(device, 'interval_seconds');
if(seconds != defined_seconds){
clearInterval(globalStore.getValue(device, 'interval'));
const interval = setInterval(async () => {
try {
await poll(endpoint);
} catch (error) {/* Do nothing*/ }
}, seconds * 1000);
globalStore.putValue(device, 'interval', interval);
globalStore.putValue(device, 'interval_seconds', seconds);
}
}
}
},
endpoint: (dev) => {
return {
'haElectricalMeasurement': 1, 'seMetering': 1, 'haMeterIdentification': 1, 'default': 1
}
}
};
module.exports = definition;
@ullrik
Copy link

ullrik commented May 9, 2022

@Cyril-E pour la réintégration, tu as été appuyer sur le bouton de ton TIC ou tu as juste autorisé les appairages au niveau de Zigbee2MQTT qui à retrouver le TIC ?
Je vais faire le teste suite à ton retour.

@Cyril-E
Copy link

Cyril-E commented May 9, 2022

@ullrik il faut faire les deux
Je met Zigbee2MQTT en mode appairage, puis je vais au garage mettre le module en appairage en appuyant 10s sur le bouton, faut faire attention le bouton est pas pile poil en face du trou :-)

Attention aussi avec la MAJ 1.25.1 ya un espèce de bug d'affichage, si la page s'affiche vide, vide le cache de ton navigateur ou essaye avec un autre qui n'a jamais ouvert la page

@ullrik
Copy link

ullrik commented May 16, 2022

@Cyril-E merci pour tes informations.

Petit retour pour ma part :
J'ai arrêté le service Zigbee2MQTT et j'ai fait une sauvegarde du répertoire zigbee2mqtt (tar.gz)
J'ai fait l'update Zigbee2MQTT. Attention suite à l'observation de warning, j'ai du faire un update de node et npm (puis re update de Zigbee2MQTT).
Ensuite depuis l'interface de Zigbee2MQTT, j'ai supprimé mon appareil "TIC". Activation de l'autorisation d'appairage, puis la manipe de 10 sec sur le TIC branché sur mon Linky. Au passage, j'en ai profité pour regarder mes informations de forfait : message 1 -> Nom du contrat = BASE et message 2 -> Mode TIC = HISTORIQUE (pour aide lien Linky)
Une fois l'ajout de l'appareil confirmé, j'ai pu renommer et modifier les "paramètres (spécifique)" avec :

friendly_name: ZLinky_TIC
tarif: Historique - BASE
production: 'false'
energy_phase: single_phase
linky_mode: historique
kWh_precision: 3

Un petit reboot et un changement de variable coté HA pour prendre la bonne valeur dans énergie, à savoir le sensor : sensor.zlinky_tic_base.

J'imagine que suite à l'update de Zigbee2MQTT lors de ma 1ère tentative, le soucis venait que j'avais une configuration en linky_mode = standard.

@TROM83
Copy link

TROM83 commented Jun 5, 2022

Bonjour.
Je ne sais pas si je poste au bon endroit pour exposer mon problème...
Jusqu'alors j'utilisais le ZLinky en mode Historique (je suis en triphasé) et tout fonctionnait bien (carte énergie et carte visualisation puissance apparente instantanée). Je voulais aussi visualiser la puissance apparente instantanée de chacune des 3 phases, et je suis donc passé en mode Standard.
Depuis, les 3 valeurs SINSTS ne correspondent pas du tout avec celles affichées sur mon Linky.
Pour info, Zigbee2mqtt Current version: 1.25.2-1, ZLinky V5, et version HA core-2022.6.2
{
"active_enerfy_out_d01": 29394,
"active_power": 478,
"active_power_max": 3340,
"active_power_max_ph_b": 1790,
"active_power_max_ph_c": 1130,
"active_power_ph_b": 870,
"apparent_power": 21776,
"apparent_power_ph_b": 42998,
"apparent_power_ph_c": 18031,
"available_power": 15,
"average_rms_voltage_meas_period": 236,
"average_rms_voltage_meas_period_ph_c": 235,
"average_rms_voltage_measure_period_ph_b": 236,
"current_date": "E220605141516",
"current_index_tarif": 1,
"current_price": "BASE",
"current_summ_delivered": 33854,
"current_tarif": "BASE",
"current_tier1_summ_delivered": 28785,
"current_tier2_summ_delivered": 3686,
"drawn_v_a_max_n1": 1700,
"drawn_v_a_max_n1_p2": 2250,
"drawn_v_a_max_n1_p3": 2420,
"linkquality": 255,
"message1": "PAS DE MESSAGE",
"message2": "",
"meter_serial_number": "xxx",
"power_threshold": 15,
"rms_current": 6,
"rms_current_max": 65535,
"rms_current_ph_c": 1,
"rms_voltage": 234,
"rms_voltage_ph_b": 234,
"rms_voltage_ph_c": 234,
"site_id": "xxx",
"software_revision": 2,
"status_register": "003A0001",
"update": {
"state": "idle"
},
"update_available": false
}
Alors que sur le Linky : Pui App : 1800VA, Pui1 : 1460VA, P2VA, Pui3 : 300VA (valeurs au moment du log).

Voilà, j'espère que je pourrai trouver une aide ici, ou alors que l'on m'aiguille sur un site qui me permettre de résoudre ce problème.

Merci par avance

@SilentT19
Copy link

SilentT19 commented Jun 5, 2022 via email

@TROM83
Copy link

TROM83 commented Jun 5, 2022

Bonjour.
Oui, je suis bien passé en mode standard sur le compteur Linky suite à ma demande auprès d'Enedis. J'ai bien vérifié sur l'écran du Linky.

@SilentT19
Copy link

SilentT19 commented Jun 5, 2022 via email

@TROM83
Copy link

TROM83 commented Jun 6, 2022

C'est que j'avais fait aussi. Supression du Linky dans Z2mqtt, relance de Z2mqtt et réintégration. Plusieurs fois. Mais j'ai toujors ce même problème...

@SilentT19
Copy link

SilentT19 commented Jun 6, 2022 via email

@TROM83
Copy link

TROM83 commented Jun 6, 2022

Merci pour ton aide. Ce sont bien ces valeurs que je regarde, j'avais édité mon message ;-)
Quand je regarde sur le log que j'ai publié, il y a bien une incohérence puisque ma puissance max est de 15kVA et que les valeurs sont bien supérieures
"apparent_power": 21776,
"apparent_power_ph_b": 42998,
"apparent_power_ph_c": 18031,

@SilentT19
Copy link

SilentT19 commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment