Closed Shulyaka closed 9 months ago
The energy scanning API is expected to return a number between 0 and 255, with 0 being "low" and 255 being "high". This is to make values comparable across radios, since all others return a number 0-255.
In bellows, I implemented it like so: https://github.com/zigpy/bellows/blob/58f8a8079a6fa1d25fe536e5d9e3fcfcbf41389c/bellows/zigbee/util.py#L105-L132. RSSI_MIN
and RSSI_MAX
can be found above. I generated the test tones with bellows
as well: bellows --baudrate 115200 -d /dev/serial/by-id/... tone -c 15 -p 20
Thanks! Will update the code.
Fixed. Using the same formula for compatibility (i.e. compare values between radios)
2023-09-26 17:50:06.980 DEBUG (MainThread) [zigpy_xbee.api] at command: ED (4,)
2023-09-26 17:50:06.980 DEBUG (MainThread) [zigpy_xbee.api] Command at (b'ED', b'\x00\x00\x00\x00')
2023-09-26 17:50:06.980 DEBUG (MainThread) [zigpy_xbee.uart] Sending: b'\x08\x14ED\x00\x00\x00\x00'
2023-09-26 17:50:07.669 DEBUG (MainThread) [zigpy_xbee.uart] Frame received: b'\x88\x14ED\x00QRGI;\x1d@%JCFEKLKM'
2023-09-26 17:50:07.669 DEBUG (MainThread) [zigpy_xbee.api] Frame received: at_response
2023-09-26 17:50:07.673 DEBUG (MainThread) [zigpy.application] Startup energy scan: {11: 6.400294434546168, 12: 5.637317837053025, 13: 22.00997262297472, 14: 17.31295187283794, 15: 79.08378338907617, 16: 244.0129080387192, 17: 48.47002474921316, 18: 226.18609483339876, 19: 15.32929809960923, 20: 34.963161543474534, 21: 24.768782664129375, 22: 27.832084152058194, 23: 13.559957792182884, 24: 11.984626537983768, 25: 13.559957792182884, 26: 10.584286741584284}
Rebased and added tests
All modified lines are covered by tests :white_check_mark:
Comparison is base (
f387a0f
) 98.86% compared to head (6b08af3
) 99.13%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Add support for per-channel energy detect for XBee coordinators.
Logs:
Prtially implements #112 though it is not a stand-alone tool.