Skip to content

Software 4. Updating the Code

David00 edited this page Nov 12, 2022 · 6 revisions

Updating via Git

Please note that the CT numbers changed from using 0-5 to using 1-6 in November 2022. This simply means that channel 0 is now called channel 1 (and so on). If you installed the power monitor prior to November 2022, you're most likely using the software version with CT numbers 0-5. If you update to the latest software, the power monitor will start using channel numbers 1-6, which will impact your InfluxDB measurements and Grafana dashboards. Therefore, I do not recommend updating old installations to the latest version. If you have not collected any power monitor data (or are fine with abandoning what you have collected), you can proceed to upgrade. You'll also have to update your Grafana dashboard queries manually.

Caution: Following this procedure will update your local config.py file and overwrite your calibration constants! We will backup your config.py file before updating your code. If you have not calibrated your unit yet, you don't need to worry about steps 2 or 3.

  1. Login to your Pi's terminal, and navigate to the project root directory:

     cd ~/rpi_power_monitor
     # or, if you're on the older software:
     cd ~/rpi-power-monitor
    
  2. Copy your current config.py file to create a backup:

     cp config.py config.py.backup
    
  3. Stash any changes that you've made to the files in this folder with:

     git stash
    
  4. Update the code from Git and merge the changes into your local folder:

     git pull
    
  5. Update Python package dependencies:

     pip3 install -r requirements.txt
    
  6. Replace the values for ct_phase_calibration and GRID_VOLTAGE in the new config.py file.

  7. If you've already set the software up as a service, restart the service with:

     sudo systemctl restart power-monitor 
    
  8. Verify that the software is running:

     sudo systemctl status power-monitor