Closed Fusseldieb closed 1 year ago
This project is on very early stage. I assume you are new to esphome so I will describe the example.yaml
briefly to provide some insights:
# Setup a basic esphome device + reset the zigbee module on boot-up once
esphome:
name: ${name}
platform: ESP32
board: esp-wrover-kit
on_boot:
priority: 600
then:
- switch.turn_off: download_mode
- switch.turn_on: zigbee_reset
# Retrieve two external components
# The first one provides a ser2net implementation / make the serial line of the zigbee module available via telnet
# The second components provides some auto-discovery functionality called zeroconf
external_components:
- source: github://oxan/esphome-stream-server
- source: github://syssi/esphome-zeroconf@main
# Configure the ethernet module. The esphome node retrieves an IP address via DHCP.
ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 1
power_pin: GPIO16
# Expose an API to be integrated in Home Assitant easily
api:
# Allow OTA updates of the device. Esphome nodes can be flashed via HA or by `esphome run example.yaml`.
ota:
# Setup the logger component. The log is accessible via `esphome logs example.yaml` (network) or on UART0 of the ESP32 (by wire).
logger:
# Setup a second UART interface with 115200. The zigbee module is attached to GPIO4/GPIO2. We can to talk to the zigbee module
uart:
id: uart_zigbee
rx_pin: GPIO4
tx_pin: GPIO2
baud_rate: 115200
# Attach the UART port of the zigbee module to the stream server (ser2net implementation). We can access the zigbee module via ethernet/telnet now!
stream_server:
uart_id: uart_zigbee
port: 6638
# Expose the button to HA. Not important.
binary_sensor:
- platform: gpio
pin:
number: GPIO34
inverted: true
name: "${name} button"
# Load the i2c component and search for devices on the i2c bus. There is some EEPROM available but we don't talk to the devices on the i2c bus right now. For Tasmota and Zigbee2mqtt the EEPROM is important because it's the storage of the paired zigbee devices and key material (I think).
i2c:
- id: i2c_bus
sda: GPIO33
scl: GPIO32
scan: true
# Let the red LED link if there is no connection to Home Assistant
status_led:
pin:
# red led
number: GPIO15
inverted: true
switch:
# Expose a switch entity to toggle a restart of the device
- platform: restart
name: "${name} restart"
# Expose a switch entity to reset/reboot the zigbee module on demand
- platform: template
id: zigbee_reset
name: "${name} Zigbee Reset"
turn_on_action:
- switch.turn_on: zigbee_rst
- delay: 10ms
- switch.turn_off: zigbee_rst
# SM-011 V1.0 nRST
- platform: gpio
id: zigbee_rst
pin: GPIO13
name: "${name} Zigbee nRST"
inverted: true
internal: true
restore_mode: ALWAYS_OFF
# Expose a switch entity to boot into the download mode on demand
# SM-011 V1.0 PA00
- platform: gpio
id: download_mode
pin: GPIO12
name: "${name} Zigbee Download Mode"
inverted: true
restore_mode: ALWAYS_OFF
# Push some messages to the network so Home Assistant is able to pick up the device automatically / auto-discover the device. This is untested. Without this feature you have to go to the "Integration" page and setup the ZHA component. You can find a good description here: https://github.com/thegroove/esphome-zbbridge#zha-configuration
zeroconf:
- service: tube_zb_gw_efr32
protocol: tcp
port: 6638
txt:
version: 1.0
radio_type: ezsp
baud_rate: 115200
data_flow_control: software
IMO all building blocks (ESP32, Zigbee module & Ethernet) of the device are working already. The green LED isn't in use at the moment. The small reset button is exposed (you can see the key press in Home Assistant) but has no special task. The Zigbee module is accesible via Ethernet/Telnet and is compatible with the ZHA component of HA if you make sure the correct firmware (ncp-uart-sw_6.7.8_115200.ota
) is flashed.
Feel free to ask any detail questions. Do you need instructions how to flash the device the first time?
This project is very similar for another hardware (Sonoff Zigbee Bridge). The idea is the same: Exposing the Zigbee module via serial-over-tcp.
Build blocks of the Sonoff Zigbee bridge: ESP8266 (Wifi chip) + EFR32MG21 (Zigbee module) Build blocks of the Ewelink ZB-GW03: ESP32 (Wifi+BLE) + EFR32MG21 (Zigbee module) + LAN8720 (Ethernet module)
That's cool! Now it makes more sense!
I assume you are new to esphome
Actually not, I have more than 30 ESPHome devices thoughout my home already and all of them work just beautiful. But it's nice of you to detail it so well, it will certainly be useful for anyone that searches for it (even for me!)
The Zigbee module is accesible via Ethernet/Telnet and is compatible with the ZHA component of HA if you make sure the correct firmware (ncp-uart-sw_6.7.8_115200.ota) is flashed.
Since it uses ncp-uart-sw, afaik it's the same Tasmots uses, isn't it? This would mean it doesn't work with multiple hub devices together, or does it? Would be lovely to mesh multiple devices together for some of them to act as just routers. The majority of the lamps I have here are terrible routers and are very weak too. I have asked on the Tasmota repo and they simply said "No, and it won't ever be implemented" and closed the issue...
I've reacted to your question at the HA community already: Are you sure a zigbee network can have multiple coordinators? AFAIK there is only one coordinator per network.
You are right: This component is just a network bridge between ZHA and the Zigbee module (+ zigbee firmware). The mentioned firmware is the one from the tasmota repository. I want to try these firmware versions some day:
https://github.com/xsp1989/zigbeeFirmware/tree/master/firmware/Zigbee3.0_Dongle
But it is the same: The magic happens at the zigbee firmware & ZHA stack (in Home Assistant). This esphome configuration provides just the glue.
AFAIK there is only one coordinator per network.
Yep, there can be only one coordinator. That's exactly my question: If it could be reconfigured as a router.
The mentioned firmware is the one from the tasmota repository.
Then afaik it can't
But it is the same: The magic happens at the zigbee firmware & ZHA stack (in Home Assistant). This esphome configuration provides just the glue.
Ah yes! I don't quite like Tasmota, since the configurations are stored separately and not compiled. I prefer ESPHome much more....
But it is the same: The magic happens at the zigbee firmware & ZHA stack (in Home Assistant). This esphome configuration provides just the glue.
Ah yes! I don't quite like Tasmota, since the configurations are stored separately and not compiled. I prefer ESPHome much more....
FYI, ZHA is also relatively easy to get started with integrated components -> https://www.home-assistant.io/integrations/zha
I've added a https://github.com/syssi/esphome-zb-gw03/blob/main/docs/flashing.md guide to improve the usability of this project.
I bought one of the GW03 hubs and came over to this repo from the HA community. However, it's really unclear what this does. A short description in the README of what it does and what to expect from it (and what not) would be great!