zigpy / bellows

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

Allow disabling the bellows UART thread #507

Closed puddly closed 1 year ago

puddly commented 1 year ago

Not all environments support or need threading, namely https://pyscript.net/ and command line applications:

zha:
  zigpy_config:
    use_thread: false

Once some hard-to-reproduce, low-level bugs are ironed out of the bellows asyncio thread, I think it would be beneficial to move it into zigpy.

codecov-commenter commented 1 year ago

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage :thumbsup:

Coverage data is based on head (899218a) compared to base (3340e12). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #507 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 47 47 Lines 3291 3292 +1 ========================================= + Hits 3291 3292 +1 ``` | [Impacted Files](https://codecov.io/gh/zigpy/bellows/pull/507?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy) | Coverage Δ | | |---|---|---| | [bellows/config/\_\_init\_\_.py](https://codecov.io/gh/zigpy/bellows/pull/507/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy#diff-YmVsbG93cy9jb25maWcvX19pbml0X18ucHk=) | `100.00% <100.00%> (ø)` | | | [bellows/ezsp/\_\_init\_\_.py](https://codecov.io/gh/zigpy/bellows/pull/507/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy#diff-YmVsbG93cy9lenNwL19faW5pdF9fLnB5) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

pipiche38 commented 1 year ago

What do you recommend ? I see that the default is to use the thread. In fact what is the benefit to use it ?

puddly commented 1 year ago

In fact what is the benefit to use it ?

There's no reason not to use it. If your event loop is busy or has stuttering, it will break EZSP communication with the radio. The only reason I'm adding this option is to allow bellows to be used in environments where threading is not implemented.