Skip to content

Zigbee.begin(ZIGBEE_ROUTER) creates own network, if a previous network is unavailable #11745

@madmagic007

Description

@madmagic007

Board

ESP32C6

Device Description

Supermini

Hardware Configuration

Version

v3.3.0

Type

Bug

IDE Name

VSCode with PlatformIO

Operating System

Linux Nobara 42

Flash frequency

40MHz

PSRAM enabled

yes

Upload speed

921600

Description

I want to make my ESP32C6 use zigbee for wireless communication with ROUTER mode to create a mesh network.
I am running zigbee2mqtt on a raspberry pi 4 with a skyconnect dongle.

If the esp has successfully connected to the z2m network before, but then is out of reach / the z2m network is down, Zigbee.connected() still returns true, and it appears the esp has created its own zigbee network even tho i dont tell it to. This is 100% reproducible for me across all 5 C6 Supermini boards i currently have.

If instead i begin the zigbee stack with Zigbee.begin(ZIGBEE_END_DEVICE), the stack never gets past the begin() call, even when a prior connection to the z2m network was made.

Adding to this, when using end device mode, it appears that with a clean nvs Zigbee.begin() passes and returns false on Zigbee.connected(). But if a prior connection was established that now is unavailable, the execution halts on Zigbee.begin() and only makes it past once the network is available.

I tried to get more info with Zigbee.setDebugMode(true);, but i am unsure how to see these logs.

Sketch

#include <Arduino.h>
#include "Zigbee.h"

ZigbeeAnalog zbAnalogDevice = ZigbeeAnalog(1);

void setup() {
    Serial.begin(115200);
    delay(2000);

    rgbLedWrite(RGB_BUILTIN, 1, 0, 0);

    zbAnalogDevice.setManufacturerAndModel("Espressif", "ZigbeeAnalogDevice");
    Zigbee.addEndpoint(&zbAnalogDevice);

    Serial.println("before zigbee begin");
    if (!Zigbee.begin(ZIGBEE_ROUTER)) {
        Serial.println("Zigbee failed to start!");
        Serial.println("Rebooting...");
        ESP.restart();
    }

    rgbLedWrite(RGB_BUILTIN, 0, 0, 1);

    Serial.println("before zigbee connected");
    while (!Zigbee.connected()) delay(100);

    Serial.println("zigbee is connected");
    Serial.println(esp_zb_get_pan_id());
    rgbLedWrite(RGB_BUILTIN, 0, 1, 0);
}

void loop() {
}

Debug Message

Serial output:

ROUTER/END_DEVICE mode, network available:
before zigbee begin
before zigbee connected
zigbee is connected
22215

ROUTER mode, network NOT available:
before zigbee begin
before zigbee connected
zigbee is connected
22215

END_DEVICE mode, network NOT available:
before zigbee begin

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Area: ZigbeeIssues and Feature Request about Zigbee

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions