mirror of https://github.com/arendst/Tasmota.git
Additional hardware connection information
parent
5efb035383
commit
bbc4d5141e
174
Zigbee.md
174
Zigbee.md
|
@ -23,18 +23,8 @@ Before using Zigbee, you need to understand a few concepts. Here is a simplified
|
|||
|**Encryption Key**<BR>128-bit encryption key.<BR>*default: 0x0D0C0A08060402000F0D0B0907050301*|Wi-Fi password|
|
||||
|**Pairing**<BR>By default the coordinator does not accept new devices unless put in pairing mode. When in pairing mode, it will accept pairing requests from any device within range.<BR>*Default: pairing disabled*|WPS|
|
||||
|
||||
## Pre-requisites:
|
||||
1. Flash an ESP82xx with `CCLib_proxy.ino.bin`
|
||||
2. Connect the CC2530 and the ESP82xx
|
||||
3. Flash the CC2530 with adequate firmware
|
||||
4. Compile Tasmota with `#define USE_ZIGBEE` in `user_config_override.h`
|
||||
5. Flash an ESP82xx device with the firmware file from step 4
|
||||
6. Configure the Tasmota device using a custom template. Assign **`Zigbee Tx (165)`** and **`Zigbee Rx (166)`** to the corresponding GPIOs used for serial communication with the CC2530. For example:
|
||||
`{"NAME":"Z2T Coordinator","GPIO":[0,0,0,0,0,0,0,0,0,166,0,165,0],"FLAG":0,"BASE":18}`
|
||||
|
||||
## Hardware preparation
|
||||
Z2T requires a TI CC2530 based module flashed with `Z-Stack-firmware` from [Koen Kanters](https://github.com/Koenkk). More specifically, it requires `Z-Stack_Home_1.2`, of type `Default` (not `Source Routing`). The latest CC2530 firmware files are available for download [here](https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_Home_1.2/bin/default).
|
||||
|
||||
## Hardware
|
||||
### Zigbee Adapter
|
||||
**You cannot use any CC2531 based device with Tasmota** - the CC2531 only supports USB communication. It does not support serial communications as required by Z2T.
|
||||
|
||||
|Device |Notes|
|
||||
|
@ -43,15 +33,47 @@ Z2T requires a TI CC2530 based module flashed with `Z-Stack-firmware` from [Koen
|
|||
|**[CC2530 with external antenna](https://www.aliexpress.com/item/33007098493.html)**<BR><img src="https://user-images.githubusercontent.com/49731213/64906209-c0ad1680-d6e3-11e9-8703-71ea36c5be72.jpg" width="240"><BR>or<BR><img src="https://user-images.githubusercontent.com/49731213/64913622-eec24300-d743-11e9-9416-0b19a4cbc3c4.jpg" width="240">|Better range.|
|
||||
|**[CC2530 with external antenna and CC2591 RF front end](https://www.aliexpress.com/item/4000118023903.html)**<BR><img src="https://user-images.githubusercontent.com/49731213/64906219-f0f4b500-d6e3-11e9-8cd0-e135af531718.jpg" width="240">|Best range.<BR>Please note you need a specific firmware for CC2591 frontend.|
|
||||
|
||||
## Flashing the CC2530
|
||||
There are many tutorials on how to flash a CC2530. They usually require you to buy a [CC_DEBUGGER](https://www.aliexpress.com/item/32869263224.html). You can use an ESP82xx device to flash the CC2530. **You don't need to buy a CC_DEBUGGER** (usually ~$10). Flashing with a Wemos D1 Mini or equivalent and `CCLib` is described in detail in [this blog post](https://www.zigbee2mqtt.io/information/alternative_flashing_methods.html).
|
||||
### Wi-Fi Adapter
|
||||
Using an ESP82xx device such as a Wemos D1 Mini or a NodeMCU to flash the CC2530 (described below) is a lower cost alternative than using a single purpose [CC_DEBUGGER](https://www.aliexpress.com/item/32869263224.html). This ESP82xx device can then also be used as the Wi-Fi adapter for MQTT messaging in normal operation.
|
||||
|
||||
To simplify the process, a ready to use [fork of CCLib](https://github.com/s-hadinger/CCLib) is available.
|
||||
Alternatively, you can use the ESP82xx device above to flash the CC2530 adapter(s) and then use a separate Tasmota device for Z2T. In normal operation, this device only needs to have two free GPIO for the serial communications with the CC2530.
|
||||
|
||||
For the flashing process, you need four connections:
|
||||
## Procedure
|
||||
1. Flash the CC2530 with appropriate firmware
|
||||
2. Flash an ESP82xx device with Z2T firmware
|
||||
3. Connect the CC2530 to the Tasmota Device
|
||||
4. Configure and run Z2T
|
||||
|
||||
## 1. Flashing the CC2530
|
||||
Z2T requires a TI CC2530 based module flashed with `Z-Stack-firmware` from [Koen Kanters](https://github.com/Koenkk). More specifically, it requires `Z-Stack_Home_1.2`, of type `Default` (not `Source Routing`). The latest CC2530 firmware files are available for download [here](https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_Home_1.2/bin/default).
|
||||
|
||||
There are many tutorials on how to flash a CC2530. They usually require you to buy a [CC_DEBUGGER](https://www.aliexpress.com/item/32869263224.html). You can use an ESP82xx device to flash the CC2530. **You don't need to buy a CC_DEBUGGER** (usually ~$10).
|
||||
|
||||
Flashing with a Wemos D1 Mini or equivalent and `CCLib` is described in detail in [this blog post](https://www.zigbee2mqtt.io/information/alternative_flashing_methods.html).
|
||||
|
||||
### A. Flashing `CCLib_proxy.ino.bin` on an ESP82xx Device
|
||||
To simplify this, a ready to use [fork of CCLib](https://github.com/s-hadinger/CCLib) is available. Follow the usual ESP82xx [flashing process](Flashing) - you are just using this firmware instead of Tasmota.
|
||||
|
||||
<BR>ESP<BR>Device|Serial<BR>Programming<BR>Adapter
|
||||
:--:|:--:
|
||||
3.3V|3.3V
|
||||
GND|GND
|
||||
GPIO0|GND
|
||||
GPIO1|Rx
|
||||
GPIO3|Tx
|
||||
|
||||
Vcc (3.3V), GND, Tx (GPIO1), and Rx (GPIO3) are connected via the USB on Wemos D1 Mini.
|
||||
|
||||
Once the firmware upload completes, retain the serial interface connections (3.3V, GND, Tx, Rx). These will be used later for flashing the CC2530.
|
||||
|
||||
### B. Connect the CC2530 and the ESP82xx
|
||||
|
||||
For the flashing process, you need the following connections:
|
||||
|
||||
ESP<BR>Device|<BR>CC2530
|
||||
:--:|:--:
|
||||
3.3V|3.3V
|
||||
GND|GND
|
||||
GPIO4|CC_DC<BR>(A.K.A. P2_2 or Debug Clock)
|
||||
GPIO5|CC_RST
|
||||
GPIO12|CC_DD_I<BR>(A.K.A. P2_1 or Debug Data)
|
||||
|
@ -62,6 +84,7 @@ Note: GPIO12 and GPIO14 are shorted - this is normal!
|
|||
>
|
||||
> In the future, there should be a way to avoid one of these GPIO connections by patching CCLib.
|
||||
|
||||
### C. Upload the firmware to the CC2530
|
||||
For convenience, ready to use firmware binaries are provided. Unzip them and select the right one: `CC2530`, `CC2530 + CC2591` or `CC2530 + CC2592`.
|
||||
|
||||
Make sure you have Python 2.7 installed
|
||||
|
@ -102,8 +125,10 @@ Debug config:
|
|||
[ ] TIMER_SUSPEND
|
||||
```
|
||||
|
||||
Flashing the CC2530 **takes \~1 hour**. To flash the firmware, use the following command:
|
||||
To flash the firmware, use the following command:
|
||||
`python Python/cc_write_flash.py -e -p /dev/cu.usbserial-1420 -i Bin/CC2530_DEFAULT_20190608_CC2530ZNP-Prod.hex`
|
||||
|
||||
Flashing the CC2530 **takes about 1 hour**.
|
||||
```
|
||||
INFO: Found a CC2530 chip on /dev/cu.usbserial-xxxx
|
||||
|
||||
|
@ -139,12 +164,17 @@ Flashing:
|
|||
Completed
|
||||
```
|
||||
|
||||
## Connection between ESP82xx and CC2530
|
||||
## 2. Flash the ESP82xx Device with Tasmota
|
||||
Once the CC2530 flashing process completes, flash the ESP82xx device with the Z2T firmware.
|
||||
- [Compile Tasmota](Flashing#flashing-and-compiling-from-source) with `#define USE_ZIGBEE` in `user_config_override.h`
|
||||
- Follow the usual ESP82xx [Tasmota flashing process](Flashing)
|
||||
|
||||
## 3. Connect the CC2530 to the Tasmota Device
|
||||
The connection uses a 115200 baud serial connection. Hence you need to configure 2 GPIOs: `Zigbee TX` and `Zigbee RX`.
|
||||
|
||||
If you are using your ESP82xx device to flash the Zigbee adapter as described in the flashing section, GPIO4, GPIO5, GPIO12, GPIO14 are already in use. You may want to leave these connections in place in case you need to update the CC2530 firmware in the future. Otherwise, any of these GPIO can also be used.
|
||||
|
||||
It is best to use the hardware serial pins (GPIO1/GPIO3 or GPIO13/GPIO15) for high speed serial. However, TasmotaSerial version 2.4.x (PR #6377) improved the reliability of software serial. This allows any GPIO to be used.
|
||||
It is best to use the hardware serial pins (GPIO1/GPIO3 or GPIO13/GPIO15) for high speed serial. However, TasmotaSerial version 2.4.x (PR [#6377](../pull/6377)) improved the reliability of software serial. This allows any GPIO to be used.
|
||||
|
||||
Recommended connections:
|
||||
|
||||
|
@ -153,9 +183,12 @@ ESP<BR>Device|Tasmota<BR>Component|<BR>CC2530
|
|||
GPIO13|Zigbee RX (166)|CC_TXD<BR>(A.K.A. P0_3)
|
||||
GPIO15|Zigbee TX (165)|CC_RXD<BR>(A.K.A. P0_2)
|
||||
|
||||
Configure the Tasmota device using a custom template. Assign **`Zigbee Tx (165)`** and **`Zigbee Rx (166)`** to the corresponding GPIOs to be used for serial communication with the CC2530. For example:
|
||||
`{"NAME":"Zigbee","GPIO":[0,0,0,0,0,0,0,0,0,166,0,165,0],"FLAG":0,"BASE":18}`
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/49731213/64920989-ec043400-d7bd-11e9-8f5c-74ece5c4e26c.jpg" width="240">
|
||||
|
||||
## Running Z2T
|
||||
## 4. Running Z2T
|
||||
Due to memory constraints of the CC2530, you can only pair 16 devices to a coordinator ([See details](https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator)). **You cannot use any CC2531 based device with Tasmota** - the CC2531 only supports USB communication. It does not support serial communications as required by Z2T.
|
||||
|
||||
There is an alternative firmware allowing for Zigbee routers to create a mesh network and go beyond 16 devices. This is currently not tested nor supported by Z2T. It may be added later.
|
||||
|
@ -164,56 +197,6 @@ Z2T is still in its early phase. Logging is set to verbose mode to ease reportin
|
|||
|
||||
After the Tasmota device boots, Z2T will wait for 15 seconds before initializing the CC2530. This time allows for Wi-Fi and MQTT connection (hopefully).
|
||||
|
||||
Normal boot looks like:
|
||||
```
|
||||
MQT: tele/<topic>/INFO3 = {"RestartReason":"External System"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":1,"Message":"Booting"}}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"410000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"4180020200020603"}
|
||||
ZIG: checking device configuration
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"2108000F00"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"6108000155"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"2102"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"61020200020603901534010200000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":50,"MajorRel":2,"MinorRel":6,"MaintRel":3,"Revision":20190608}}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"260483"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"6604008302631A"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"26042D"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"6604002D08CCCCCCCCCCCCCCCC"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"260484"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"660400840400080000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"260462"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"660400621001030507090B0D0F00020406080A0C0D"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"260463"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"660400630100"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":3,"Message":"Configured, starting coordinator"}}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"25406400"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"654000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"45C009"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"2700"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"6700006FF09D19004B12000000070901208F"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":51,"IEEEAddr":"00124B00199DF06F","ShortAddr":"0x0000","DeviceType":7,"DeviceState":9,"NumAssocDevices":1,"AssocDevicesList":["0x8F20"]}}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"250200000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"650200"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"4582000000000000408F000050A0000100A00000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"250500000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"650500"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"4585000000000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"2400010401050000000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"640000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"24000B0401050000000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"640000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"250500000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"650500"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"45850000000000020B01"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"25360200000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"653600"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"45CB00"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"45B6000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":0,"Message":"Started"}}
|
||||
ZIG: zigbee device ready, listening...
|
||||
```
|
||||
|
||||
When you first run your CC2530, you will see additional steps to configure the device:
|
||||
```
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":1,"Message":"Booting"}}
|
||||
|
@ -282,10 +265,59 @@ ZIG: zigbee device ready, listening...
|
|||
You can also force a complete reconfiguration of your CC2530 with the following command, and reboot:
|
||||
`ZigbeeZNPSend 2112000F0100`
|
||||
|
||||
Normal boot looks like:
|
||||
```
|
||||
MQT: tele/<topic>/INFO3 = {"RestartReason":"External System"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":1,"Message":"Booting"}}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"410000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"4180020200020603"}
|
||||
ZIG: checking device configuration
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"2108000F00"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"6108000155"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"2102"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"61020200020603901534010200000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":50,"MajorRel":2,"MinorRel":6,"MaintRel":3,"Revision":20190608}}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"260483"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"6604008302631A"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"26042D"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"6604002D08CCCCCCCCCCCCCCCC"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"260484"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"660400840400080000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"260462"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"660400621001030507090B0D0F00020406080A0C0D"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"260463"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"660400630100"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":3,"Message":"Configured, starting coordinator"}}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"25406400"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"654000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"45C009"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"2700"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"6700006FF09D19004B12000000070901208F"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":51,"IEEEAddr":"00124B00199DF06F","ShortAddr":"0x0000","DeviceType":7,"DeviceState":9,"NumAssocDevices":1,"AssocDevicesList":["0x8F20"]}}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"250200000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"650200"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"4582000000000000408F000050A0000100A00000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"250500000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"650500"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"4585000000000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"2400010401050000000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"640000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"24000B0401050000000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"640000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"250500000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"650500"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"45850000000000020B01"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPSent":"25360200000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"653600"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"45CB00"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeZNPReceived":"45B6000000"}
|
||||
MQT: tele/<topic>/RESULT = {"ZigbeeStatus":{"Status":0,"Message":"Started"}}
|
||||
ZIG: zigbee device ready, listening...
|
||||
```
|
||||
|
||||
## Using Z2T
|
||||
|
||||
### Z2T Status
|
||||
|
||||
You can inspect the log output to determine whether Z2T started correctly. Z2T sends several `ZigbeeStatus` messages to inform the MQTT host about initialization:
|
||||
Ex: ```{"ZigbeeStatus":{"Status":1,"Message":"Booting"}}```
|
||||
- `Status` contains a numeric code about the status message
|
||||
|
|
Loading…
Reference in New Issue