mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
test library stuff
This commit is contained in:
+1
-1
@@ -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
@@ -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)
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
paho-mqtt
|
||||
colorlog
|
||||
+19
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user