-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
modbus-sungrow-sg3ks.py
executable file
·49 lines (46 loc) · 1.07 KB
/
modbus-sungrow-sg3ks.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
read_register = {
"5003": "daily_power_yield_0.01", # Wh
"5004": "total_power_yield_1000", # MWh
"5008": "internal_temp_10", # C
"5011": "pv1_voltage_10", # V
"5012": "pv1_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
}
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",
"Temperature": "internal_temp",
"Voltage": "grid_voltage"
}