test library stuff

This commit is contained in:
Edwin Eefting
2017-10-16 00:15:43 +02:00
parent 8d77c29d75
commit cda973a54f
4 changed files with 23 additions and 32 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ class EspEasy:
plugin_001_type:{plugin_001_type}
plugin_001_button:{plugin_001_button}
TDSD1:on
TDID1:1
TDID1:{TDID1}
TDT:0
TDVN1:Switch
edit:1
+1 -29
View File
@@ -158,32 +158,4 @@ class Node():
data=data_dict
)
r.raise_for_status()
#
# return(r)
#
#
# def config_device(self):
#
# r=requests.post(
# self._url+"devices",
# params={
# 'index':1,
# 'page':1
# },
# data={
# 'TDNUM':1,
# 'TDN': "",
# 'TDE': 'on',
# 'taskdevicepin1': 12,
# 'plugin_001_type':1,
# 'plugin_001_button':0,
# 'TDT':0,
# 'TDSD1':'on',
# 'TDID1':1,
# 'TDVN1':'Switch',
# 'edit':1,
# 'page':1
# }
# )
# print(r.url)
+2
View File
@@ -0,0 +1,2 @@
paho-mqtt
colorlog
+19 -2
View File
@@ -4,15 +4,32 @@ from espeasy import *
from node import *
import config
import time
import paho.mqtt.client as mqtt
### preprare
espeasy1=EspEasy(Node(config.nodes[0]))
espeasy2=EspEasy(Node(config.nodes[1]))
client = mqtt.Client()
client.connect(config.mqtt_broker, 1883, 60)
client.loop_start()
client.subscribe('#')
def on_message(client, userdata, message):
print("Received message '" + str(message.payload) + "' on topic '"
+ message.topic + "' with QoS " + str(message.qos))
client.on_message=on_message
print("config cont")
espeasy2.controller_domoticz_mqtt(index=1, controllerip=config.mqtt_broker)
espeasy2.device_p001(index=1, taskdevicepin1=12, plugin_001_type=1, plugin_001_button=0)
print("config dev")
espeasy2.device_p001(index=1, taskdevicepin1=12, plugin_001_type=1, plugin_001_button=0, TDID1=1415)
### test
espeasy1.control(cmd="gpio,12,1")
time.sleep(1)
espeasy1.control(cmd="gpio,12,0")
time.sleep(1)