# How to send AT command to zigbee device using Python

**URL:** <https://forums.digi.com/t/how-to-send-at-command-to-zigbee-device-using-python/22311>\
**Category:** XBee - 802.15.4\
**Tags:** python, zigbee, at, at-commands, serial-communication\
**Created:** [March 30, 2021, 3:45pm UTC](https://forums.digi.com/t/how-to-send-at-command-to-zigbee-device-using-python/22311 "2021-03-30T15:45:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sp\_trainee\_31](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@sp\_trainee\_31](https://forums.digi.com/u/sp_trainee_31)\
**Post date:** [March 30, 2021, 3:45pm UTC](https://forums.digi.com/t/how-to-send-at-command-to-zigbee-device-using-python/22311/1 "2021-03-30T15:45:11Z")

</div>

Hi, I’m completely new to Python programming and I’d appreciate any assistance and advices given.

I’m currently working on Zigbee device where I need to send a request command to get the result back. I have a python code that listens to the Serial com port but I need to rectify it so it would send the request command and send back the result.

The zigbee that I’m using is a normal zigbee not xbee’s zigbee, I’ve read that it is similar / compatible

This is an example of what I want it to do.  
[https://imgur.com/jp1mmjG.png](https://imgur.com/jp1mmjG.png)

so I need my Python to send the at command “at+uc=2823,?”

which code should I use to fulfil my needs? and how do I write my codes?

Thank you 🙂

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [March 31, 2021, 2:11pm UTC](https://forums.digi.com/t/how-to-send-at-command-to-zigbee-device-using-python/22311/2 "2021-03-31T14:11:22Z")

</div>

I think you posted this at the wrong site. This site is for Digi International products and questions related to that.

---

<div class="post-metadata">

**Author:** ![snahtajain](https://avatars.discourse-cdn.com/v4/letter/s/ee59a6/32.png) [@snahtajain](https://forums.digi.com/u/snahtajain)\
**Post date:** [April 12, 2021, 10:29am UTC](https://forums.digi.com/t/how-to-send-at-command-to-zigbee-device-using-python/22311/3 "2021-04-12T10:29:31Z")

</div>

when you recive a message you get an xbee\_message object, first you must define a data receive callback function and add it to device . In that message you call remote\_device\_get\_64bit\_addr().

[Python classes in Nashik](https://www.sevenmentor.com/python-course-in-nashik)

---

<div class="post-metadata">

**Author:** ![marcel22](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@marcel22](https://forums.digi.com/u/marcel22)\
**Post date:** [July 3, 2022, 9:46am UTC](https://forums.digi.com/t/how-to-send-at-command-to-zigbee-device-using-python/22311/4 "2022-07-03T09:46:46Z")

</div>

Just use pyserial library, open the connection on the COM (or ttys / stty) port and send and receive data. There is no magic here.

[https://pythonhosted.org/pyserial/shortintro.html](https://pythonhosted.org/pyserial/shortintro.html)
