Home Page

Pages

I think i can achive that by creating a script that updates the battery voltage by simply updating a field in the device.csv ,

Screenshot 2025-04-19 at 2.39.32 AM.png

V0.0.1 Beta

Current status

# device.csv
IP,Assigned_Place,Status,Date of Creation,Main_Node,Nearby_Nodes

This device.csv if first created by the user in which the IP of the device , etc. are typed.

csv_file = "/Users/aruncs/Desktop/Projects/Kannur-Solar-Battery-Monitoring-System-Website/devices.csv"
import csv
devices = [] 
with open(csv_file,newline="") as csvFile:
	reader = csv.DictReader(csvFile)
	for row in reader:
		devices.append(
	            {
	                "assigned_place": row["Assigned_Place"],
	                "status": row["Status"],
	                "ip": row["IP"],
	            }
	        )
print(devices)

But the status attribute here only indicates that if the device is placed on the field or not

active_devices = [
    device for device in devices if device["status"].lower() == "active"
]
inactive_devices = [
    device for device in devices if device["status"].lower() == "inactive"
]
for i in active_devices:
    print(i["assigned_place"])

sorted_device = active_devices + inactive_devices

Routing

@app.route("/")
def home():

return render_template("home.html",devices=sorted_device)

.querySelector("button button:nth-child(2)")

let sortAscending = true;
document.addEventListener("DOMContentLoaded", function () {
  document
    .getElementById("search-input")
    .addEventListener("input", searchDevices);
  document
    .querySelector(".sbutton")  // Changed from .sort-button to .sbutton to match HTML
    .addEventListener("click", sortDevices);
});