David00 / rpi-power-monitor

Power Monitor (for Raspberry Pi)
https://david00.github.io/rpi-power-monitor/
GNU General Public License v3.0
1k stars 103 forks source link

Manual Install -- KeyError: 'plugins' #123

Closed keepitreall89 closed 6 months ago

keepitreall89 commented 6 months ago

Hello, I've tried multiple methods of the Manual setup process, but I keep getting stuck on this same error message. I'm not sure where to go from here to debug it. I set up a virtual python environment to get around the "breaks system packages" warning that is thrown if you just attempt to run "pip install ." on the current version of python, I don't think that should cause this, but I haven't tested it either.

DEBUG : Verbose logging output enabled.
DEBUG : Attempting to load config from /home/user/rpi_power_monitor/rpi_power_monitor/config.toml
DEBUG : Sampling enabled for 6 channels.
DEBUG : Identified mains channels: [1, 2]
DEBUG : Identified 0 production channels: ([])
DEBUG : Identified 4 consumption channels: ([3, 4, 5, 6])
DEBUG : Trying to connect to the Influx database at localhost:8086...
DEBUG : Successfully connected to Influx at localhost:8086
Traceback (most recent call last):
  File "/home/user/rpi_power_monitor/rpi_power_monitor/power_monitor.py", line 1270, in <module>
    rpm = RPiPowerMonitor(mode=args.mode, config=args.config)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/rpi_power_monitor/rpi_power_monitor/power_monitor.py", line 95, in __init__
    self.load_plugins(self.config['plugins'])   # Note: Plugins are initialized here, but they are only started when the power monitor routine starts.
                      ~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'plugins'
David00 commented 6 months ago

Hi @keepitreall89, thanks for finding this issue and reporting it with the traceback. I've identified the cause and will push a fix right after posting this comment.

To get the fix, just navigate into your project directory and do a git pull:

cd ~/rpi_power_monitor
git pull

In short, the issue is caused because the current version of the project on the master branch assumes the [plugins] section exists in the config.toml file. Not having the [plugins] section is normal unless you're specifically using a plugin.

Running in a virtual environment is fine (and actually preferred in the latest Raspberry Pi OS).