Skip to content

OpenCampusFarm/ems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EMS

Energy Management System consisting of two subprojects: core and fan.

Project Structure

ems/
├── core/           # Core subproject
├── fan/            # Fan subproject
├── supervisord.conf
├── update.sh
└── ems.service

Prerequisites

  • uv — Python package manager
  • supervisord — process manager (ochinchina's Go port, single supervisord binary)

Setup

1. Clone the repo

git clone https://github.com/OpenCampusFarm/ems /home/pi/ems

2. Install systemd service

sudo cp ems.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now ems

This starts supervisord which manages three processes:

Program Description
core Runs core/main.py via uv
fan Runs fan/main.py via uv
updater Polls GitHub every 2 min and restarts on new commits

Auto-update

update.sh runs in a loop, pulling from GitHub every 2 minutes. If new commits are detected it runs sudo systemctl restart ems to restart the whole stack. No change means no restart.

To allow the pi user to restart the service without a password prompt, add to /etc/sudoers:

pi ALL=(ALL) NOPASSWD: /bin/systemctl restart ems

Useful Commands

# Check service status
sudo systemctl status ems

# Restart everything
sudo systemctl restart ems

# Stop / start
sudo systemctl stop ems
sudo systemctl start ems

# View logs
tail -f /tmp/ems_core.log
tail -f /tmp/ems_fan.log
tail -f /tmp/ems_updater.log

About

Energy Management System in UM Campus Farm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors