-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathtest.py
144 lines (107 loc) · 5.09 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
import time
import math
from ecoventv2 import Fan
# fan=Fan("10.94.0.106", "1111" , "003A00345842570A" )
# fan=Fan("10.94.0.105", "1111" , "DEFAULT_DEVICEID" )
# fan=Fan("10.94.0.255", "1111" , "DEFAULT_DEVICEID" )
fan=Fan("<broadcast>", "1111" , "DEFAULT_DEVICEID" )
ips = fan.search_devices('0.0.0.0')
print ( ips )
for addr in ips:
print ( addr )
fan=Fan(addr, "1111" , "DEFAULT_DEVICEID" )
fan.init_device()
fan.update();
# Print out all readable parameters
for i in ( fan.params ):
if fan.params[i][0] in ['filter_timer_reset', 'reset_alarms']:
continue
attr = str(getattr(fan , fan.params[i][0]))
print ( fan.params[i][0] + ": " + attr)
#print (ips[0])
# fan=Fan(ips[0], "1111" , "DEFAULT_DEVICEID" )
#fan=Fan("10.94.0.108", "1111" , "DEFAULT_DEVICEID" )
# fan.get_param( 'device_search' );
# print ( 'fan_id: ' , fan.device_search ) ;
# fan.id=fan.device_search ;
# fan.set_man_speed(14);
# fan.update();
# print ( 'man_speed: ' + fan.man_speed )
# man_speed = 5
# fan.set_param('man_speed', hex(math.ceil( man_speed * 255 / 100 )).replace("0x","").zfill(2) ) # hex(math.ceil( speed_in_% * 255 / 100 )).replace("0x","").zfill(2)
# print ( 'man_speed: ' + fan.man_speed )
# fan.set_param('state','togle')
# fan.set_param('state','off') #'on','off','togle'
# fan.set_param('speed','manual') #'low','medium','high','manual'
# print ( 'speed: ' + fan.speed )
# print ( 'man_speed: ' + fan.man_speed )
# print ( 'fan1_speed: ' + fan.fan1_speed )
# print ( 'fan2_speed: ' + fan.fan2_speed )
# print ( 'airflow: ' + fan.airflow )
# Set examples
# fan.set_param('state','togle') #'on','off','togle'
# print ( 'state: ' + fan.state )
# fan.set_param('speed','manual') #'low','medium','high','manual'
# print ( 'speed: ' + fan.speed )
#man_speed = 4
# fan.set_param('man_speed', hex(math.ceil( man_speed * 255 / 100 )).replace("0x","").zfill(2) ) # hex(math.ceil( speed_in_% * 255 / 100 )).replace("0x","").zfill(2)
# print ( 'man_speed: ' + fan.man_speed )
# fan.set_param('timer_mode','off') # 'off', 'night', 'party'
# print ( 'timer_mode: ' + fan.timer_mode )
# fan.update()
# print ( 'timer_counter: ' + fan.timer_counter )
# fan.set_param('humidity_sensor_state','on') # 'off', 'on', 'togle'
# print ( 'humidity_sensor_state: ' + fan.humidity_sensor_state )
# fan.set_param('relay_sensor_state','off') # 'off', 'on', 'togle'
# print ( 'relay_sensor_state: ' + fan.relay_sensor_state )
# fan.set_param('analogV_sensor_state','off') # 'off', 'on', 'togle'
# print ( 'analogV_sensor_state: ' + fan.analogV_sensor_state )
# fan.set_param('humidity_treshold',hex(60).replace("0x","").zfill(2)) #hex(humidity_in_%).replace("0x","").zfill(2)
# print ( 'humidity_treshold: ' + fan.humidity_treshold )
# fan.set_param('boost_time', hex(30).replace("0x","").zfill(2) ) # hex(minutes).replace("0x","").zfill(2)
# print ( 'boost_time: ' + fan.boost_time )
#h=0
#m=38
#s=00
#fan.set_param('rtc_time', hex(s).replace("0x","").zfill(2) + hex(m).replace("0x","").zfill(2) + hex(h).replace("0x","").zfill(2))
#print ( 'rtc_time: ' + fan.rtc_time )
#day_in_week=5
#month=10
#day=8
#year=21
#fan.set_param('rtc_date', hex(day).replace("0x","").zfill(2) + hex(day_in_week).replace("0x","").zfill(2) + hex(month).replace("0x","").zfill(2) + hex(year).replace("0x","").zfill(2))
#print ( 'rtc_date: ' + fan.rtc_date )
#fan.set_param('cloud_server_state','off') # 'off', 'on', 'togle'
#print ( 'cloud_server_state: ' + fan.cloud_server_state )
#fan.set_param('airflow','heat_recovery') # 'ventilation', 'heat_recovery', 'air_supply'
#print ( 'airflow: ' + fan.airflow )
#fan.set_param('analogV_treshold',hex(50).replace("0x","").zfill(2)) #hex(analogV_treshold_%).replace("0x","").zfill(2)
#print ( 'analogV_treshold: ' + fan.analogV_treshold )
#h=8
#m=0
#fan.set_param('night_mode_timer',hex(m).replace("0x","").zfill(2) + hex(h).replace("0x","").zfill(2))
#print ( 'night_mode_timer: ' + fan.night_mode_timer )
#h=4
#m=0
#fan.set_param('party_mode_timer', hex(m).replace("0x","").zfill(2) + hex(h).replace("0x","").zfill(2))
#print ( 'party_mode_timer: ' + fan.party_mode_timer )
#fan.do_func(fan.func['read'] , "0077" )
#print ( 'weekly_schedule_setup: ' + fan.weekly_schedule_setup )
#fan.do_func(fan.func['read'] , "0302" )
#print ( 'night_mode_timer: ' + fan.night_mode_timer )
#fan.do_func(fan.func['read'] , "0305" )
#print ( 'analogV_status: ' + fan.analogV_status )
#for i in range (1,8):
# for j in range (1,5):
# fan.do_func(fan.func['read'] , "0077" , hex(i).replace("0x","").zfill(2) + hex(j).replace("0x","").zfill(2)) # value select schedule Day/Period
# print ( 'weekly_schedule_setup: ' + fan.weekly_schedule_setup )
# time.sleep(0.2)
# Write only parameters
# fan.reset_filter_timer()
# fan.reset_alarms()
#fan.set_param('airflow','ventilation') # 'ventilation', 'heat_recovery', 'air_supply'
#print ( 'airflow: ' + fan.airflow )
#fan.set_param('airflow','air_supply') # 'ventilation', 'heat_recovery', 'air_supply'
#print ( 'airflow: ' + fan.airflow )
#fan.set_param('airflow','heat_recovery') # 'ventilation', 'heat_recovery', 'air_supply'
#print ( 'airflow: ' + fan.airflow )