forked from letscontrolit/ESPEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest006.py
executable file
·138 lines (114 loc) · 2.91 KB
/
test006.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
#!/usr/bin/env python3
from esptest import *
# hardware requirements:
# - node 0 (will be output pin)
# - node 1 (will be input/sender)
# - D6 connected to eachother
# tests:
# - GPIO boot state
pin_input=12;
@step()
def prepare():
node[0].reboot()
node[0].pingserial()
node[0].serialcmd("resetFlashWriteCounter")
node[0].serialcmd("TaskClearAll")
node[0].serialcmd("Save")
node[1].reboot()
node[1].pingserial()
node[1].serialcmd("resetFlashWriteCounter")
node[1].serialcmd("TaskClearAll")
espeasy[1].controller_domoticz_mqtt()
espeasy[1].post_device(1, """
TDNUM:1
TDN:
TDE:on
taskdevicepin1:{pin_input}
plugin_001_type:0
plugin_001_button:0
TDSD1:on
TDID1:6000
TDT:1
TDVN1:Switch
edit:1
page:1
""".format(pin_input=pin_input))
@step()
def test():
# log.info("Setting bootsate to default and rebooting")
# node[0].http_post(
# page="hardware",
# data="""
# pled:-1
# pledi:on
# psda:4
# pscl:5
# sd:-1
# p0:0
# p2:0
# p4:0
# p5:0
# p9:0
# p10:0
# p12:0
# p13:0
# p14:0
# p15:0
# p16:0
# """)
# node[0].reboot()
# node[0].pingserial()
log.info("Setting bootsate to LOW rebooting")
espeasy[0]._node.http_post(
page="hardware",
data="""
pled:-1
pledi:on
psda:4
pscl:5
sd:-1
p0:0
p2:0
p4:0
p5:0
p9:0
p10:0
p12:1
p13:0
p14:0
p15:0
p16:0
""")
node[0].reboot()
node[0].pingserial()
controller.clear()
values=controller.recv_domoticz_mqtt(SENSOR_TYPE_SWITCH,6000)
test_is(values[0],0)
log.info("Setting bootsate to HIGH rebooting")
espeasy[0]._node.http_post(
page="hardware",
data="""
pled:-1
pledi:on
psda:4
pscl:5
sd:-1
p0:0
p2:0
p4:0
p5:0
p9:0
p10:0
p12:2
p13:0
p14:0
p15:0
p16:0
""")
node[0].reboot()
node[0].pingserial()
controller.clear()
values=controller.recv_domoticz_mqtt(SENSOR_TYPE_SWITCH,6000)
test_is(values[0],1)
if __name__=='__main__':
completed()