|
22 | 22 | import zigpy.config |
23 | 23 |
|
24 | 24 | import bellows.config as conf |
25 | | -from bellows.exception import EzspError, InvalidCommandError |
| 25 | +from bellows.exception import EzspError, InvalidCommandError, InvalidCommandPayload |
26 | 26 | from bellows.ezsp import xncp |
27 | 27 | from bellows.ezsp.config import DEFAULT_CONFIG, RuntimeConfig, ValueConfig |
28 | 28 | from bellows.ezsp.xncp import FirmwareFeatures, FlowControlType |
@@ -736,7 +736,9 @@ async def send_xncp_frame( |
736 | 736 | try: |
737 | 737 | rsp_frame = xncp.XncpCommand.from_bytes(data) |
738 | 738 | except ValueError: |
739 | | - raise InvalidCommandError(f"Invalid XNCP response: {data!r}") |
| 739 | + raise InvalidCommandPayload( |
| 740 | + f"Invalid XNCP response: {data!r}", raw_bytes=data |
| 741 | + ) |
740 | 742 |
|
741 | 743 | if isinstance(rsp_frame.payload, xncp.Unknown): |
742 | 744 | raise InvalidCommandError(f"XNCP firmware does not support {payload}") |
@@ -781,7 +783,15 @@ async def xncp_get_flow_control_type(self) -> FlowControlType: |
781 | 783 |
|
782 | 784 | async def xncp_get_chip_info(self) -> xncp.GetChipInfoRsp: |
783 | 785 | """Get the part number.""" |
784 | | - return await self.send_xncp_frame(xncp.GetChipInfoReq()) |
| 786 | + |
| 787 | + try: |
| 788 | + return await self.send_xncp_frame(xncp.GetChipInfoReq()) |
| 789 | + except InvalidCommandPayload: |
| 790 | + # Beta firmwares had a bug with this command |
| 791 | + return xncp.GetChipInfoRsp( |
| 792 | + ram_size=262144, |
| 793 | + part_number="EFR32MG24A420F1536IM40", |
| 794 | + ) |
785 | 795 |
|
786 | 796 | async def get_default_adapter_concurrency(self) -> int: |
787 | 797 | """Get the recommended concurrency based on chip information.""" |
|
0 commit comments