Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7234f04
cleanup files and improve lan mode
ChuckNorrison Oct 2, 2024
e4a7d08
Security fix
ChuckNorrison Oct 7, 2024
5d8c014
Fix typos
ChuckNorrison Oct 7, 2024
c261887
No wifi checks if disabled
ChuckNorrison Oct 7, 2024
08c3553
fix video stream
ChuckNorrison Oct 7, 2024
eb4d47d
fix photo quality
ChuckNorrison Oct 7, 2024
5b59549
Add modal dialogues for images page
ChuckNorrison Oct 7, 2024
9aa32d4
Improve error logging and README
ChuckNorrison Oct 7, 2024
ae0cd1f
Improve error logging, clean up files
ChuckNorrison Oct 7, 2024
ab22b25
fix missing logger in photomod
ChuckNorrison Oct 7, 2024
e0c2b11
Improve error logging, cleanup code
ChuckNorrison Oct 8, 2024
71f9636
fix status variable output mismatch
ChuckNorrison Oct 8, 2024
0c11b0c
fix scheduler in lan mode
ChuckNorrison Oct 8, 2024
34a7c32
Add configurable email server
ChuckNorrison Oct 8, 2024
254ff24
Add color for notifications
ChuckNorrison Oct 8, 2024
77d2c18
Security fix for flask
ChuckNorrison Oct 9, 2024
386daf3
Add Delete all Messages for Notifications
ChuckNorrison Oct 9, 2024
f818f85
Clean up network view
ChuckNorrison Oct 9, 2024
e06e4c2
Add Delete all Data for Sensordata as modal
ChuckNorrison Oct 9, 2024
46797cd
Improve FertilizerPlan
ChuckNorrison Oct 9, 2024
6da6856
Improve Interrupt notifications
ChuckNorrison Oct 9, 2024
8e2b019
Improve layout
ChuckNorrison Oct 9, 2024
efa972d
Update README.md
ChuckNorrison Oct 9, 2024
db05866
Fix sensordata defaults after reboot
ChuckNorrison Oct 11, 2024
7cc8104
Fix disable by accident
ChuckNorrison Oct 13, 2024
e2380e7
Add thumb consistency check and increase thumbnail size
ChuckNorrison Oct 15, 2024
2be7601
GUI rework on bootstrap 5
ChuckNorrison Oct 16, 2024
c92f712
More GUI rework
ChuckNorrison Oct 17, 2024
bda029d
Move Weather API and About to Settings
ChuckNorrison Oct 17, 2024
41b5eba
Finalize GUI rework
ChuckNorrison Oct 21, 2024
12ca664
Update README.md
ChuckNorrison Oct 21, 2024
9f61b43
Small GUI related improvements
ChuckNorrison Oct 21, 2024
15addbe
Add different card colors for nav pills
ChuckNorrison Oct 21, 2024
a832f1d
Update jqplot to v1.0.9
ChuckNorrison Oct 21, 2024
f6c1c60
GUI improvements
ChuckNorrison Oct 22, 2024
9e7a1cd
Add unseen notifies badge to nav
ChuckNorrison Oct 23, 2024
979bcd4
Improve notify badge with setinterval
ChuckNorrison Oct 23, 2024
d3fbb4f
GUI Bootstrap 5 migration for missing pages
ChuckNorrison Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

*.pyc
15 changes: 6 additions & 9 deletions GPIOEXPI2Ccontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,13 @@ def CheckRealHWpin(PIN=""):
return False, 0
return False, 0


def GPIO_output(address , PINstr, level ):
isRealPIN,PIN=CheckRealHWpin(PINstr)
if isRealPIN:
if address in MCPDEVICES:
mcp=MCPDEVICES[address]
else:
msg= "Address =" +address+ " not available for this Hardware"
msg= "Address =" + address + " not available for this Hardware"
logger.error(msg)
print(msg)
return False
Expand All @@ -246,19 +245,17 @@ def GPIO_output(address , PINstr, level ):
mcp.output(PIN, mcp.LOW)
else:
mcp.output(PIN, mcp.HIGH)
statusdataDBmod.write_status_data(GPIO_data,address+PINstr,"level",level)
statusdataDBmod.write_status_data(GPIO_data, address + PINstr, "level", level)
logger.info("Set PIN=%s to State=%s", PINstr, str(level))
return True
else:
msg= "PIN=" +PINstr+ " not Valid for this Hardware"
logger.error(msg)
print(msg)
if PINstr != "N/A":
msg= "PIN=" + PINstr + " not Valid for this Hardware (" + address + ")"
logger.error(msg)
print(msg)

return False




def GPIO_setup(address, PINstr, state, pull_up_down=""):
isRealPIN,PIN=CheckRealHWpin(PINstr)
if isRealPIN:
Expand Down
8 changes: 5 additions & 3 deletions HWcontrol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,9 +1142,11 @@ def GPIO_output(PINstr, level):
#print PINstr , " ***********************************************" , level
return True
else:
msg= "PIN=" +PINstr+ " not Valid for this Hardware"
logger.error(msg)
print(msg)
if PINstr != "N/A":
msg= "PIN=" +PINstr+ " not Valid for this Hardware"
logger.error(msg)
print(msg)

return False

def GPIO_output_nostatus(PINstr, level):
Expand Down
Binary file removed HWcontrol.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion Prepare for Release/Release checklist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ HYDROSYSTEM SW LEVEL:
4c) remove all files in database /logfiles/
4d) remove all files in database /static/downlaod/
remove all pictures -> go to 'images' and push deleteall or go to static/hydropicture/
5) bash, ensure the latest bash file is install_hydreosys4.sh
5) bash, ensure the latest bash file is install_hydrosys4.sh


START THE PROGRAM IN UBUNTU:
Expand Down
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
# Hydrosystem

The hydrosys4 project aim to create a platform for the raspbery pi 3 which let you easily controls and record sensors data, use actuators through the GPIO and play with analog by using external ADC the supported hardware and wiring can be found in the Documentation folder. The platform is developed in python and is based on web server interface. The system can control the WiFi interface and work either in Access point mode than connected to wifi network. The webserver interface can be adjusted to support several purposes, the current development is a small irrigation system, GIU is made to support planning and conditional irrigation based on temperature and humidity, relays control the valve and pumps, the system also support email notifications, cameras and video. Latest upgrade include possibility to mount camera over servo.
The SW platform is based on a web interface where the webserver is running locally on the raspberry. The SW is designed to be used with smartphone and to be reachable from internet without need of external servers or dynamic DNS.
The basic concept is to develop a platoform for the internet of things which is not centralized, then to avoid extra fees, Static IP fees, Dynamic DNS fees. Every time the IP address is updated the system will send an email with relevant link to itself.
NOTE: The mainstream IoT products relies on central server architecture which binds user to annual fees, the server is also a single point of failure and a poses high security problems.
For the designed applications the supporting hardware platform and sensors are choosen to be inexpensive.
The hydrosys4 project aims to create a platform for the raspberry pi which lets you easily control and record sensors data.

More details can be found on my webpage https://hydrosysblog.wordpress.com/
Use actuators through the GPIO and play with analog by using external ADC the supported hardware and wiring can be found in the Documentation folder.

The platform is developed in python and is based on web server interface. The system can control the WiFi interface and works in Access point mode where to user can connect to.

The webserver interface can be adjusted to support several purposes, the current development is used as automatic irrigation system. The GUI is made to support planning and conditional irrigation based on temperature and humidity, relays control the valve and pumps, the system also supports email notifications, cameras and video stream. Latest upgrade include possibility to mount camera over servo.

The software platform is based on a web interface where the webserver is running locally on the raspberry pi. The software is designed to be used with smartphone and to be reachable from internet without need of external servers or dynamic DNS. Every time the IP address is updated the system will send an email with relevant link as configured.

More details can be found on the webpage https://hydrosysblog.wordpress.com/

![image](https://github.com/user-attachments/assets/481f820f-82e2-4f30-bfb0-a897d2679e94)

# Installation

For installation please follow the installation guide in the website:
For installation please follow the installation guide from here:

https://hydrosysblog.wordpress.com/configuration/

two installation methods are possible:

1) For easy installation it is possible to directly download the SD image.
1) For easy installation it is possible to directly download the SD image from current relase

2) For a more traditional installation it is possible to download a bash installer

```
wget https://raw.githubusercontent.com/Hydrosys4/Master/master/bash/install_hydrosys4.sh

sudo chmod u+x install_hydrosys4.sh

sudo ./install_hydrosys4.sh
```

# Access to the System

The systems run on the RPI3 which will act as access point, wait few seconds after the system is restarted, you will se a new wifi network.
The system runs on a raspberry pi, which will act as access point per default. Wait a few seconds after the system is restarted, you will see a new wifi network.
Once connected to the wifi network, open the webbrowser and type the address indicated in the guide.

https://hydrosysblog.wordpress.com/configuration/
Expand All @@ -36,5 +49,3 @@ Username: admin
Password: default

it is strongly suggested to modify the password.


Binary file removed SchedulerMod.pyc
Binary file not shown.
Binary file removed __pycache__/ActuatorControllermod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/GPIOEXPI2Ccontrol.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/HASScompMatrix.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/HASSintegrMQTT.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/HC12control.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/HC12mod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/HWcontrol.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/Hygro24_I2C.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/MQTTcontrol.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/REGandDBmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/SchedulerMod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/SlowWire.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/actuatordbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/advancedmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/autofertilizerdbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/autofertilizermod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/automationdbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/automationmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/autowateringdbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/autowateringmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/basicSetting.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/camera_pi.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/cameradbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/clockdbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/clockmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/countryinfo.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/databasemod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/debuggingmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/emaildbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/emailmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/fertilizerdbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/filemanagementmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/filestoragemod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/flasksettings.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/hardwaremod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/hx711_AV.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/interruptdbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/interruptmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/jsonFormUtils.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/loggerconfig.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/logindbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/messageboxmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/networkdbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/networkmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/photomod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/selectedplanmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/sensordbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/start.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/statusdataDBmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/sysconfigfilemod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/systemtimeMod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/videocontrolmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/videomod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/wateringdbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/wateringplansensordbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/weatherAPIdbmod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/weatherAPImod.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/wpa_cli_mod.cpython-37.pyc
Binary file not shown.
Binary file removed actuatordbmod.pyc
Binary file not shown.
Binary file removed advancedmod.pyc
Binary file not shown.
24 changes: 12 additions & 12 deletions autofertilizermod.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,12 @@
# triggerdate, datetime when the doser have been triggered to start
# tobeactivated, doser need to be activated in the next opportunity


def isschedulermode(element):
def getworkmode(element):
recordkey="element"
recordvalue=element
keytosearch="workmode"
workmode=autofertilizerdbmod.searchdata(recordkey,recordvalue,keytosearch)
if workmode=="SceduledTime":
return True
else:
return False

return workmode

def checkactivate(elementwater,durationwater): # requires integer input
elementlist=fertilizerdbmod.getelementlist()
Expand All @@ -47,7 +42,8 @@ def checkactivate(elementwater,durationwater): # requires integer input
break
if waterok: # there is a corresponding doser element
minwaterduration=hardwaremod.toint(autofertilizerdbmod.searchdata("element",element,"minactivationsec"),0)
if not isschedulermode(element): #setup is not for scheduled time
workmode = getworkmode(element)
if workmode == "BeforeWatering": #setup is not for scheduled time
print(" Fertilizer " ,element ," set to autowater")
print(" Check Water duration ", durationwater ,">", minwaterduration)
if durationwater>minwaterduration: # watering time above the set threshold
Expand All @@ -59,9 +55,9 @@ def checkactivate(elementwater,durationwater): # requires integer input
time.sleep(durationfer) #this blocks the system (and watering activation) for n seconds ... not best practice
else:
print(" No pending request to activate ", element)

def activatedoser(element, duration):
print(element, " ",duration, " " , datetime.now())
print(element, " ",duration, " " , datetime.now())
logger.info('Doser Pulse, pulse time for ms = %s', duration)
msg, pulseok = ActuatorControllermod.activateactuator(element,duration)
# msg , pulseok=hardwaremod.makepulse(element,duration)
Expand All @@ -85,13 +81,17 @@ def checkworkmode(element):
return autofertilizerdbmod.searchdata("element",element,"workmode")

def timelist(element):
if isschedulermode(element):
workmode = getworkmode(element)
if workmode == "ScheduledTime":
fertime=autofertilizerdbmod.searchdata("element",element,"time")
print("fertime " , fertime)
timelist=hardwaremod.separatetimestringint(fertime)
else:
elif workmode == "BeforeWatering":
print("non scheduler mode ")
timelist=hardwaremod.separatetimestringint("00:20:00") # get up 0 minutes and check for doseractivation
else:
print("Fertilizer is disabled")

return timelist

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion autowatering/autowateringmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def message(msg, status: StatusManager, console=True, log=True, logseverity = "
if mail:
Messaging.writemail(msg, status, mailtype)
if note:
dictitem={'title': "System Message (Alert) - Autowatering", 'content': msg }
dictitem={'title': "System Message (Alert) - Autowatering", 'content': msg, 'color': "blue" }
messageboxmod.SaveMessage(dictitem)


Expand Down
6 changes: 0 additions & 6 deletions bash/guide~

This file was deleted.

5 changes: 5 additions & 0 deletions bash/install_hydrosys4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,11 @@ server {
proxy_buffering off;
}

location /static/download/configdownload/logincred.txt {
return 302 https://$server_name$request_uri;
}


location /favicon.ico {
alias /home/pi/env/autonom/static/favicon.ico;
}
Expand Down
Binary file removed basicSetting.pyc
Binary file not shown.
Binary file removed camera_pi.pyc
Binary file not shown.
Binary file removed cameradbmod.pyc
Binary file not shown.
10 changes: 9 additions & 1 deletion changelog/change
Original file line number Diff line number Diff line change
Expand Up @@ -1044,4 +1044,12 @@ This means that after the MQTT discovery configuration has been push to home ass

2022-10-05 -> release 343d

- Modify the Notification function to properly delete messages
- Modify the Notification function to properly delete messages

2024-10-07 -> release 344

- Security fix with hashed passwords and removed logincred.txt from webserver
- Improved LAN mode
- Fix video stream resolutions
- Fix photo quality
- Add Create Image and modal dialogues in images
32 changes: 0 additions & 32 deletions changelog/change~

This file was deleted.

4 changes: 2 additions & 2 deletions clockdbmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
fertilizer UI setting storage utilities
"""
from __future__ import print_function
from __future__ import print_function

#import logging
import os
Expand Down Expand Up @@ -46,7 +46,7 @@ def changesavesetting(FTparameter,FTvalue):
searchvalue="clock"
isok=filestoragemod.savechange(DATAFILENAME,searchfield,searchvalue,FTparameter,FTvalue)
if not isok:
print("problem saving paramete")
print("problem saving parameter")
return isok

def restoredefault():
Expand Down
Binary file removed clockdbmod.pyc
Binary file not shown.
Binary file removed clockmod.pyc
Binary file not shown.
Binary file removed countryinfo.pyc
Binary file not shown.
8 changes: 0 additions & 8 deletions database/default/defaddata.txt~

This file was deleted.

17 changes: 0 additions & 17 deletions database/default/defhwdata.txt~

This file was deleted.

Loading