Skip to content

Commit 1d93d24

Browse files
authored
Merge pull request #153 from mdeweerd/dev
Adjust for 2023.3 - zigpy radio package version
2 parents 02030f5 + a1f8994 commit 1d93d24

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

.github/workflows/stats.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ jobs:
1616
ref: ${{ steps.extract_branch.outputs.branch }}
1717
fetch-depth: 0
1818
- run: ${{ github.workspace }}/.github/scripts/gen_stats.sh
19-
- uses: stefanzweifel/git-auto-commit-action@v4
19+
- name: Commit updated resources
20+
uses: test-room-7/action-update-file@v1
2021
with:
21-
commit_message: '[Bot] stats - Update STATS.md'
22+
file-path: STATS.md
23+
commit-msg: '[Bot] stats - Update STATS.md'
24+
github-token: ${{ secrets.GITHUB_TOKEN }}
25+
# - uses: stefanzweifel/git-auto-commit-action@v4
26+
# with:
27+
# commit_message: '[Bot] stats - Update STATS.md'
2228
# commit_user_name: stats
2329
# commit_user_email: stats@nill
2430
# commit_author: STATS BOT <stats>

custom_components/zha_toolkit/utils.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,28 +186,55 @@ def get_radio(app):
186186

187187

188188
def get_radio_version(app):
189+
# pylint: disable=R0911
189190
if hasattr(app, "_znp"):
190191
import zigpy_znp
191192

192-
return zigpy_znp.__version__
193+
if hasattr(zigpy_znp, "__version__"):
194+
return zigpy_znp.__version__
195+
196+
import pkg_resources
197+
198+
return pkg_resources.get_distribution("zigpy_znp").version
193199
if hasattr(app, "_ezsp"):
194200
import bellows
195201

196-
return bellows.__version__
202+
if hasattr(bellows, "__version__"):
203+
return bellows.__version__
204+
205+
import pkg_resources
206+
207+
return pkg_resources.get_distribution("bellows").version
197208
if hasattr(app, "_api"):
198209
rt = get_radiotype(app)
199210
if rt == RadioType.DECONZ:
200211
import zigpy_deconz
201212

202-
return zigpy_deconz.__version__
213+
if hasattr(zigpy_deconz, "__version__"):
214+
return zigpy_deconz.__version__
215+
216+
import pkg_resources
217+
218+
return pkg_resources.get_distribution("zigpy_deconz").version
203219
if rt == RadioType.ZIGATE:
204220
import zigpy_zigate
205221

206-
return zigpy_zigate.__version__
222+
if hasattr(zigpy_zigate, "__version__"):
223+
return zigpy_zigate.__version__
224+
225+
import pkg_resources
226+
227+
return pkg_resources.get_distribution("zigpy_zigate").version
207228
if rt == RadioType.XBEE:
208229
import zigpy_xbee
209230

210-
return zigpy_xbee.__version__
231+
if hasattr(zigpy_xbee, "__version__"):
232+
return zigpy_xbee.__version__
233+
234+
import pkg_resources
235+
236+
return pkg_resources.get_distribution("zigpy_xbee").version
237+
211238
# if rt == RadioType.ZIGPY_CC:
212239
# import zigpy_cc
213240
# return zigpy_cc.__version__
@@ -649,7 +676,7 @@ def extractParams( # noqa: C901
649676
if P.ENDPOINT in rawParams:
650677
params[p.EP_ID] = str2int(rawParams[P.ENDPOINT])
651678

652-
# Destination endpoint to send command to
679+
# Destination endpoint (e.g., target of data/cmds in bind_ieee)
653680
if P.DST_ENDPOINT in rawParams:
654681
params[p.DST_EP_ID] = str2int(rawParams[P.DST_ENDPOINT])
655682

0 commit comments

Comments
 (0)