How to Setup the Aqara Motion Sensor with Samsung SmartThings

The Aqara Motion Sensor is a small and compact smart motion detector that sells for around $20 USD. You can use the Aqara Motion Sensor to activate lighting and notify you as part of an integrated alarm system. The Aqara Motion Sensor (RTCGQ11LM) requires a Hub, however, since it’s a Zigbee device, you can connect the Aqara Motion Detector to the SmartThings platform. This opens up the number of smart devices that you can use with the Aqara Motion Sensor. We’re going to show you how here on automatelife.net.

Automate Your Life is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com and other Amazon websites.

Aqara Motion Detector (Amazon)

Aqara Motion Detector (Amazon, outside US)


Aqara Motion Sensor Setup with SmartThings

To set up the Aqara Motion Sensor with SmartThings, you’ll need to get a few things in order first. The code required has been developed by ‘bspranger.’

Pairing Aqara Motion Sensor to SmartThings

  1. The best practice is to begin this process is to place the Aqara Motion Sensor close to the SmartThings Hub.
  2. Hold down the reset button on the Aqara Motion Sensor. You will see flashing, lights. The Aqara Motion Sensor will be ready to pair.
  3. Open SmartThings App. You need to press the ‘+’ symbol to add a device. Then press ‘device’. Then press ‘Scan Nearby’.
  4. It could take up to a minute or so for your SmartThings Hub to find the Aqara Motion Sensor. Once it does, it will find your Aqara Motion Sensor as “Thing.”
  5. If you do not get a pair, you may have to start over by resetting the Aqara Motion Sensor and repeat the steps.
  6. In the SmartThings App, we suggest renaming the “Thing” Device to something you can associate with your Smart Home (i.e. Aqara Motion [Room Name]). You can hold down the Aqara Motion Sensor Icon in the App and move the Aqara Motion Sensor to another room if you like.

Setting Up Custom Device Handler: How Aqara talks to SmartThings

You will need custom code for Aqara to ‘speak’ to SmartThings, so they can work together.

  1. Open up your web browser, and go to (https://github.com/bspranger/Xiaomi). Xiaomi is the maker of Aqara devices. ‘bspranger’ is the author of the code that is required for the Aqara Motion Sensor to talk to your SmartThings Hub.
  2. At the top of the page, you will see a box with a number of files and file folders under the heading “veeceeoh [UPDATE] v1.3.1 Ready to use …”.
  3. Click the folder “devicetypes/bspranger — [Update v1.3.1 Ready to use]
At the top of the page, click devicetypes/bspranger

4. You will then find all of the Xiaomi Device Handlers listed. Find ‘Xiaomi-aqara-motion-sensor.src‘ and click the url.

5. You will be taken to bspranger’s Xiaomi Aqara Motion Sensor Page. Click ‘xiaomi-aqara-motion-sensor.groovy‘ link. This is the Device Handler code you will need to allow the Aqara Motion Sensor to communicate with Samsung SmartThings.

You will find the Samsung SmartThings Groovy IDE code for Aqara Motion Sensors here.

6. You will see the Aqara Motion Sensor Code look like this CREDIT: bspranger (github):

First few lines of code in the Xiaomi Aqara Motion Sensor Device Handler Code for Samsungs SmartThings

7. Begin copying the code from the ‘//**….’ all the way down to

Beginning to copy the code
drag and copy all the way down to the end of the code – the final ‘}’

8. Once you have copied all the code to your computer’s clipboard. You need to go the Samsung SmartThings Groovy IDE platform on your PC.

Installing Code into Samsung SmartThings Groovy IDE

9. Open another tab in your browser. Go to https://graph.api.smartthings.com/. This is the Samsung SmartThings Groovy IDE. You will need to paste the code into your ‘Device Handlers’.

10. Once you login into the SmartThings Groovy IDE with either your Samsung account or Samsung SmartThings account, click the ‘My Device Handlers’ tab.

11. Once in the ‘My Device Handler’s’, you should see the heading of your name and the number of Device Handler’s your SmartThings system has (if any).

12. At the top right of the page you should see a button called, ‘+ Create New Device Handler.’ Click this. You will be taken to the ‘Create New Device Handler’ Page.

13. You will be give 3 options sorted out as tabs below the introduction:

  • From Template
  • From Code
  • From Example

14. Select the ‘From Code’ Tab. Once you select ‘From Code’ you will see a text box window to paste your ‘Xiaomi-Aqara-Motion-Sensor.groovy‘ code into the text box. Ensure your cursor is at the top of the text box, and paste (press ctrl-v, or click the right mouse button at the top of the text box and select paste). The text box should now be filled with the the appropriate device handler code for the Aqara Motion Sensor.

15. Click Create at the bottom left of the text box. Then go back to the top of the page, and click the ‘Publish’ button. You will see a drop down under the Publish button highlighting ‘For Me’. Ensure you select the ‘For Me’ drop-down.

16. Now go back to the top of the page, and click ‘My Device Handlers’. You will now see the ‘bspranger : ‘Xiaomi Aqara Motion Sensor’ in the listing in your Device Handlers.

17. Now go to the top of the page and select “My Devices.” You will see a list of all your devices connected to your SmartThings ecosystem, including the Aqara Motion Sensor you added earlier. Click the Aqara Motion Sensor.

18. Once in the Aqara Motion Sensor page, called ‘Thing Device [Aqara Motion Sensor]’ or whatever you named your Aqara Motion Sensor, you will see the settings and Ids for the device. Go to the bottom of the page and click ‘Edit.’

19. Go to the ‘Type’ drop down and select ‘Xiaomi Aqara Motion Sensor.’ You may have to scroll all the way down the list to find it. Once selected. Click ‘Update’ at the bottom of the screen, beside the ‘Delete’ button.

20. You may have connected the Aqara Motion Sensor to the SmartThings ecosytem. Open the SmartThings App, and find the Aqara Motion Sensor device. If it has not connected. You may have to remove and re-insert the battery from the Aqara Motion Sensor to allow the Aqara Motion Sensor to reboot.

Once you see the device in your SmartThings App, you should now see the settings of the device and can see the history of actions that took place in the Aqara Motion Sensor. Please watch the video for a full setup of how to use the Aqara Motion Sensor to trigger other actions through Samsung SmartThings.


Aqara Motion Detector (Amazon)

Aqara Motion Detector (Amazon, outside US)


Leave a Reply

Your email address will not be published. Required fields are marked *