This commit is contained in:
jeanGaston 2024-05-04 17:05:23 +02:00
parent 9dee29fe50
commit cf48f98742
2 changed files with 33 additions and 99 deletions

View File

@ -11,25 +11,48 @@ pip3 install bluepy
echo -n "Enter database file name (default: data.db): "
read db_file
db_file=${db_file:-data.db}
echo -e "DB_FILE = '$db_file'" > Program/env.py
# Create env.py file
echo -n "Enter database file name (default: data.db): "
read db_file
db_file=${db_file:-data.db}
echo -n "Enter smtp server address : "
read smtp
echo -e "SMTP = '$smtp'" > Program/env.py
echo -e "DB_FILE = '$db_file'" > Program/env.py
# Create env.py file
echo -n "Enter database file name (default: data.db): "
read db_file
db_file=${db_file:-data.db}
echo -n "Enter smtp port (default 25) : "
read smtp_port
smtp_port=${smtp_portx:-25}
echo -e "SMTP_PORT = $smtp_port" > Program/env.py
echo -n "Enter sender email address, used as smtp id : "
read smtp_id
echo -e "SMTP_ID = '$smtp_id'" > Program/env.py
echo -n "Enter sender password, used as smtp password : "
read smtp_pwd
echo -e "SMTP_PWD = '$smtp_pwd'" > Program/env.py
echo -n "Enter recipient email address : "
read recipient
echo -e "RECIPIENT = '$recipient'" > Program/env.py
echo -n "Enter Humidity rate alert threshold without percent symbol (default 70): "
read hr_max
hr_max=${hr_max:-70}
echo -e " MAX_HR= $hr_max" > Program/env.py
echo -n "Enter temperature alert threshold withpercent °c symbole (default 30) : "
read temp_max
temp_max=${temp_max:-30}
echo -e " MAX_TEMP= $temp_max" > Program/env.py
echo -e " SENSORS= {"d6:c6:c7:39:a2:e8":"DEMO3", "d6:1c:bf:b7:76:62":"DEMO1", "d7:ef:13:27:15:29":"DEMO2"} " > Program/env.py
echo -e "DB_FILE = '$db_file'" > Program/env.py
# Execute main.py
cd Program
python3 main.py

View File

@ -1,89 +0,0 @@
<mxfile host="Electron" modified="2024-04-30T12:59:49.419Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.2.5 Chrome/120.0.6099.109 Electron/28.1.0 Safari/537.36" etag="96ZUNHBWtkP5rWX_b-QD" version="24.2.5" type="device">
<diagram name="Page-1" id="bOhHcY0AFdvho1AANjnX">
<mxGraphModel dx="1434" dy="854" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="runi3Dr_zG13ChNVSIOy-2" value="Weather Sensor" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="110" y="130" width="110" height="50" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-3" value="" style="whiteSpace=wrap;html=1;aspect=fixed;" vertex="1" parent="1">
<mxGeometry x="365" y="110" width="560" height="560" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-4" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="420" y="240" width="380" height="240" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-6" value="" style="html=1;strokeWidth=1;shadow=0;dashed=0;shape=mxgraph.ios7.misc.bluetooth;fillColor=#007AFF;strokeColor=none;buttonText=;strokeColor2=#222222;fontColor=#222222;fontSize=8;verticalLabelPosition=bottom;verticalAlign=top;align=center;sketch=0;" vertex="1" parent="1">
<mxGeometry x="380" y="132.5" width="47.5" height="47.5" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-7" value="Raspberry PI" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="470" y="80" width="100" height="30" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" edge="1" parent="1" source="runi3Dr_zG13ChNVSIOy-8">
<mxGeometry relative="1" as="geometry">
<mxPoint x="470" y="360" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-26" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="runi3Dr_zG13ChNVSIOy-8" target="runi3Dr_zG13ChNVSIOy-10">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-27" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="runi3Dr_zG13ChNVSIOy-8" target="runi3Dr_zG13ChNVSIOy-11">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-8" value="Main.py" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="570" y="250" width="70" height="30" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-9" value="datascraper.py" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="427.5" y="360" width="90" height="30" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-23" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="runi3Dr_zG13ChNVSIOy-10" target="runi3Dr_zG13ChNVSIOy-19">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-10" value="webserver.py" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="555" y="360" width="100" height="30" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-11" value="databases.py" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="700" y="360" width="90" height="30" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.25;exitY=0;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="runi3Dr_zG13ChNVSIOy-12" target="runi3Dr_zG13ChNVSIOy-10">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="runi3Dr_zG13ChNVSIOy-12" target="runi3Dr_zG13ChNVSIOy-11">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-12" value="Database" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="655" y="440" width="90" height="30" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-19" value="" style="html=1;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="40" y="503" width="250" height="110" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-21" value="HTTP : 5000&lt;div&gt;/ -&amp;gt; Dashboard&lt;/div&gt;&lt;div&gt;/history -&amp;gt; Historique&lt;/div&gt;&lt;div&gt;/admin -&amp;gt; Administrateur&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;color: rgba(0, 0, 0, 0); font-family: monospace; font-size: 0px; text-align: start; text-wrap: nowrap;&quot;&gt;%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22%22%20style%3D%22html%3D1%3BwhiteSpace%3Dwrap%3Bsketch%3D0%3BpointerEvents%3D1%3Bshadow%3D0%3Bdashed%3D0%3BstrokeColor%3Dnone%3BfillColor%3D%23505050%3BlabelPosition%3Dcenter%3BverticalLabelPosition%3Dbottom%3BverticalAlign%3Dtop%3BoutlineConnect%3D0%3Bshape%3Dmxgraph.office.concepts.web_page%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22439.5%22%20y%3D%22560%22%20width%3D%2266%22%20height%3D%2270%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E&lt;/span&gt;&lt;span style=&quot;color: rgba(0, 0, 0, 0); font-family: monospace; font-size: 0px; text-align: start; text-wrap: nowrap; background-color: initial;&quot;&gt;%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22%22%20style%3D%22html%3D1%3BwhiteSpace%3Dwrap%3Bsketch%3D0%3BpointerEvents%3D1%3Bshadow%3D0%3Bdashed%3D0%3BstrokeColor%3Dnone%3BfillColor%3D%23505050%3BlabelPosition%3Dcenter%3BverticalLabelPosition%3Dbottom%3BverticalAlign%3Dtop%3BoutlineConnect%3D0%3Bshape%3Dmxgraph.office.concepts.web_page%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22439.5%22%20y%3D%22560%22%20width%3D%2266%22%20height%3D%2270%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E&lt;/span&gt;&lt;span style=&quot;color: rgba(0, 0, 0, 0); font-family: monospace; font-size: 0px; text-align: start; text-wrap: nowrap; background-color: initial;&quot;&gt;%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22%22%20style%3D%22html%3D1%3BwhiteSpace%3Dwrap%3Bsketch%3D0%3BpointerEvents%3D1%3Bshadow%3D0%3Bdashed%3D0%3BstrokeColor%3Dnone%3BfillColor%3D%23505050%3BlabelPosition%3Dcenter%3BverticalLabelPosition%3Dbottom%3BverticalAlign%3Dtop%3BoutlineConnect%3D0%3Bshape%3Dmxgraph.office.concepts.web_page%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22439.5%22%20y%3D%22560%22%20width%3D%2266%22%20height%3D%2270%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E&lt;/span&gt;&lt;span style=&quot;color: rgba(0, 0, 0, 0); font-family: monospace; font-size: 0px; text-align: start; text-wrap: nowrap; background-color: initial;&quot;&gt;%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22%22%20style%3D%22html%3D1%3BwhiteSpace%3Dwrap%3Bsketch%3D0%3BpointerEvents%3D1%3Bshadow%3D0%3Bdashed%3D0%3BstrokeColor%3Dnone%3BfillColor%3D%23505050%3BlabelPosition%3Dcenter%3BverticalLabelPosition%3Dbottom%3BverticalAlign%3Dtop%3BoutlineConnect%3D0%3Bshape%3Dmxgraph.office.concepts.web_page%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22439.5%22%20y%3D%22560%22%20width%3D%2266%22%20height%3D%2270%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E&lt;/span&gt;&lt;br&gt;&lt;/div&gt;" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
<mxGeometry x="50" y="500" width="150" height="135" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-22" value="" style="sketch=0;pointerEvents=1;shadow=0;dashed=0;html=1;strokeColor=none;fillColor=#505050;labelPosition=center;verticalLabelPosition=bottom;verticalAlign=top;outlineConnect=0;align=center;shape=mxgraph.office.concepts.web_page;" vertex="1" parent="1">
<mxGeometry x="220" y="531" width="50" height="54" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-24" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.422;entryY=-0.033;entryDx=0;entryDy=0;entryPerimeter=0;jumpStyle=arc;" edge="1" parent="1" source="runi3Dr_zG13ChNVSIOy-9" target="runi3Dr_zG13ChNVSIOy-11">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="473" y="340" />
<mxPoint x="738" y="340" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-28" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.042;entryY=0.474;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="runi3Dr_zG13ChNVSIOy-2" target="runi3Dr_zG13ChNVSIOy-6">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="runi3Dr_zG13ChNVSIOy-29" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" target="runi3Dr_zG13ChNVSIOy-4">
<mxGeometry relative="1" as="geometry">
<mxPoint x="428" y="155" as="sourcePoint" />
<mxPoint x="589.5" y="154.5" as="targetPoint" />
<Array as="points">
<mxPoint x="610" y="155" />
</Array>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>