XBee serial communication

This may be of interest as another approach to manage relays.

My relays are controlled via i2c, but I presume you could make some changes to communicate via serial port from micropython on xbee3. I used Grove 4 / 8 channel SPDT relay via i2c

I wanted to use standard zigbee onoff endpoints to control relay. The latest version of xbee3 firmware (100A) now supports pass through of zdo to micropython. I use micropython to change the ZDO responses for Active_EP_req and Simple_Desc_rsp at the time that the xbee3 joins the HASS network. It sends a simple descriptor for each endpoint, indicating a simple OnOff (cluster id 0x06). Once set up, it:

  • responds to on and off commands at the relevant endpoints by activating my relays over i2c
  • responds to attribute requests to send current on/off status to HASS.
  • it publishes reporting messages to act as a heartbeat and refresh current on/off status’s to HASS

I use the micropython which is supported on xbee3 to do this. I guess it could also be done with arduino or similar.

I have published the code I used for this at (https://github.com/petertrain/xbee3-i2c-relay).

I have copied and ported a fair amount of code for handling the zigbee communications from zibpy. I ran into two issues:

  • I ran out of memory on the xbee3
  • some of the standard python libraries used by zigpy aren’t supported on micropython (notably lib/enum).
    As a result, I have butchered the zigpy code a fair amount to get it working. At times, I hardcoded encoded values instead of providing meaningful types. I might go back and try to clean some of that up.

The nice thing about this solution is that you don’t require use of quirks or any configuration in HASS to get it working. I just join the xbee3 with appropriate micropython module to the network and HASS is immediately configured to control the relevant relays.

1 Like

Hello i need help,
i can´t detect in ZHA another xbee router…
I have a xbee s2c coordinator connected to ZHA. It works perfect with any zigbee product. But i cant connect other xbee for controling it´s IO pins.
If I scan devices in XCTU with router, i see the coordinator. But in adding router to ZHA was impossible.
I tried commmissioning button, and configure router with params:
CE=0
ZS=2
EE=1
EO=2
NK=0
KY=5a6967426565416c6c69616e63653039

I also tried using xbee ha platform, adding a light with router address like described here: ha xbee

Nothing worked…
Thanks!

Nothing worked…

Hi!

I only noticed your post now.

You are doing it correct. Once you configured these parameters, the module should start searching for the network. Go to Configuration → Integrations → ZHA > “Add device” to allow joining, then check XCTU again, at the very bottom you will see the section for Diagnostic commands. Refresh the AI parameter a few times and tell us which values it returns.
Sometimes it helps moving physically closer to the coordinator, or changing ZS to 0 and then back to 2 to trigger joining.

Hi Denis, Thank you for sharing details of your project here in HA. I’m new to HA and been to digi xbee forum but there are no examples for end device. Your configuration made my xbee detectable to the configurator!

Anyways my goal is to make an end device with power meter and relay switch to be controlled and displayed on HA. Upon trying the configurations on xbee, this controls (15), 2 analog outputs and 1 sensor binary input showed up. This board is just pre flashed with the latest xbee firmware and no micropython yet. I wonder where did those config files came from. I tried exploring XCTU but I cant see anything GPIO config related as far as I understand. And if you can point me to more resource in creating endpoint with xbee that would be great! TIA

Hi!

Probably the best source of information for now is this: zha-device-handlers/xbee.md at 4956114628a2aee435776c5e286a8e97d4f3df53 ¡ zigpy/zha-device-handlers ¡ GitHub
To put it simply, the on-off switches control digital output of XBee (or show you a digital input if configured so with XCTU). You will also have PWM as a number entity and analog input as sensors.
Now you need to connect your relays to the respective lines of XBee and that’s probably it. If you need a more complicated logic, you can use template sensor or template switch.

Thanks for the fast response! And great details on link! I appreciate it.

Hi,
I’m hoping that someone is still looking at this thread and can help me out here.

I have a Sonoff Zigbee USB device attached to Home Assistant and ZHA. I bought an XBee 2 and I’ve set it up with XCTU to attach it to ZHA and it was recognised as an XBee 3. I’m assuming that this isn’t a problem as it joined the network and comes up in Home Assistant.

I’ve started experimenting with the UART.
I’ve attached the XBee Tx/Rx to an ESP32 (via a level shifter) and I’ve been using Arduino to write code for the ESP32. I’m using the xbee Arduino library with XBeeWithCallbacks.
When I call the HA Service zha.issue_zigbee_cluster_command the data appears at my ESP32 so I know the path works. This is what I’m using:

service: zha.issue_zigbee_cluster_command
data:
  endpoint_id: 232
  cluster_id: 17
  cluster_type: in
  command: 0
  command_type: server
  args: Hello World
  ieee: 00:13:A2:00:41:F2:A5:19

And this is the display from my Arduino code

14:34:40.931 -> ER => RemAddr=   0 Src=1 Dst=E8 Clus=  11 Prof=260 Opt=0  Offset=17
14:34:40.931 ->  Length = 11   Data = 48 65 6C 6C 6F 20 57 6F 72 6C 64

ER means ZBExplicitRxResponse in xbee.h
As you can see the data is “Hello World”

The problem I have is sending data from the ESP32.

I’ve used the developer tools in HA to listen to ‘zha_event’ but nothing happens (I do not have any other Zigbee devices).

This link says that incoming UART data will generate this Event in HA but I’ve tried all combinations of the various data structures from xbee.h on the Arduino.

This is my Arduino loop

#define BIGNUM 100000
void loop() {
  xbee.loop();
  if (ctr++ % BIGNUM == 0) {
    // Create an array for holding the data you want to send.
    uint8_t payload[] = { 'H', 'i' };

    // Specify the address of the remote XBee (this is the SH + SL)
    XBeeAddress64 addr64 = XBeeAddress64(0x00124B00, 0x26B72A67);
    //XBeeAddress64 addr64 = XBeeAddress64(0x0, 0x0);
    //XBeeAddress64 addr64 = XBeeAddress64(0x0, 0x7FFF);

    // Create a TX Request
    ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));

    zbTx.setFrameId((ctr / BIGNUM) % 256);

    // Send your request
    xbee.send(zbTx);
  }
}

When the above does the send I get an ZBTxStatusResponse callback with isSuccess set TRUE so I assume it works.
I’ve tried ZBTxRequest and ZBExplicitTxRequest. I also tried the series 1 versions: Tx16Request and Tx64Request.

I also have a packet sniffer setup and I can see a flurry of packets at the appropriate times but I have no idea whats going on. The data content looks nothing like the data I’m sending.

Can anyone help please. What code in the Arduino using xbee.h should I be using, anyone have examples of this setup working.

One more thing, I’m not sure if this is relevant but I have the logger set up in HA. When the Arduino sends I get this in the HA log file:

2022-10-29 14:50:52.818 DEBUG (MainThread) [zigpy_znp.api] Received command: ZDO.SrcRtgInd.Callback(DstAddr=0x293C, Relays=[])

Hi Dave,

If you have the sniffer, what are the source and destination endpoint ID do you see in the packets, are they 0xE8?

Hi and thanks,
I’ve screen grabbed an image of the sniffer, at each time the Arduino code does a send these 6 messages are captured. The “APS Dest Point” increments by 1. The “APS Src Endpoint” is always 0x67. Note that I have a filter set in the sniffer for the Dest Address to be 0x0.


Thanks again.
EDIT: I’ve also unselected the “Nwk Payload” and “Aps Payload” so they are not shown.

EDIT2:
I screen grabbed the data when I call the Home Assistant service

This is weird as the “APS Src Endpoint” shows 0x67 but when I receive the data my arduino displays it as 1 and the “APS Dest Point” as 0xE8 (232 decimal).
22:55:27.716 → ER => RemAddr= 0 Src=1 Dst=E8 Clus= 11 Prof=260 Opt=0 Offset=17
22:55:27.716 → Length = 11 Data = 48 65 6C 6C 6F 20 57 6F 72 6C 64

This is the code used to generate the above screen info so you can see what is hex and what is decimal.

  Serial.printf("ER => RemAddr=%4X Src=%X Dst=%X Clus=%4X Prof=%d Opt=%d  Offset=%d\n",
                (int)rxe.getRemoteAddress16(), (int)rxe.getSrcEndpoint(), (int)rxe.getDstEndpoint(), (int)rxe.getClusterId(), (int)rxe.getProfileId(), (int)rxe.getOption(), (int)rxe.getDataOffset());
  dumpBuffer(rxe.getData(), rxe.getDataLength());

EDIT3: Could it be that the data is encrypted and we can’t believe anything we see in the packet sniffer?

I think you need to configure zigpy to listen to the appropriate endpoint.

See Add additional endpoint configuration option by prairiesnpr ¡ Pull Request #1048 ¡ zigpy/zigpy ¡ GitHub

1 Like

Hi and thanks for the help

This is my Home Assistant configuration.yaml

zha:
  zigpy_config:
    network:
      channel: 11             # What channel the radio should try to use.
      channels: [11, 15, 20, 25]  # Channel mask
    additional_endpoints:
      - endpoint: 0xE6
        profile: 0xC105
        device_type: 0x0000
        device_version: 0b0000
        input_clusters: []
        output_clusters: [0x21]
      - endpoint: 0xE8
        profile: 0xC105
        device_type: 0x0000
        device_version: 0b0000
        input_clusters: []
        output_clusters: [0x21]
      - endpoint: 0x67
        profile: 0xB72A
        device_type: 0x0000
        device_version: 0b0000
        input_clusters: []
        output_clusters: [0x21]

I now get this in the Home Assistant log file

2022-10-30 13:02:41.647 DEBUG (MainThread) [zigpy_znp.api] Received command: ZDO.SrcRtgInd.Callback(DstAddr=0xC4E0, Relays=[])
2022-10-30 13:02:41.708 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=17, SrcAddr=0xC4E0, SrcEndpoint=232, DstEndpoint=232, WasBroadcast=<Bool.false: 0>, LQI=75, SecurityUse=<Bool.false: 0>, TimeStamp=15703083, TSN=0, Data=b'\x48\x69', MacSrcAddr=0xC4E0, MsgResultRadius=29)
2022-10-30 13:02:41.709 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0xC4E0), src_ep=232, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=232, source_route=None, extended_timeout=False, tsn=0, profile_id=49413, cluster_id=17, data=Serialized[b'Hi'], tx_options=<TransmitOptions.NONE: 0>, radius=29, non_member_radius=0, lqi=75, rssi=None)
2022-10-30 13:02:41.709 DEBUG (MainThread) [zigpy.zcl] [0xC4E0:232:0x0011] Received ZCL frame: b'\x01m\x00Hi'
2022-10-30 13:02:41.710 DEBUG (MainThread) [zigpy.zcl] [0xC4E0:232:0x0011] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, direction=<Direction.Server_to_Client: 0>, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False, *is_reply=False), tsn=109, command_id=0, *direction=<Direction.Server_to_Client: 0>, *is_reply=False)
2022-10-30 13:02:41.710 DEBUG (MainThread) [zigpy.zcl] [0xC4E0:232:0x0011] Decoded ZCL frame: SerialDataCluster:schema(param1='Hi')
2022-10-30 13:02:41.710 DEBUG (MainThread) [zigpy.zcl] [0xC4E0:232:0x0011] Received command 0x00 (TSN 109): schema(param1='Hi')
2022-10-30 13:02:41.710 WARNING (MainThread) [zigpy.util] Error calling listener <bound method ZigbeeChannel.zha_send_event of <homeassistant.components.zha.core.channels.general.LevelControlClientChannel object at 0x7fcc73c528f0>> with args ('receive_data', 'Hi'): TypeError("Unexpected zha_send_event 'receive_data' argument: 'Hi'")
2022-10-30 13:02:41.712 DEBUG (MainThread) [zigpy.util] Error calling listener <bound method ZigbeeChannel.zha_send_event of <homeassistant.components.zha.core.channels.general.LevelControlClientChannel object at 0x7fcc73c528f0>> with args ('receive_data', 'Hi')
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/zigpy/util.py", line 55, in listener_event
    result.append(method(*args))
  File "/usr/src/homeassistant/homeassistant/components/zha/core/channels/base.py", line 405, in zha_send_event
    raise TypeError(f"Unexpected zha_send_event {command!r} argument: {arg!r}")
TypeError: Unexpected zha_send_event 'receive_data' argument: 'Hi'

This is progress as the string “Hi” is the payload that I send from the arduino through the XBee.
But I’m still doing it wrong as it gives a TypeError. When I send data from the Arduino, it should just be an array of data, the fact that I use ascii H and i should be irrelevant.
Any more help would be much appreciated thanks

This is definitely a progress!

I recognize the error you are having now, it was recently fixed in zha-device-handlers#1857 which has not yet been released.
Until the next update of zhaquirks, please manually replace the xbee quirk (probably in configuration_dir/deps/lib/python3.10/site-packages/zhaquirks/xbee/__init__.py) with the one from the dev repo: https://github.com/zigpy/zha-device-handlers/blob/41fd313de8af2fb6699d9cad3e66a382896e4a4d/zhaquirks/xbee/__init__.py

Hi, I grabbed the files from the update on github and tried creating a custom quirk but didn’t get it working, I didn’t spend too long on it though. I run HA in docker so I created a bash shell and did a find for the filename xbee_io.py. I found it so I copied the updates over the top, restarted HA and it works. I’m listening to events in HA and can see my data from the arduino.

Thanks very much for your help.

PS: Do you know which HA release will get this update?

I’m glad you got it working.
Probably not in 2022.11.0, but should be in 2022.11.X I think.

It’s all working so thanks very much. Just 1 last thing, when I receive serial data from the XBee I get this in the log file

2022-11-06 10:35:26.003 ERROR (MainThread) [zhaquirks.xbee] deserialize

Thanks

I’ve got no errors. Could you enable debug logs and post it here ± 1 second around this line?

I’ve got a part of the log file for you, it includes some of my debug output as well as I call the zha service and listen to the zha_event.

2022-11-06 18:56:50.722 DEBUG (SyncWorker_7) [custom_components.visonic.client] XBeeDataFeed Received HA Event in
2022-11-06 18:56:50.722 DEBUG (SyncWorker_7) [custom_components.visonic.client] XBeeDataFeed Received Source Test Passed
2022-11-06 18:56:50.722 DEBUG (SyncWorker_7) [custom_components.visonic.client] XBeeDataFeed Received this data {'data': 'D\x01\x04\r\x0fð\nèF'}
2022-11-06 18:56:50.722 DEBUG (SyncWorker_7) [custom_components.visonic.client] XBeeDataFeed Received Data in args
2022-11-06 18:56:50.722 DEBUG (SyncWorker_7) [custom_components.visonic.client] XBeeDataFeed Received Here 2 d=44 01 04 0d 0f f0 0a e8 46     the cs=232    calc cs=232    the len(d)=9
2022-11-06 18:56:50.723 DEBUG (SyncWorker_7) [custom_components.visonic.client] XBeeDataFeed Received Adding Received data to store, datastore=0d 0f f0 0a 
2022-11-06 18:56:50.723 DEBUG (SyncWorker_7) [custom_components.visonic.client] XBeeDataFeed Received HA Event out
2022-11-06 18:56:50.731 DEBUG (MainThread) [zigpy_znp.api] Received command: SYS.OSALNVReadExt.Rsp(Status=<Status.SUCCESS: 0>, Value=b'\x4D\x6D\xA6\x07\x2D\xC9\x59\x2C\xD6\x6C\x6E\xFE\x48\x55\x37\xA1')
2022-11-06 18:56:50.731 DEBUG (MainThread) [zigpy_znp.nvram] Read NVRAM["LEGACY"][0x0101] = 4d:6d:a6:07:2d:c9:59:2c:d6:6c:6e:fe:48:55:37:a1
2022-11-06 18:56:50.731 DEBUG (MainThread) [zigpy.backups] Adding a new backup NetworkBackup(backup_time=datetime.datetime(2022, 11, 6, 18, 56, 50, 731825, tzinfo=datetime.timezone.utc), network_info=NetworkInfo(extended_pan_id=1e:80:2a:db:38:32:22:35, pan_id=38313, nwk_update_id=0, nwk_manager_id=0x0000, channel=11, channel_mask=<Channels.CHANNEL_11: 2048>, security_level=5, network_key=Key(key=33:7c:01:0d:d7:25:45:7f:af:c0:e0:26:13:d5:16:07, tx_counter=430810, rx_counter=0, seq=0, partner_ieee=00:12:4b:00:26:b7:2a:67), tc_link_key=Key(key=5a:69:67:42:65:65:41:6c:6c:69:61:6e:63:65:30:39, tx_counter=0, rx_counter=0, seq=0, partner_ieee=00:12:4b:00:26:b7:2a:67), key_table=[], children=[], nwk_addresses={}, stack_specific={'zstack': {'tclk_seed': '4d6da6072dc9592cd66c6efe485537a1'}}, metadata={'zstack': {'TransportRev': 2, 'ProductId': 1, 'MajorRel': 2, 'MinorRel': 7, 'MaintRel': 1, 'CodeRevision': 20210708, 'BootloaderBuildType': <BootloaderBuildType.NON_BOOTLOADER_BUILD: 0>, 'BootloaderRevision': None}}, source='[email protected]'), node_info=NodeInfo(nwk=0x0000, ieee=00:12:4b:00:26:b7:2a:67, logical_type=<LogicalType.Coordinator: 0>))
2022-11-06 18:56:50.732 DEBUG (MainThread) [zigpy.backups] Waiting for 86400s before backing up again
2022-11-06 18:56:50.738 DEBUG (MainThread) [custom_components.visonic.client] XBeeDataFeed retrieving data=0d 0f f0 0a 
2022-11-06 18:56:50.739 WARNING (MainThread) [custom_components.visonic.pyvisonic] [handle_msgtype0F] LOOPBACK TEST SUCCESS, Counter is 1
2022-11-06 18:56:52.039 DEBUG (MainThread) [custom_components.visonic.client] XBeeDataFeed Writing data and its a <class 'bytes'>
2022-11-06 18:56:52.039 DEBUG (MainThread) [custom_components.visonic.client] XBeeDataFeed Writing data=44 01 04 0d 0b f4 0a e8 46   cant display op but len op=9
2022-11-06 18:56:52.040 DEBUG (MainThread) [custom_components.visonic.pyvisonic] [sendPdu] Sending Command (Stop)    raw data 0d 0b f4 0a    waiting for message response []
2022-11-06 18:56:52.040 DEBUG (MainThread) [custom_components.visonic.pyvisonic] [sendPdu]          Command has a wait time after transmission 1.5
2022-11-06 18:56:52.041 DEBUG (MainThread) [zigpy_znp.zigbee.application] Sending packet ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), src_ep=232, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0xEDED), dst_ep=232, source_route=None, extended_timeout=False, tsn=12, profile_id=49413, cluster_id=17, data=Serialized[b'D\x01\x04\r\x0b\xf4\n\xe8F'], tx_options=<TransmitOptions.NONE: 0>, radius=0, non_member_radius=0, lqi=None, rssi=None)
2022-11-06 18:56:52.041 DEBUG (MainThread) [zigpy_znp.api] Sending request: AF.DataRequestExt.Req(DstAddrModeAddress=AddrModeAddress(mode=<AddrMode.NWK: 2>, address=0xEDED), DstEndpoint=232, DstPanId=0x0000, SrcEndpoint=1, ClusterId=17, TSN=12, Options=<TransmitOptions.SUPPRESS_ROUTE_DISC_NETWORK: 32>, Radius=0, Data=b'\x44\x01\x04\x0D\x0B\xF4\x0A\xE8\x46')
2022-11-06 18:56:52.059 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.DataRequestExt.Rsp(Status=<Status.SUCCESS: 0>)
2022-11-06 18:56:52.064 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.DataConfirm.Callback(Status=<Status.SUCCESS: 0>, Endpoint=1, TSN=12)
2022-11-06 18:56:52.064 DEBUG (MainThread) [homeassistant.components.zha.core.device] [0xEDED](XBee3): Issued cluster command: cluster_id: 17 command: 0 command_type: server args: ('D\x01\x04\r\x0bô\nèF',) cluster_id: in manufacturer: None endpoint_id: 232
2022-11-06 18:56:52.065 DEBUG (MainThread) [homeassistant.components.zha.api] Issued command for: cluster_id: [17] cluster_type: [in] endpoint_id: [232] command: [0] command_type: [server] args: ['D\x01\x04\r\x0bô\nèF'] manufacturer: [None] response: Default_Response(command_id=0, status=<Status.SUCCESS: 0>)
2022-11-06 18:56:52.176 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=17, SrcAddr=0xEDED, SrcEndpoint=232, DstEndpoint=232, WasBroadcast=<Bool.false: 0>, LQI=78, SecurityUse=<Bool.false: 0>, TimeStamp=432366, TSN=0, Data=b'\x44\x01\x04\x0D\x0B\xF4\x0A\xE8\x46', MacSrcAddr=0xEDED, MsgResultRadius=29)
2022-11-06 18:56:52.176 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0xEDED), src_ep=232, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=232, source_route=None, extended_timeout=False, tsn=0, profile_id=49413, cluster_id=17, data=Serialized[b'D\x01\x04\r\x0b\xf4\n\xe8F'], tx_options=<TransmitOptions.NONE: 0>, radius=29, non_member_radius=0, lqi=78, rssi=None)
2022-11-06 18:56:52.177 ERROR (MainThread) [zhaquirks.xbee] deserialize
2022-11-06 18:56:52.178 DEBUG (MainThread) [zigpy.zcl] [0xEDED:232:0x0011] Received ZCL frame: b'\x01\r\x00D\x01\x04\r\x0b\xf4\n\xe8F'
2022-11-06 18:56:52.179 DEBUG (MainThread) [zigpy.zcl] [0xEDED:232:0x0011] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, direction=<Direction.Server_to_Client: 0>, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False, *is_reply=False), tsn=13, command_id=0, *direction=<Direction.Server_to_Client: 0>, *is_reply=False)
2022-11-06 18:56:52.179 DEBUG (MainThread) [zigpy.zcl] [0xEDED:232:0x0011] Decoded ZCL frame: SerialDataCluster:schema(param1='D\x01\x04\r\x0bô\nèF')
2022-11-06 18:56:52.179 DEBUG (MainThread) [zigpy.zcl] [0xEDED:232:0x0011] Received command 0x00 (TSN 13): schema(param1='D\x01\x04\r\x0bô\nèF')
2022-11-06 18:56:52.180 DEBUG (SyncWorker_5) [custom_components.visonic.client] XBeeDataFeed Received HA Event in
2022-11-06 18:56:52.180 DEBUG (SyncWorker_5) [custom_components.visonic.client] XBeeDataFeed Received Source Test Passed
2022-11-06 18:56:52.180 DEBUG (SyncWorker_5) [custom_components.visonic.client] XBeeDataFeed Received this data {'data': 'D\x01\x04\r\x0bô\nèF'}
2022-11-06 18:56:52.180 DEBUG (SyncWorker_5) [custom_components.visonic.client] XBeeDataFeed Received Data in args
2022-11-06 18:56:52.180 DEBUG (SyncWorker_5) [custom_components.visonic.client] XBeeDataFeed Received Here 2 d=44 01 04 0d 0b f4 0a e8 46     the cs=232    calc cs=232    the len(d)=9
2022-11-06 18:56:52.180 DEBUG (SyncWorker_5) [custom_components.visonic.client] XBeeDataFeed Received Adding Received data to store, datastore=0d 0b f4 0a 
2022-11-06 18:56:52.180 DEBUG (SyncWorker_5) [custom_components.visonic.client] XBeeDataFeed Received HA Event out
2022-11-06 18:56:52.251 DEBUG (MainThread) [custom_components.visonic.client] XBeeDataFeed retrieving data=0d 0b f4 0a 
2022-11-06 18:56:52.252 DEBUG (MainThread) [custom_components.visonic.pyvisonic] [handle_msgtype0B] Stop    data is 
2022-11-06 18:56:53.171 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=17, SrcAddr=0xEDED, SrcEndpoint=232, DstEndpoint=232, WasBroadcast=<Bool.false: 0>, LQI=57, SecurityUse=<Bool.false: 0>, TimeStamp=494568, TSN=0, Data=b'\x44\x02\x03\x48\x69\x7E\xCF\x46', MacSrcAddr=0xEDED, MsgResultRadius=29)
2022-11-06 18:56:53.172 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0xEDED), src_ep=232, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=232, source_route=None, extended_timeout=False, tsn=0, profile_id=49413, cluster_id=17, data=Serialized[b'D\x02\x03Hi~\xcfF'], tx_options=<TransmitOptions.NONE: 0>, radius=29, non_member_radius=0, lqi=57, rssi=None)
2022-11-06 18:56:53.172 ERROR (MainThread) [zhaquirks.xbee] deserialize
2022-11-06 18:56:53.173 DEBUG (MainThread) [zigpy.zcl] [0xEDED:232:0x0011] Received ZCL frame: b'\x01\x0e\x00D\x02\x03Hi~\xcfF'
2022-11-06 18:56:53.174 DEBUG (MainThread) [zigpy.zcl] [0xEDED:232:0x0011] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, direction=<Direction.Server_to_Client: 0>, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False, *is_reply=False), tsn=14, command_id=0, *direction=<Direction.Server_to_Client: 0>, *is_reply=False)
2022-11-06 18:56:53.174 DEBUG (MainThread) [zigpy.zcl] [0xEDED:232:0x0011] Decoded ZCL frame: SerialDataCluster:schema(param1='D\x02\x03Hi~ÏF')
2022-11-06 18:56:53.174 DEBUG (MainThread) [zigpy.zcl] [0xEDED:232:0x0011] Received command 0x00 (TSN 14): schema(param1='D\x02\x03Hi~ÏF')

Just so you’re aware I have not updated HA and I’m still running 2022.10.5 with the xbee over-written files from a few posts ago that you asked me to make.
Let me know if there’s anything else I can help with if you want me to try something.
EDIT: I forgot to mention that it does work even though it shows this error

I’ve installed the latest version of HA and the deserialize error is not there so it’s working well.
Thanks for your help.

1 Like

Hi. Some very useful information in this thread. However, I’m confused about what exactly is needed to use an S2C with ZHA. I spoke to Digi and their reply was:

"The XBee module is only the wireless portion of a Zigbee network. You need to write an application that communicates with the XBee via the API mode to read the packets coming in and then to issue the proper responses. "

Yet it appears from this thread that people are able to use the S2C with ZHA without writing any such application.

I’ve looked at zigpy-xbee but it’s not obvious what it does or how to use it. Digi appeared to suggest you need something else running on the Zigbee device itself whereas zigpy-xbee is talked about in the context of integrations so maybe it runs on the ZHA server?

Currently I have an Xbee S2C which does nothing apart from flashing an orange LED. It doesn’t show in ZHA. I installed the “Zigbee TH Reg” firmware. Not sure if this is correct but even Digi were unsure which one to use. It comes up in API mode and I can set all the parameters (CE, ZS, EE etc.) as above.

Hi Robert,

You need to pair your S2C to ZHA just like any other zigbee device.
You probably first need to configure it with XCTU to join your zigbee network.