forked from letscontrolit/ESPEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest001.py
executable file
·50 lines (40 loc) · 1.08 KB
/
test001.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
#!/usr/bin/env python3
from esptest import *
# hardware requirements:
# - node 0
# - node 1
# - D6 connected to eachother
# tests:
# - pulsing the node0 pin and picking it up on node1 which sends it via domoticz mqtt
@step()
def prepare():
node[0].reboot()
node[0].pingserial()
node[0].serialcmd("resetFlashWriteCounter")
node[1].reboot()
node[1].pingserial()
node[1].serialcmd("resetFlashWriteCounter")
espeasy[1].controller_domoticz_mqtt()
espeasy[1].post_device(1, """
TDNUM:1
TDN:
TDE:on
taskdevicepin1:12
plugin_001_type:1
plugin_001_button:0
TDSD1:on
TDID1:1000
TDT:0
TDVN1:Switch
edit:1
""")
@step()
def test():
espeasy[0].control(cmd="gpio,12,1")
pause(5)
controller.clear_mqtt()
espeasy[0].control(cmd="gpio,12,0")
values=controller.recv_domoticz_mqtt(SENSOR_TYPE_SWITCH,1000)
test_is(values[0],0)
if __name__=='__main__':
completed()