forked from wlcrs/huawei-solar-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
143 lines (124 loc) · 3.76 KB
/
test.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
"""Simple test file."""
# import asyncio
# from huawei_solar import AsyncHuaweiSolar
# loop = asyncio.new_event_loop()
# async def test(names):
# hs = await AsyncHuaweiSolar.create("192.168.10.2")
# responses = await hs.get_multiple(names)
# for name, response in zip(names, responses):
# print(f"{name}: {response}")
# await hs.stop()
# loop.run_until_complete(
# test(
# [
# "pv_01_voltage",
# "pv_01_current",
# "pv_02_voltage",
# "pv_02_current",
# "pv_03_voltage",
# "pv_03_current",
# "pv_04_voltage",
# "pv_04_current",
# "pv_05_voltage",
# "pv_05_current",
# "pv_06_voltage",
# "pv_06_current",
# "pv_07_voltage",
# "pv_07_current",
# "pv_08_voltage",
# "pv_08_current",
# "pv_09_voltage",
# "pv_09_current",
# "pv_10_voltage",
# "pv_10_current",
# "pv_11_voltage",
# "pv_11_current",
# "pv_12_voltage",
# "pv_12_current",
# "pv_13_voltage",
# "pv_13_current",
# "pv_14_voltage",
# "pv_14_current",
# "pv_15_voltage",
# "pv_15_current",
# "pv_16_voltage",
# "pv_16_current",
# "pv_17_voltage",
# "pv_17_current",
# "pv_18_voltage",
# "pv_18_current",
# "pv_19_voltage",
# "pv_19_current",
# "pv_20_voltage",
# "pv_20_current",
# "pv_21_voltage",
# "pv_21_current",
# "pv_22_voltage",
# "pv_22_current",
# "pv_23_voltage",
# "pv_23_current",
# "pv_24_voltage",
# "pv_24_current",
# ]
# )
# )
# loop.run_until_complete(test(["model_name", "serial_number"]))
# loop.run_until_complete(
# test(
# [
# "line_voltage_A_B",
# "line_voltage_B_C",
# "line_voltage_C_A",
# "phase_A_voltage",
# "phase_B_voltage",
# "phase_C_voltage",
# "phase_A_current",
# "phase_B_current",
# "phase_C_current",
# "day_active_power_peak",
# "active_power",
# "reactive_power",
# "power_factor",
# "grid_frequency",
# "efficiency",
# "internal_temperature",
# "insulation_resistance",
# "device_status",
# "fault_code",
# "startup_time",
# "shutdown_time",
# ]
# )
# )
# loop.run_until_complete(
# test(
# [
# "meter_status",
# "grid_A_voltage",
# "grid_B_voltage",
# "grid_C_voltage",
# "active_grid_A_current",
# "active_grid_B_current",
# "active_grid_C_current",
# "power_meter_active_power",
# "power_meter_reactive_power",
# "active_grid_power_factor",
# "active_grid_frequency",
# "grid_exported_energy",
# "grid_accumulated_energy",
# "meter_type",
# "active_grid_A_B_voltage",
# "active_grid_B_C_voltage",
# "active_grid_C_A_voltage",
# "active_grid_A_power",
# "active_grid_B_power",
# "active_grid_C_power",
# ]
# )
# )
# async def test_single(name):
# hs = await AsyncHuaweiSolar.create("192.168.10.2")
# print(await hs.get(name))
# await hs.stop()
# loop.run_until_complete(test_single("active_power"))
# loop.run_until_complete(test_single("pv_04_current"))