Introduction
-
This project has three parts
- The Agrothon-Client Module which will be running in Raspberry Pi
- API Server
- Telegram Bot
-
API Server handles Everything, All the routes are shown below
-
Telegram bot is just a frontend for the whole Project
-
Agrothon-Client Sends Sensor data, Intruder images to the API Server which will be analysed there and Stored in the Database
Installation
-
Via pip
-
Install Dependencies
mkdir agrothon && cd agrothon sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get install python3.8 wget wget -q https://github.com/caddyserver/caddy/releases/download/v2.4.1/caddy_2.4.1_linux_amd64.tar.gz tar xzf caddy_2.4.1_linux_amd64.tar.gz rm -rf caddy_2.4.1_linux_amd64.tar.gz chmod a+x caddy mv caddy /usr/local/bin/caddy wget -q https://github.com/viswanathbalusu/Agrothon/raw/main/Caddyfile -O Caddyfile -
First fill the variables in
agrothon-sample.envand rename it toagrothon.envwget -q https://github.com/viswanathbalusu/Agrothon/raw/main/agrothon-sample.env -O agrothon.env -
you can extend all tha variables from Base Config
-
Get the latest Release of data directory and untar in it the same directory where you placed
agrothon.envwget -q https://github.com/viswanathbalusu/Agrothon/releases/latest/download/Agrothon-Data.tar.gz tar -xzf Agrothon-Data.tar.gz && rm -rf Agrothon-Data.tar.gz -
Edit the
$API_PORTinCaddyfileor Just Set$API_PORTin your Shell Environment. -
Then Create a Virtual Environment (Optional but Recommended) and then install Agrothon with
python3.8 -m virtualenv venv source venv/bin/activate pip install Agrothon -
There are two commands in Agrothon
agroserver- Which actually starts the Uvicorn Server on a Unix Domain Socket at/usr/agrothon.sock, So you should use a Reverse proxy (Preferably Caddy)agrobot- Which starts the telegram botagrothon- Starts Bothagroserverandagrobotwith caddy reverse proxy
-
-
Via Docker
- Download Docker compose and Map the ports according to your use
wget -q https://viswanathbalusu.github.io/Agrothon/docker-compose.yml
- Download agrothon.env and Fill the Variables (can be extended from Base Config)
wget -q https://viswanathbalusu.github.io/Agrothon/agrothon-sample.env -O agrothon.env
- Finally do
docker-compose upit will pull the image from container registry and run the services
- Download Docker compose and Map the ports according to your use
Variables in agrothon.env
| Variable | Value | Example | Required | Description |
|---|---|---|---|---|
| - | - | Bot Configuration | - | - |
| TELEGRAM_APP_ID | Telegram API APP ID | 1234567 | True | Can be obtained from Telegram |
| TELEGRAM_API_HASH | Telegram API Hash | 022d29afxxxxxxxxf825980a7974ec42 | True | Can be obtained from Telegram |
| BOT_TOKEN | Telegram Bot Token | 123456:abcdefghij | True | Can be obtained from Bot Father |
| API_BASE_URL | Api base Host URL | https://mysite.com/ | True | Must be host Without port (i.e Port 80/443* only) |
| ALERT_CHANNEL_ID | Alert channel ID | -100123456789 | True | Intruder Alerts will be posted to this channel |
| STATE | name of the state | Andhra Pradesh | True | Must be a state in India 🤔 |
| DISTRICT | name of the district | East Godavari | True | name of your district |
| DEF_LANG | Default Language | english | False | Can be choosen from english, telugu, tamil, hindi (Default is english) |
| DEF_CITY | Default City | Vijayawada | True | City from which weather should be fetched |
| - | - | Server Configuration | - | - |
| OPEN_WEATHER_API | Open weather API Key | d6778a1acdd67c4xxxxxxe500e81987d | True | API to get the weather data of a particular region, Get this from OpenWeather |
| API_KEY | An API Key for your Server | Agrothon | True | This is like a Password for your API Server, So choose Wisely (Alphanumeric only) |
| DB_URL | MongoDB URL | mongodb+srv://xxx:xxx@hmmm.mongodb.net | True | Database to Store All the data, get this from MongoDB |
| SENSOR_PRIORITY_INDEX | Moisture sensor priority | 2 | True | Which moisture sensor to use for predicting on/off the pump |
| AUTH_ID | Telegram user ID | 12345678 | False | If this is not provided, Bot access is given to all the telegram users ⚠️ |
* if there are Other ports too the Bot will Work but it may not be able to post images
Note
- We are using heavy modules like tensorflow and Yolov3, so make sure you have atleast 2.5GB RAM free to get this running
- Only Works in UNIX environments
caddy,xz-utils, all OpenCV Dependencies must be installed if you are choosing non Docker method.Python3.8is compulsory
Agrothon Telegram bot
Screenshots
-
Telegram Bot Start
-
Bot Commands
start - start command field - get field status weather - get weather status rainfall - get predictions of rainfall for your region settings - change settings of the bot restart - restart the bot log - get the log files stats - get the server stats ping - check ping of server help - to get help message -
Object Detection
-
Bot Commands Usage
-
Pump Prediction
-
Language Change
-
Complete info
-
Field Command
-
Help Command
-
Object Detection by sending an Image to Bot
-
Language Menu
-
Pump Keyboard
-
Pump on/off
-
Rainfall Prediction
-
Settings Keyboard
-
Server Stats
-
Weather Data
-
Metadata
Release files for Agrothon 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| Agrothon-1.3.2.tar.gz | 48.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Agrothon-1.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 110.7 kB
Release files / Agrothon-1.3.2.tar.gz
| Download URL | Agrothon-1.3.2.tar.gz |
|---|---|
| Size | 48.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05c85485fc64125f5dec7989c81fe80da41836f2277521981d8ee18826434830
|
|
BLAKE2b-256 checksum How to use checksums |
d0a0cc814cd6c200ec7e3cf49c8b70c03b0fb651912ce113ca69a12d889ea5ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
|
Release files / Agrothon-1.3.2-py3-none-any.whl
| Download URL | Agrothon-1.3.2-py3-none-any.whl |
|---|---|
| Size | 62.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b5ad19558fd9b465ef802ca8efa030e11f2489b4e09c5e392cdfb0696484d2d
|
|
BLAKE2b-256 checksum How to use checksums |
e0a7bb9f00e67d18a5041cf9c94e163221cf980f912974bd18713150d2af06c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
|
Security for Agrothon 1.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.