In this example we will connect the Grove PIR (passive infrared) Sensor to your Raspberry Pi to detect movement. When movement is detected, a LED will light up and an email is sent out to notify you.
If you are new to using a Raspberry Pi, we suggest you try the basic example on the previous page first.
No need to install the sdk and Grove Pi if you are using the AllThingsTalk Raspberry Pi kit. The SD card comes pre-installed.
If you are using your own Raspberry Pi, you can clone the AllThingsTalk SDK to it using
git clone git://github.com/allthingstalk/python-sdk.git.
Next install the sdk by browsing to the folder
cd python-sdkand the
pip3 install .command.
To install Grove Pi support, please follow these instructions.
An alternative to using a SSH client is hooking up a screen and keyboard to your Raspberry Pi.
Run the application with the command
If all went well, a PIR and LED asset are created under your device in AllThingsTalk Maker. Wave your hand in front of the pir sensor and see if the value changes.
We will create two automation rules.
Please check the Smart doorbell example for a similar notification rule.
Upon running the example, all needed assets are created. We can now use those to create a pinboard to visualise them.
If you chose a (historical) chart, make sure you have Data Storage turned on!