-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
modbus-sungrow-sg10rt.py
65 lines (60 loc) · 1.84 KB
/
modbus-sungrow-sg10rt.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
59
60
61
62
63
64
65
read_register = {
"5003": "daily_power_yield_0.01", # Wh
"5004": "total_power_yield_100", # MWh
"5006": "total_ongrid_running_time", # hr
"5008": "internal_temp_10", # C
"5009": "apparent_power_0.001", # kVa
"5011": "pv1_voltage_10", # V
"5012": "pv1_current_10", # A
"5013": "pv2_voltage_10", # V
"5014": "pv2_current_10", # A
"5017": "total_pv_power", # W
"5019": "grid_voltage_a_10", # V
"5020": "grid_voltage_b_10", # V
"5021": "grid_voltage_c_10", # V
"5022": "inverter_current_a_10", # A
"5023": "inverter_current_b_10", # A
"5024": "inverter_current_c_10", # A
"5031": "total_active_power", # W
"5036": "grid_frequency_10", # Hz
"5071": "array_insulation_resistance_10", # k-ohm
"5113": "daily_operation_time", # m
"5128": "monthly_power_yield_0.01", # Wh
"5216": "export_power_overflow", # W - House Grid Consumption (+ = importing, - = exporting) #new read register
"5217": "export_power_indicator", # W - House Grid Consumption Overflow Indicator #new read register
"5218": "power_meter", # W - House Overall Consumption #new read register
}
holding_register = {
"5000": "year",
"5001": "month",
"5002": "day",
"5003": "hour",
"5004": "minute",
"5005": "second"
}
scan = """{
"read": [
{
"start": "5000",
"range": "100"
},
{
"start": "5100",
"range": "125"
}
],
"holding": [
{
"start": "4999",
"range": "10"
}
]
}"""
# Match Modbus registers to pvoutput api fields
# Reference: https://pvoutput.org/help.html#api-addstatus
pvoutput = {
"Energy Generation": "daily_power_yield",
"Power Generation": "total_active_power",
"Temperature": "internal_temp",
"Voltage": "grid_voltage_a"
}