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

Adding a variable #66

Closed ejg3855 closed 1 year ago

ejg3855 commented 1 year ago

I am trying to modify this code a bit to add a variable for "garage" and I think I have gotten over most of the troubles.

I cannot seem to get past this syntax error, but I have copied it from the "home" and just changed one word.

pi@powermon:~/rpi-power-monitor $ python3 power-monitor.py phase Traceback (most recent call last): File "power-monitor.py", line 7, in import influx_interface as infl File "/home/pi/rpi-power-monitor/influx_interface.py", line 176 avg_garage_current = sum(garage_load_values['current']) / length ^ SyntaxError: invalid syntax

def write_to_influx(solar_power_values, garage_load_values,  home_load_values, net_power_values, ct0_dict, ct1_dict, ct2_dict, ct3_dict, ct4_dict, ct5_dict, poll_time, length, voltages):

    * Calculate Averages
    avg_solar_power = sum(solar_power_values['power']) / length
    avg_solar_current = sum(solar_power_values['current']) / length
    avg_solar_pf = sum(solar_power_values['pf']) / length
    avg_garage_power = sum(garage_load_values['power'] / length
    avg_garage_current = sum(garage_load_values['current']) / length
    avg_home_power = sum(home_load_values['power']) / length
    avg_home_current = sum(home_load_values['current']) / length
    avg_net_power = sum(net_power_values['power']) / length
    avg_net_current = sum(net_power_values['current']) / length
David00 commented 1 year ago

Sorry about the delay - I am just now seeing this.

You're missing the closing parenthesis in the line above:

avg_garage_power = sum(garage_load_values['power'] / length
                                                  ^ here