-
-
Notifications
You must be signed in to change notification settings - Fork 71
/
modbus-sungrow-sg5kd.py
61 lines (56 loc) · 1.62 KB
/
modbus-sungrow-sg5kd.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
read_register = {
"5003": "daily_power_yield_0.01", # Wh
"5004": "total_power_yield_100", # MWh
"5008": "internal_temp_10", # C
"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_10", # V
"5022": "inverter_current_10", # A
"5031": "total_active_power", # W
"5036": "grid_frequency_10", # Hz
"5083": "export_power_overflow", # W - House Grid Consumption (+ = importing, - = exporting)
"5084": "export_power_indicator", # W - House Grid Consumption Overflow Indicator
"5091": "power_meter", # W - House Overall Consumption
"5097": "daily_purchased_energy_10", # kW
"5101": "daily_energy_consumption_0.01", # Wh
"5103": "total_energy_consumption_10", # kWh
}
holding_register = {
"5000": "year",
"5001": "month",
"5002": "day",
"5003": "hour",
"5004": "minute",
"5005": "second"
}
scan = """{
"read": [
{
"start": "5000",
"range": "100"
},
{
"start": "5100",
"range": "50"
}
],
"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",
"Energy Consumption": "daily_energy_consumption",
"Power Consumption": "power_meter",
"Temperature": "internal_temp",
"Voltage": "grid_voltage"
}