backup für IoBroker Stabel Version. Zigbee Adapter;:
including.js 3.3.5 Zigbee Adapter
Javascript. Wie oben.
Code
- const fs = require('fs');
- const inhalt = `"use strict";
- const fzLD2450 = {
- cluster: "genAnalogInput",
- type: ["attributeReport"],
- convert: (model, msg) => {
- const ep = msg.endpoint.ID;
- const val = msg.data.presentValue;
- if (ep === 25) return { slot1_brightness: Math.round(val * 1000) / 1000 };
- if (ep === 26) return { slot1_temperature: Math.round(val * 10) / 10 };
- if (ep === 27) return { slot1_pressure: Math.round(val * 10) / 10 };
- switch (ep) {
- case 1: return { slot1_distance: val };
- case 6: return { slot1_x: val };
- case 7: return { slot1_y: val };
- case 9: return { slot2_distance: val };
- case 14: return { slot2_x: val };
- case 15: return { slot2_y: val };
- case 17: return { slot3_distance: val };
- case 22: return { slot3_x: val };
- case 23: return { slot3_y: val };
- }
- },
- };
- function numeric(property, access, unit, min, max) {
- return {
- type: "numeric",
- property,
- access,
- unit,
- value_min: min,
- value_max: max,
- };
- }
- module.exports = [{
- zigbeeModel: ["LD2450"],
- fingerprint: [{ manufacturerName: "erforscht", modelID: "LD2450" }],
- model: "LD2450_erforscht",
- vendor: "erforscht",
- description: "LD2450 12 endpoints",
- meta: { multiEndpoint: true },
- configure: async (device, coordinator) => {
- const used = [1,6,7,9,14,15,17,22,23,25,26,27];
- for (const ep of used) {
- const endpoint = device.getEndpoint(ep);
- if (!endpoint) continue;
- try { await endpoint.bind("genAnalogInput", coordinator); } catch (_) {}
- const change =
- [1,6,7,9,14,15,17,22,23].includes(ep)
- ? 0.01
- : 0.01;
- await endpoint.configureReporting("genAnalogInput", [{
- attribute: 0x0055,
- minimumReportInterval: 1,
- maximumReportInterval: 3600,
- reportableChange: change,
- }]);
- }
- },
- fromZigbee: [fzLD2450],
- toZigbee: [],
- exposes: [
- numeric("slot1_distance", 1, "m", 0, 6),
- numeric("slot1_x", 1, "m", -6, 6),
- numeric("slot1_y", 1, "m", -6, 6),
- numeric("slot1_brightness", 1, "lx", 0, 100000),
- numeric("slot1_temperature", 1, "°C", -40, 85),
- numeric("slot1_pressure", 1, "hPa", 300, 1100),
- numeric("slot2_distance", 1, "m", 0, 6),
- numeric("slot2_x", 1, "m", -6, 6),
- numeric("slot2_y", 1, "m", -6, 6),
- numeric("slot3_distance", 1, "m", 0, 6),
- numeric("slot3_x", 1, "m", -6, 6),
- numeric("slot3_y", 1, "m", -6, 6),
- ],
- }];
- `;
- fs.writeFile('/opt/iobroker/iobroker-data/zigbee_0/including.js', inhalt, (err) => {
- if (err) {
- console.error(`Fehler beim Schreiben der Datei: ${err.message}`);
- } else {
- console.log('including.js wurde erfolgreich erstellt / überschrieben.');
- }
- });
