forked from David00/rpi-power-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
58 lines (50 loc) · 1.89 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import logging
import sys
# Create basic logger
logger = logging.getLogger('power_monitor')
logger.setLevel(logging.INFO)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s : %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
ch.setFormatter(formatter)
logger.addHandler(ch)
# Using a multimeter, measure the voltage of the receptacle where your 9V AC transformer will plug into. Enter the measured value below.
GRID_VOLTAGE = 124.2
# Using a multimeter, measure the output voltage of your AC transformer. Using the value on the label is not ideal and will lead to greater accuracy in the calculations.
AC_TRANSFORMER_OUTPUT_VOLTAGE = 10.2
# InfluxDB Settings
db_settings = {
'host' : 'localhost',
'port' : 8086,
'username' : 'root',
'password' : 'password',
'database' : 'power_monitor'
}
# Define Variables
ct0_channel = 0 # Orange Pair | House main (leg 1 - left) (orange pair)
ct1_channel = 1 # Green Pair | House main (leg 2 - right) (green pair)
ct2_channel = 2 # Blue Pair | Subpanel main (leg 1 - top)
ct3_channel = 3 # Brown Pair | Solar Power
ct4_channel = 6 # 3.5mm Input #1 | Subpanel main (leg 2 - bottom)
board_voltage_channel = 4 # Board voltage ~3.3V
v_sensor_channel = 5 # 9V AC Voltage channel
ct5_channel = 7 # 3.5mm Input #2 | Unused
# The values from running the software in "phase" mode should go below!
ct_phase_correction = {
'ct0' : 1,
'ct1' : 1,
'ct2' : 1,
'ct3' : 1,
'ct4' : 1,
'ct5' : 1,
}
# AFTER phase correction is completed, these values are used in the final calibration for accuracy. See the documentation for more information.
accuracy_calibration = {
'ct0' : 1,
'ct1' : 1,
'ct2' : 1,
'ct3' : 1,
'ct4' : 1,
'ct5' : 1,
'AC' : 1,
}