itead / Sonoff_Zigbee_Dongle_Firmware

155 stars 18 forks source link

Is there a way to let router firmware report lqi to coordinator through zigbee periodically? #2

Closed tukenmail closed 1 year ago

tukenmail commented 1 year ago

Is there a way to let router firmware report lqi to coordinator through zigbee periodically? I bought some Dongle-E, and I want to use it as router to extend network range. But router firmware should report lqi periodically, so I can track network health. After joining it to network, It doesn't report lqi. How to let it report lqi periodically? Thank you.

I use zigbee2mqtt on my system. This is my configuration below.

const fz = require('zigbee-herdsman-converters/converters/fromZigbee'); const tz = require('zigbee-herdsman-converters/converters/toZigbee'); const exposes = require('zigbee-herdsman-converters/lib/exposes'); const reporting = require('zigbee-herdsman-converters/lib/reporting'); const extend = require('zigbee-herdsman-converters/lib/extend'); const e = exposes.presets; const ea = exposes.access;

const definition = { zigbeeModel: ['DONGLE-E_R'], model: 'SONOFF.ROUTER', vendor: 'Custom devices (DiY)', description: 'SONOFF router', fromZigbee: [fz.CC2530ROUTER_led, fz.CC2530ROUTER_meta, fz.ignore_basic_report], toZigbee: [tz.ptvo_switch_trigger], exposes: [exposes.binary('led', ea.STATE, true, false)], };

module.exports = definition;

Device joined to network successfully, but not reporting lqi. I have noticed there is a ascii based serial shell. Maybe something to do with this? Is there a document?

darkxst commented 1 year ago

@tukenmail documentation for the shell is here (not many of the plugins are included though in iTead build it appears): https://docs.silabs.com/zigbee/6.10/zigbee-af-api/cli

I will check later if LQI for the router is reported under ZHA, it certainly is not under Zigbee2MQTT.

tukenmail commented 1 year ago

Thank you for this information.

I have found a way to get lqi. It's my configuration on zigbee2mqtt below.

const definition = { zigbeeModel: ['DONGLE-E_R'], model: 'SONOFF.ROUTER', vendor: 'Custom devices (DiY)', description: 'SONOFF router', fromZigbee: [fz.CC2530ROUTER_led, fz.CC2530ROUTER_meta, fz.ignore_basic_report], toZigbee: [tz.ptvo_switch_trigger, tz.ptvo_switch_uart, tz.ptvo_switch_analog_input, tz.ptvo_switch_light_brightness, tz.on_off], exposes: [exposes.text('action').withAccess(ea.STATE_SET)].concat(((enpoinsCount) => { const features = []; for (let i = 1; i <= enpoinsCount; i++) { const epName = l${i}; features.push(e.switch().withEndpoint(epName)); features.push(exposes.text(epName, ea.ALL).withEndpoint(epName) .withProperty(epName).withDescription('State or sensor value')); } return features; })(16)), meta: {multiEndpoint: true, tuyaThermostatPreset: fz.legacy / for subclassed custom converters /}, endpoint: (device) => { return { l1: 1, l2: 2, l3: 3, l4: 4, l5: 5, l6: 6, l7: 7, l8: 8, l9: 9, l10: 10, l11: 11, l12: 12, l13: 13, l14: 14, l15: 15, l16: 16, action: 1, }; }, };

Then publish this to mqtt. topic: zigbee2mqtt/0x84b4dbfffef81092/get payload: {"state": ""}

Hope this router firmware can report lqi automatically in the future. And we can configure the report interval.

darkxst commented 1 year ago

That converter config doesnt look correct, I'm surprised it works at all!

Luckily support for this device has recently been added to Zigbee2MQTT. It is currently in the Edge (development) branch only, however it will end up in a future stable release.

See this commit for the details https://github.com/Koenkk/zigbee-herdsman-converters/commit/c42a5430b16f5ce6abc618076cc8b6c74d5f3b9b

darkxst commented 1 year ago

ZBDongle-E router is support is now in the latest stable release of Zigbee2MQTT