Koenkk / Z-Stack-firmware

Compilation instructions and hex files for Z-Stack firmwares
MIT License
2.39k stars 650 forks source link

Z-Stack router firmware for CC2652P/CC1352 that support control of RF transmit power output dBm level remotely #341

Closed Hedda closed 2 years ago

Hedda commented 2 years ago

Feature request for a Z-Stack router firmware for CC2652P/CC1352P that can support controlling of RF transmit power output dBm levels remotely.

If router firmware supported that feature then could somehow expose the power output configuration attributes in applications like Zigbee2MQTT and ioBroker, etc. when the CC2652P and CC1352 based device is joined to Zigbee network and there allow the user to set the power output in dBm on those routers without reflashing, (maybe by presenting the transmission power output option on the Z-Stack router as via switches or dimmer?).

I guess that future router firmware for CC2652P/CC1352P will be set to +9 dBm by default to stay compliant with international regulations, and having a feature like this would allow users to bump applications up to +20 dBm without having to maintain a separate firmware. Better yet could allow users to change and exactly tweak RF transmit power output dBm level settings for each individual CC2652P/CC1352P based router to achieve optimally range and coverage.

If 20 steps of TX power output levels is too many then suggest offering these five (5) dBm settings levels; 5, 9, 14, 19, and 20.

PS: Worth knowing difference between dB and dBm https://www.wilsonpro.com/blog/whats-the-difference-between-db-and-dbm

ruimarinho commented 2 years ago

For reference, some experimental firmware versions have been posted on https://github.com/Koenkk/Z-Stack-firmware/issues/273. The difference between the stable firmware and the one provided by @bkupidura (with +20dBm) is staggering: from LQI 7 to 80 in exactly the same spot.

Hedda commented 2 years ago

For reference, some experimental firmware versions have been posted on #273.

Should be noted that the router firmware in #273 is not configurable to differed TX power output levels, it is instead hardcoded into the firmware image to always use +20dBm TX power output amplification and can not be changed without flashing a other firmware image with a different configuration, which again is might be too strong/high for some scenarios and as such not always optimal for all individual users situations.

The initial request from the original post above remains as it would be great to have a Zigbee router firmware for CC2652P/CC1352P where the TX power output could be reconfigured remotely.

wolph commented 2 years ago

As a simpler solution for now, a normal / low power build and a high power build would already make a lot of difference.

digiblur commented 2 years ago

I'd definitely drop some decent donations to @Koenkk to make a CC2652 router firmware that had a Z2M converter with a slider of output power, restart button (probably needed to change power?), and LED state (on/off/status) picker. Game changer indeed.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

wolph commented 2 years ago

@Koenkk would you accept a pull request with an extra high-power build in addition to the regular ones?

Koenkk commented 2 years ago

would you accept a pull request with an extra high-power build in addition to the regular ones?

No, this creates extra maintenance overhead for me. Instead this should be done by adding a manufacturer specific attribute on the genBasic cluster, from there it can be controlled from z2m by sending a write command.

wojciechczyz commented 2 years ago

I can see there is already coordinator with 5.40 SDK in development branch, is there a plan for a router with 5.40? Thank you

Hedda commented 2 years ago

I can see there is already coordinator with 5.40 SDK in development branch, is there a plan for a router with 5.40? Thank you

Please start a new issue for that version request as that is off-topic for this specific subject or at least not directly related to topic.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

wolph commented 2 years ago

This if very much still relevant. Bumping

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

Hedda commented 2 years ago

Still a relevant request I think, if even technically possible?

ptvoinfo commented 2 years ago

@Hedda Maybe, this is off-topic. I've implemented this feature in the premium version https://ptvo.info/zigbee-configurable-firmware-features/rf-signal-level-control/

Hedda commented 2 years ago

Maybe, this is off-topic. I've implemented this feature in the premium version

https://ptvo.info/zigbee-configurable-firmware-features/rf-signal-level-control/

Nice to know that it can technically be done at least. I guess chances are low that you code a patch and do a PR for it to this repo?

https://github.com/Koenkk/Z-Stack-firmware/blob/master/router/Z-Stack_3.x.0/firmware.patch

ptvoinfo commented 2 years ago

I guess chances are low that you code a patch and do a PR for it to this repo?

My changes are incompatible with this repo.

Hedda commented 2 years ago

@ptvoinfo off-topic but if Z2M needs a converter then maybe you need to create a "quirk" for ZHA Device Handlers for that too(?) -> https://www.home-assistant.io/integrations/zha#zha-exception-and-deviation-handling -> https://github.com/zigpy/zha-device-handlers/blob/dev/README.md and might also need ZHA code as well to expose config in its UI(?) -> https://github.com/zigpy/zigpy/discussions/934

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

wolph commented 2 years ago

This would still be very useful. Bump

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

wolph commented 2 years ago

still very much needed

jairbj commented 2 years ago

+1

kulkaa commented 2 years ago

+1

isabido commented 2 years ago

HI friends, I am looking for a reliable router to expand the range of my SONOFF Zigbee 3.0 USB Dongle.

In view of the problems many sonoff devices such as the zbmini and s26 sockets are having, I have no idea which way to go.

Will it be the most reliable Philips HUE plugs as routers? https://www.zigbee2mqtt.io/devices/929002240401.html

Or maybe other SONOFF Zigbee 3.0 USB Dongle in router mode?

Thanks in advance!

Hedda commented 2 years ago

@isabido your question is off-topic here as not related to original topic, please post that in Zigbee2MQTT discussions instead -> https://github.com/Koenkk/zigbee2mqtt/discussions

isabido commented 2 years ago

Sorry Hedda! thanks for the recommendation.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

Hedda commented 2 years ago

Please do not stale.

cameronjust commented 2 years ago

Is there much progress on this?

I had some minor issues with my Conbee II in the past and the general consensus in zigbee2mqtt forums was to use a "SONOFF ZigBee 3.0 USB Dongle Plus" with the CC2652P chipset.

So just today I got around to re-pairing all my devices and I was quite amazed that anything connecting to the Sonoff coordinator directly had an abysmal LQI <38 even when in the same room.

https://imgur.com/VbgcRXq

That "rumpus_temp" device is 4meters line of sight with nothing in between and it's only getting 35 LQI. The USB stick is on a USB extender cable so there shouldn't be any interference. I've chosen a zigbee channel that is in the quietest area with the least interference from wifi so that can't be it.

Whereas any device connecting via a router (Philips Hue bulbs and Ikea power points) had quality LQI > 200 even through walls.

After seeing this led me to this thread. How are people even using (and reccomending) these devices if they get such poor connectivity to devices in the same room?

I can see earlier in this thread an updated firmware with higher power settings baked in. However that was from March 2021. There has been a new "official" firmware released in Feb 2022 so it would be kind of going backwards.

I'll stay with the Sonoff for now but if I get dropouts I'll probably give up and go back to the Conbee II which had very strong connections to devices directly connected.

Edit: So at the risk of having to get a 3rd coordinator. Is there anything better than a Conbee II or Sonoff Zigbee Dongle Plus that works reliably with Zigbee2MQTT?

Hedda commented 2 years ago

@cameronjust Please understand that this specific feature request is only about "Zigbee Router" firmware for CC2652P/CC1352P.

https://github.com/Koenkk/Z-Stack-firmware/tree/master/router

Respect that specific discussion in https://github.com/Koenkk/Z-Stack-firmware/issues/341 has as such not anything at all to with using CC2652P/CC1352P as a Zigbee Coordinator.

https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator

PS: Off-topic; Zigbee2MQTT can already configure "transmit_power" for CC2652P/CC1352P with Zigbee Coordinator firmware, see:

https://www.zigbee2mqtt.io/guide/configuration/adapter-settings.html

Please move any another type of unrelated discussions such as recommendations for adapters, etc. to Zigbee2MQTT repo instead:

https://github.com/Koenkk/zigbee2mqtt/discussions/8840

https://github.com/Koenkk/zigbee2mqtt/discussions

https://github.com/Koenkk/zigbee2mqtt/issues

PPS: Off-topic; if you are already following best practies to avoid interference (like using a long USB extension cable, and connecting to USB 2.0 port or hub and not to a 3.0 port + keeping it away from all USB 3.0 devices) then it sounds as if you might have received a faulty adapter (or faulty antenna or glitchy antenna connector) so if I was you I would just try contacting ITead/Sonoff and ask about getting a replacement adapter, because most people including myself have had a great experience with Itead's "SONOFF ZigBee 3.0 USB Dongle Plus" with the CC2652P chip when following best practices and using later firmware, read -> https://github.com/Koenkk/zigbee2mqtt/discussions/8840 ...regardless, this issue is not the place to highjack in order to discuss such off-topic matters.

image

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

Hedda commented 2 years ago

This feature is still wanted.

Smandurlo commented 2 years ago

UP :-)

Koenkk commented 2 years ago

This is now supported by the Z-Stack_3.x.0 router 20221102 https://github.com/Koenkk/Z-Stack-firmware/tree/develop/router/Z-Stack_3.x.0/bin . This will be supported in the zigbee2mqtt dev branch later today.

wolph commented 2 years ago

Fantastisch @Koenkk, dankjewel!

Koenkk commented 2 years ago

@wolph graag gedaan πŸ˜„

shaggee commented 2 years ago

This is now supported by the Z-Stack_3.x.0 router 20221102 https://github.com/Koenkk/Z-Stack-firmware/tree/develop/router/Z-Stack_3.x.0/bin . This will be supported in the zigbee2mqtt dev branch later today.

Will it work also with the coordinator firmware?

Koenkk commented 1 year ago

@shaggee that is supported for a long time already via the transmit_power option: https://www.zigbee2mqtt.io/guide/configuration/adapter-settings.html

Smandurlo commented 1 year ago

but, how to use it for the router? We need to replace the firmware (is stable or dev) for the router and move to the dev branch? Where will we find the option to increase the dB?

Hedda commented 1 year ago

but, how to use it for the router? We need to replace the firmware (is stable or dev) for the router and move to the dev branch? Where will we find the option to increase the dB?

You first need to flash your CC2652/CC1352 based Zigbee Router device with the Koenkk's Z-Stack 3.x.0 router firmware version 20221102 or later (currently in the develop branch so still in development / pre-release testing phase) -> https://github.com/Koenkk/Z-Stack-firmware/tree/develop/router/Z-Stack_3.x.0/bin

You will then need to use the very latest dev branch of zigbee2mqtt from today (e.i. cutting edge / development version) as only that dev branch got the converter and (it just got it less than 24-hours ago) -> https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html#linux

Lastly, you need to configure the device parameters by setting the wanted dB as Zigbee attribute for transmit_power in BasicCluster for the device in order to increase or lower.

(The feature will not be available in Z2M master until it gets bumped zigbee-herdsman-converters v14.0.669 as a dependency).

For reference:

zigbee-herdsman converter was committed to the master branch of zigbee-herdsman-converters on the 2nd of November 2022 -> https://github.com/Koenkk/zigbee-herdsman-converters/commit/8fb1ba4c232e451af1e9953b8c476c2f4b2ef561 and that means that the needed converter should be available in zigbee-herdsman-converters v14.0.669 -> https://github.com/Koenkk/zigbee-herdsman-converters/releases/tag/v14.0.669

zigbee-herdsman-converters v14.0.669 was bumped in Z2M yesterday https://github.com/Koenkk/zigbee2mqtt/commits/dev

PS: TheJulianJES wrote step-by-step instructions for how to change router transmit power specifically in Home Assistant's ZHA integration (if supported in Zigbee Router device firmware) but it should be similar in Zigbee2MQTT -> https://github.com/zigpy/zha-device-handlers/pull/1886

Hedda commented 1 year ago

Maybe, this is off-topic. I've implemented this feature in the premium version https://ptvo.info/zigbee-configurable-firmware-features/rf-signal-level-control/

@ptvoinfo Can you extend the converter for custom_devices_diy.js to expose transmit_power option for your devices too? See:

https://github.com/Koenkk/zigbee-herdsman-converters/commit/8fb1ba4c232e451af1e9953b8c476c2f4b2ef561

ptvoinfo commented 1 year ago

@Hedda In my case, this is configurable feature and may absent in many devices. Therefore, you can create a custom converter for your device and the corresponding option will appear in HA automatically.

Smandurlo commented 1 year ago

Thanks @Hedda , then I will wait for the stable releases for both firmware and z2m

877dev commented 1 year ago

This change made the z2m stable release this month. Are there instructions for setting the transmit power? Can it be done dynamically via a MQTT message or does it need to go in configuration.yaml and restart z2m each time? Thanks for any info!

Shamshala commented 1 year ago

@877dev Last time I've checked it was already implemented in 1.28.4-1 (the latest stable release). Just check the device's Exposes section and there is the transmit_power slider.

877dev commented 1 year ago

@Shamshala i don’t use HA, I wonder if there is a similar option in Z2M frontend interface. But it sounds like it can be altered dynamically which is great πŸ‘

Shamshala commented 1 year ago

@877dev Exposes is within the z2m frontend πŸ˜‰

Smandurlo commented 1 year ago

Is the firmware still in develop branch? I am not able to flash it with Flash Programmer 2. I don't know what the problem is because I am able to write the master release without a problem.

Il giorno sab 3 dic 2022 alle ore 09:52 Shamshala @.***> ha scritto:

@877dev https://github.com/877dev Exposes is within the z2m frontend πŸ˜‰

β€” Reply to this email directly, view it on GitHub https://github.com/Koenkk/Z-Stack-firmware/issues/341#issuecomment-1336116679, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIXTCZOP3PAGVEVQFFKNF5DWLMC6RANCNFSM5KNBMM2Q . You are receiving this because you commented.Message ID: @.***>

877dev commented 1 year ago

You cannot use Flash Programmer 2. Here is how I flashed mine recently, I wrote a little guide.:

https://pastebin.com/i8akGRCy

Smandurlo commented 1 year ago

with bsl-master I was able to flash the develop router firmware. WTH of a difference!!! From 2-3 lqi at default (I made it on purpose), to 54 lqi with +20 dBm !!!