Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
apoleon33 authored Feb 12, 2022
1 parent 4e1f4a0 commit 8a105a0
Show file tree
Hide file tree
Showing 23 changed files with 951 additions and 402 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "plant-database"]
path = src/front/data/plant-database
url = https://github.com/M-A-P-Organisation/plant-database
[submodule "bot"]
path = src/front/discord-bot
url = https://github.com/M-A-P-Organisation/discord-bot
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
# M-A-P
**an invention to manage a plant automatically**
**An invention to manage a plant automatically**

[![CodeFactor](https://www.codefactor.io/repository/github/apoleon33/m-a-p/badge/main)](https://www.codefactor.io/repository/github/apoleon33/m-a-p/overview/main)
[![CodeFactor](https://www.codefactor.io/repository/github/apoleon33/m-a-p/badge/main)](https://www.codefactor.io/repository/github/apoleon33/m-a-p/overview/dev)

## Installation

### prerequisites :
you need to have those 3 installed:
### Prerequisites :
You need to have those 3 installed:
1. node.js/npm
2. python/pip
3. bash

### automatic install
### Automatic install

```sh
curl -s https://raw.githubusercontent.com/apoleon33/M-A-P/main/install.sh | sh
```

### manual install
### Manual install

```sh
git clone https://github.com/apoleon33/M-A-P.git && cd M-A-P
git clone --recursive https://github.com/apoleon33/M-A-P.git && cd M-A-P
```

then you will have to install the needed python packages :
Then you will have to install the needed python packages :
(once you cd in M-A-P)
```sh
pip install -r requirements.txt
```
then you will have to install the required npm packages:
(once you are in M-A-P/src/front)
Once its done, install the required npm packages:
(in M-A-P/src/front)
```sh
npm install
```

The arduino also require the [
The arduino also require the [
DHT sensor library ](https://github.com/adafruit/DHT-sensor-library) by adafruit to work
1 change: 1 addition & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
here is the documentation for the M-A-P project

# SUMMARY
- installation guide

## hardware
- components
Expand Down
17 changes: 17 additions & 0 deletions doc/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Installation guide

## Prerequisites
1. node.js/npm
2. python/pip
3. bash


## Arduino
### Choose the way to televerse it

To televerse the code to the arduino you will need whether the [ arduino cli ](https://github.com/arduino/arduino-cli) or the [ arduino IDE ](https://www.arduino.cc/en/software), or anything like that.

### Install the needed library
You will need to install the [ dht library ](https://github.com/adafruit/DHT-sensor-library)

once its done
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#clone the repo
echo "cloning the M-A-P..."
git clone https://github.com/apoleon33/M-A-P.git
git clone --recursive https://github.com/apoleon33/M-A-P.git
cd M-A-P

#install required python packages
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pyserial
pypresence
rich
tkinter
rich
10 changes: 5 additions & 5 deletions src/DiscordIntegration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from rich import *
from pypresence import Presence


Expand All @@ -13,16 +12,17 @@ def createRpc(self) -> None:
self.RPC = Presence(self.rich_token)
self.RPC.connect()
except:
pass
return False

def update_presence(self, time: int, temperature: int = 0) -> None:
def update_presence(self, time: int, temperature: int = 0, humidity:int =0) -> None:
try:
self.RPC.update(large_image="plant",
large_text="M-A-P",
small_image="simulation",
small_text="using the simulator",
details="temperature: " + str(temperature) + " °C",
details=f"temperature: {str(temperature)} °C",
state=f"humidity: {str(humidity)} %",
start=time,
buttons=[{"label": "github", "url": 'https://github.com/apoleon33/M-A-P'}])
except:
pass
return False
45 changes: 14 additions & 31 deletions src/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,42 +40,25 @@ def decision(self,port:object):
The algorithm that will manage the plant itself.
divided in 2 category,if we are in summer (spring + summer) or in winter (autumn + winter)
'''

time_now = datetime.date.fromtimestamp(time.time())
month = time_now.month # if its winter/summer
if month >= 4 and month <= 9: # summer
if self.temperature < self.ideal_temperature[1]:
port.write(b'A')


if self.taux1 < 20 and self.ideal_water[1] == "coupelle":
port.write(b'B')


if self.taux1 < 20 and self.ideal_water[1] == "sec":
self.sec_check += 1
if self.sec_check >= 2:
port.write(b'B')
self.sec_check = 0

if self.taux2 < 20 and self.ideal_water[1] == "pot":
port.write(b'C')


# i is the index wether its summer/winter
i = 1
else: # winter
if self.temperature < self.ideal_temperature[0]:
port.write(b'A')
i = 0

if self.temperature < self.ideal_temperature[i]:
port.write(b'A')

if self.taux1 < 20 and self.ideal_water[i] == "coupelle":
port.write(b'B')

if self.taux1 < 20 and self.ideal_water[0] == "coupelle":
if self.taux1 < 20 and self.ideal_water[i] == "sec":
self.sec_check += 1
if self.sec_check >= 2:
port.write(b'B')
self.sec_check = 0


if self.taux1 < 20 and self.ideal_water[0] == "sec":
self.sec_check += 1
if self.sec_check >= 2:
port.write(b'B')
self.sec_check = 0

if self.taux2 < 20 and self.ideal_temperature[0] == "pot":
port.write(b'C')
if self.taux2 < 20 and self.ideal_water[i] == "pot":
port.write(b'C')
2 changes: 1 addition & 1 deletion src/editing_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def find_sql(self,date:str) -> list:
return old_data

def opening(self):
self.db = sqlite3.connect(location)
self.db = sqlite3.connect(self.location)
self.cursore = self.db.cursor()

def closing(self):
Expand Down
1 change: 1 addition & 0 deletions src/front/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TOKEN =
4 changes: 3 additions & 1 deletion src/front/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ data/temp_0.txt
data/temp_10.txt
data/temp_20.txt
data/temp_30.txt
data/old.db
data/old.db
bot.js
.env
1 change: 1 addition & 0 deletions src/front/data/plant-database
Submodule plant-database added at c4ca6d
1 change: 1 addition & 0 deletions src/front/discord-bot
Submodule discord-bot added at 3849b2
Loading

0 comments on commit 8a105a0

Please sign in to comment.