Voilà, donc mon POC :
git clone https://github.com/Koenkk/zigbee-herdsman-converters.git
cd zigbee-herdsman-converters
npm ci
cd ..
nano test.js
const devices = [...require('./zigbee-herdsman-converters').devices];
console.log(JSON.stringify(devices,null, "\t"));
nodejs test.js > devices.json
et résultat un array contenant des équipements comme ceci :
{
"exposes": [{
"type": "light",
"features": [{
"type": "binary",
"name": "state",
"property": "state",
"access": 7,
"value_on": "ON",
"value_off": "OFF",
"value_toggle": "TOGGLE",
"description": "On/off state of this light"
}, {
"type": "numeric",
"name": "brightness",
"property": "brightness",
"access": 7,
"value_min": 0,
"value_max": 254,
"description": "Brightness of this light"
}, {
"type": "numeric",
"name": "color_temp",
"property": "color_temp",
"access": 7,
"unit": "mired",
"value_min": 150,
"value_max": 500,
"description": "Color temperature of this light",
"presets": [{
"name": "coolest",
"value": 150,
"description": "Coolest temperature supported"
}, {
"name": "cool",
"value": 250,
"description": "Cool temperature (250 mireds / 4000 Kelvin)"
}, {
"name": "neutral",
"value": 370,
"description": "Neutral temperature (370 mireds / 2700 Kelvin)"
}, {
"name": "warm",
"value": 454,
"description": "Warm temperature (454 mireds / 2200 Kelvin)"
}, {
"name": "warmest",
"value": 500,
"description": "Warmest temperature supported"
}
]
}
]
}, {
"type": "enum",
"name": "effect",
"property": "effect",
"access": 2,
"values": ["blink", "breathe", "okay", "channel_change", "finish_effect", "stop_effect"],
"description": "Triggers an effect on the light (e.g. make light blink for a few seconds)"
}, {
"type": "numeric",
"name": "linkquality",
"property": "linkquality",
"access": 1,
"unit": "lqi",
"description": "Link quality (signal strength)",
"value_min": 0,
"value_max": 255
}
],
"fromZigbee": [{
"cluster": "lightingColorCtrl",
"type": ["attributeReport", "readResponse"]
}, {
"cluster": "genOnOff",
"type": ["attributeReport", "readResponse"]
}, {
"cluster": "genLevelCtrl",
"type": ["attributeReport", "readResponse"]
}, {
"cluster": "genLevelCtrl",
"type": ["attributeReport", "readResponse"]
}, {
"cluster": "genOnOff",
"type": ["attributeReport", "readResponse"]
}, {
"cluster": "genBasic",
"type": ["attributeReport", "readResponse"]
}, {
"cluster": "genBasic",
"type": ["attributeReport", "readResponse"]
}, {
"cluster": "msOccupancySensing",
"type": ["attributeReport", "readResponse"]
}, {
"cluster": "msRelativeHumidity",
"type": ["attributeReport", "readResponse"]
}, {
"cluster": "msPressureMeasurement",
"type": ["attributeReport", "readResponse"]
}, {
"cluster": "msTemperatureMeasurement",
"type": ["attributeReport", "readResponse"]
}
],
"toZigbee": [{
"key": ["state", "brightness", "brightness_percent"]
}, {
"key": ["color_temp", "color_temp_percent"]
}, {
"key": ["transition"],
"attr": []
}, {
"key": ["rate"],
"attr": []
}, {
"key": ["brightness_move", "brightness_move_onoff"]
}, {
"key": ["colortemp_move", "color_temp_move"]
}, {
"key": ["brightness_step", "brightness_step_onoff"]
}, {
"key": ["color_temp_step"]
}, {
"key": ["level_config"]
}, {
"key": ["power_on_behavior"]
}, {
"key": ["color_options"]
}, {
"key": ["effect", "alert", "flash"]
}, {
"key": ["scene_store"]
}, {
"key": ["scene_recall"]
}, {
"key": ["scene_add"]
}, {
"key": ["scene_remove"]
}, {
"key": ["scene_remove_all"]
}
],
"meta": {
"configureKey": 2
},
"zigbeeModel": ["lumi.light.aqcn02"],
"model": "ZNLDP12LM",
"vendor": "Xiaomi",
"description": "Aqara smart LED bulb"
}
dans exposes
tu as quasi une liste de commande a créer avec le nom de la propriété etc
c’est sur base de ce json qu’ils créent les équipements dans le frontend zigbee2mqtt :
et hop ! 1358 équipements déjà tout faits