Catalog PyPI
Back to packageRELEASE DETAILS

1.3.2

PyPI

Agrothon

A Farm Monitoring Bot

Published25 Jun 2021
Direct dependencies19
Transitive dependenciesNot calculated

README

Version 1.3.2 documentation

Agrothon

A Farm Monitoring Bot

PyPI PyPI - Python Version PyPI - Wheel PyPI - Implementation PyPI - Downloads GitHub license GitHub issues GitHub forks GitHub stars

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

    API Docs

  • 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.env and rename it to agrothon.env

      wget -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.env

      wget -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_PORT in Caddyfile or Just Set $API_PORT in 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 bot
      • agrothon - Starts Both agroserver and agrobot with 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 up it will pull the image from container registry and run the services

Variables in agrothon.env

VariableValueExampleRequiredDescription
--Bot Configuration--
TELEGRAM_APP_IDTelegram API APP ID1234567TrueCan be obtained from Telegram
TELEGRAM_API_HASHTelegram API Hash022d29afxxxxxxxxf825980a7974ec42TrueCan be obtained from Telegram
BOT_TOKENTelegram Bot Token123456:abcdefghijTrueCan be obtained from Bot Father
API_BASE_URLApi base Host URLhttps://mysite.com/TrueMust be host Without port (i.e Port 80/443* only)
ALERT_CHANNEL_IDAlert channel ID-100123456789TrueIntruder Alerts will be posted to this channel
STATEname of the stateAndhra PradeshTrueMust be a state in India 🤔
DISTRICTname of the districtEast GodavariTruename of your district
DEF_LANGDefault LanguageenglishFalseCan be choosen from english, telugu, tamil, hindi (Default is english)
DEF_CITYDefault CityVijayawadaTrueCity from which weather should be fetched
--Server Configuration--
OPEN_WEATHER_APIOpen weather API Keyd6778a1acdd67c4xxxxxxe500e81987dTrueAPI to get the weather data of a particular region, Get this from OpenWeather
API_KEYAn API Key for your ServerAgrothonTrueThis is like a Password for your API Server, So choose Wisely (Alphanumeric only)
DB_URLMongoDB URLmongodb+srv://xxx:xxx@hmmm.mongodb.netTrueDatabase to Store All the data, get this from MongoDB
SENSOR_PRIORITY_INDEXMoisture sensor priority2TrueWhich moisture sensor to use for predicting on/off the pump
AUTH_IDTelegram user ID12345678FalseIf 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.8 is compulsory

Agrothon Telegram bot

Screenshots

  • Telegram Bot Start

    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
    

    Commands

  • Object Detection

    Bear

    Cow

    Elephant

    Farm

    Sheep

    Peacock

  • Bot Commands Usage

    • Pump Prediction

      Pump Prediction

    • Language Change

      Language Change

    • Complete info

      Complete info

    • Field Command

      Field Command

    • Help Command

      Help Command

    • Object Detection by sending an Image to Bot

      Object Detection Bot

    • Language Menu

      Language Menu

    • Pump Keyboard

      PumpKeyboard

    • Pump on/off

      pump on/off

    • Rainfall Prediction

      Rainfall

    • Settings Keyboard

      Settings

    • Server Stats

      Stats

    • Weather Data

      Weather

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 19

Native requirements
19 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
pyrogram
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pyrogram (==1.2.9)runtime
tgcrypto
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
tgcrypto (==1.2.2)runtime
motor
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
motor (==2.4.0)runtime
fastapi
Environment
{
  "extras": "all",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
fastapi[all] (==0.64.0)runtime
requests
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
requests (==2.25.1)runtime
python-dotenv
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
python-dotenv (==0.17.0)runtime
aiohttp
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
aiohttp (==3.7.4.post0)runtime
python-telegram-bot
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
python-telegram-bot (==13.5)runtime
pandas
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pandas (==1.2.4)runtime
numpy
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
numpy (==1.19.5)runtime
tensorflow
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
tensorflow (==2.4.1)runtime
prettytable
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
prettytable (==2.1.0)runtime
opencv-python
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
opencv-python (==4.5.1.48)runtime
pillow
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pillow (==8.2.0)runtime
seaborn
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
seaborn (==0.11.1)runtime
Keras
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
Keras (==2.4.3)runtime
scikit-learn
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
scikit-learn (==0.22.2.post1)runtime
telegraph
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
telegraph (==1.4.1)runtime
psutil
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
psutil (==5.8.0)runtime

Distribution files

2 collected
Agrothon-1.3.2-py3-none-any.whl

bdist_wheel · 60.71 KB · Python py3

Source file
Agrothon-1.3.2.tar.gz

sdist · 47.37 KB · Python source

Source file

Repository

PENDING
viswanathbalusu/agrothon

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:28 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:1d3a9081e4b99f2cf5168a7fc266b0bcfff43adeb36dd13ec2177311d6ed66cb

Other collected versions

View all collected versions →