关于Domoticz发送UDP信息无效的问题,麻烦帮分析下
发表于 : 周五 6月 30, 2017 11:36
本人新入Domoticz,在论坛学习了一段时间,买入了个网络继电器。开始实践,但是碰到了问题。新建开关按开关并无反应。希望大神帮忙看看那个地方出错了,十分感谢
继电器就是开关功能,以下是UDP数据包发送软件测试结果
下面是我加入开关的配置页面
日志截图
以下是test.py代码
#!/usr/bin/python
import socket
import sys
import codecs
UDP_IP = '172.16.11.188'
UDP_PORT = 5000
INET_ADDR = (UDP_IP,UDP_PORT)
if action == "on1":
message_to_send = "6f6e31"
if action == "off1":
message_to_send = "6f666631"
if action == "on2":
message_to_send = "6f6e32"
if action == "off2":
message_to_send = "6f666632"
message_to_send = codecs.decode(message_to_send, "hex_codec")
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(message_to_send, INET_ADDR)
继电器就是开关功能,以下是UDP数据包发送软件测试结果
下面是我加入开关的配置页面
日志截图
以下是test.py代码
#!/usr/bin/python
import socket
import sys
import codecs
UDP_IP = '172.16.11.188'
UDP_PORT = 5000
INET_ADDR = (UDP_IP,UDP_PORT)
if action == "on1":
message_to_send = "6f6e31"
if action == "off1":
message_to_send = "6f666631"
if action == "on2":
message_to_send = "6f6e32"
if action == "off2":
message_to_send = "6f666632"
message_to_send = codecs.decode(message_to_send, "hex_codec")
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(message_to_send, INET_ADDR)