zigpy / bellows

A Python 3 project to implement EZSP for EmberZNet devices
GNU General Public License v3.0
177 stars 85 forks source link

Low Transmission Power #446

Open alelucc opened 2 years ago

alelucc commented 2 years ago

Hi, I'm using an Eachen (eWelink) Zigbee Bridge Pro ZB-GW03 with syssi EspHome firmware https://github.com/syssi/esphome-zb-gw03 within Home Assistant using the native ZHA integration. It's working great but looking into HA logs i noticed that the radio module was set with a very low Tx power (8). 2022-01-23 15:49:36 INFO (MainThread) [bellows.zigbee.application] Node type: EmberNodeType.COORDINATOR, Network parameters: EmberNetworkParameters(extendedPanId=3c:08:6f:60:fe:2a:94:60, panId=0x3f21, radioTxPower=8, radioChannel=25, joinMethod=<EmberJoinMethod.USE_MAC_ASSOCIATION: 0>, nwkManagerId=0x0000, nwkUpdateId=0, channels=<Channels.ALL_CHANNELS: 134215680>).

In some HA discussion i saw that some users having the same parameter set to 20. 2021-01-25 09:04:00 INFO (MainThread) [bellows.zigbee.application] Node type: EmberNodeType.COORDINATOR, Network parameters: EmberNetworkParameters(extendedPanId=cc:cc:cc:cc:e3:ab:00:78, panId=0x3498, radioTxPower=20, radioChannel=11, joinMethod=<EmberJoinMethod.USE_MAC_ASSOCIATION: 0>, nwkManagerId=0x0000, nwkUpdateId=0, channels=<Channels.ALL_CHANNELS: 134215680>) https://community.home-assistant.io/t/zha-zigbee-change-channel/70396/63

Looking trough code i see that TxPower is hard coded with the 8 value. Is it the maximum value? If not, it would be great if that was possible to configure trough HA like the CONF_NWK_CHANNEL

zha: zigpy_config: network: channel: 15 # What channel the radio should try to use. channels: [15, 20, 25] # Channel mask

Hedda commented 2 years ago

Do not know for ezsp (bellows) but for znp (zigpy-znp) it uses firmware default unless set tx_power via ZHA YAML configuration:

https://github.com/zigpy/zigpy-znp/blob/dev/README.md#configuration

zha:
  zigpy_config:
    znp_config:
      # "auto" picks the largest value that keeps the device's transmit buffer from getting full
      max_concurrent_requests: auto

      # Only if your stick has a built-in power amplifier (i.e. CC1352P and CC2592)
      # If set, must be between:
      #  * CC1352/2652:  -22 and 19
      #  * CC253x:       -22 and 22
      tx_power:  

So if same command is available for ezsp in ZHA and in the bellow library then ZHA YAML configuration should be something like:

https://www.home-assistant.io/integrations/zha#configuration---yaml

zha:
  zigpy_config:
    ezsp_config:
      tx_power: 20

The default in firmware will probably be set to around +10 dBm or less than that FCC and CE certification regulation does not allow higher power unless they also hardcode firmware so cannot use top end of 802.15.4 channel band (i.e. Zigbee channel 24 to 26).

https://community.silabs.com/s/article/tips-for-fcc-certification-on-silicon-labs-2-4ghz-802-15-4-based-solutions?language=en_US

"Band Edge Concerns: The top end of the 802.15.4 channel band (Channel 26 and occasionally Channels 24 an 25 at very high output powers) usually pushes up against the limits of the band, encroaching into the reserved area in the adjacent (higher) frequencies. Therefore, it's often necessary to artificially limit (with software) output power on these upper channels (as much as -9 or -10 dBm) in order to pass FCC TX testing."

Silicon Labs EFR32MG21 hardware does, however, support up to 20 dBm TX power but user need to set it themself if not default:

https://www.silabs.com/wireless/zigbee/efr32mg21-series-2-socs

Note! Commerical firmware plays it safe as legally you can use up 20 dBm transmission output power as long as not using the top end of the 802.15.4 channel band, (i.e. Zigbee channel 26 and occasionally Zigbee channels 24 an 25 at very high output powers).

syssi commented 2 years ago

@Hedda At ezsp (bellows) the tx_power is hardcoded at the moment: https://github.com/zigpy/bellows/blob/dev/bellows/zigbee/application.py#L233

overas commented 7 months ago

I think Home Assistant SkyConnect also uses firmware default for tx_power. I tried to replace my ZigStar Stick v4 (with TI CC2652P) coordinator with SkyConnect, but with the low tx_power the batterypowered devices was troublesome to pair with ZHA. I also had lots of "EmberStatus.DELIVERY_FAILED: 102" messages in the log and lights which did not shut off or on.

I use these setting for replacing TI CC2652P firmware default to 20 dB:

zha:
  zigpy_config:
    znp_config:
      tx_power: 20
MattWestb commented 7 months ago

Its more reason way Silabs is recommending not using max power on the radio chip and the first is you is getting one asymmetrical radio link (can seeding but is not hearing the receiver) that is most critical for sleeping end device and the second is the stability of the radio is not being good and can getting more interference in the receiver.

And you is not understanding how one mesh network is working with its self healing proprieties that is not working then "tuning" the radio like this. Most normal Zigbee routers is using 9-16 dB radio power and you shall always having one good router near one end device so its can communicating good (they is using around 1/10 of radio power as routers is doing) and doing so the network is working great if having good Zigbee devices.

And you is very likely having problems with radio interference from other systems that is making your !102! errors.

overas commented 7 months ago

Thank you @MattWestb for your feedback. I now I have radio interference from the usb3 interface on my Intel nuc. I think I lowered the interference using a usb2 hub and a longer cable between the usb3 and the SkyConnect. I have also a lot of Ikea signalrepeter and other zigbee routers, but I think I should place them nearer the coordinator. The problem is that I do not have power plugs so near ...

MattWestb commented 7 months ago

Look on the network map you must have one good connection thru all routers and if you is having one week spot you need moving or adding more routers. Also its one mesh network so one longer way can being better then shorter one but normal 3 good links from the coordinator and then its the "second level".