Commit 07699eec authored by 方开's avatar 方开 🍔
Browse files

通风相关问题

parent 2deb9c27
......@@ -112,7 +112,8 @@ def getConfig(configData: dict):
cmds = [
"0301" + subAddr + "0000000101" +
subMachineData.get("channelId")
subMachineData.get("channelId"),
"0301" + subAddr + "0000000101ff" + "02"
]
airList.append(subId)
allList.append(subId)
......
......@@ -36,7 +36,8 @@ class GetCmds(object):
def getCmdsBySubId(self, subId):
# 对于通风状态区别开来
cmds = self.houseData["cmds"]
if self.houseType == "wind":
windData = self.houseData["wind"]
if len(windData) != 0:
for subData in cmds:
if subId in subData:
windStatusCmd = subData[subId][0].get("status")
......
......@@ -258,8 +258,33 @@ def measureit(houseId, measureType="all", timeout=2):
logging.info(f"内温内湿数据为{interList},外温外湿数据为{exterData}")
return [interList, exterList]
elif measureType in ["bug", "air", "weather"]:
# 气体、虫害、气象站只有一个分机
elif measureType == "bug":
subId = subIds[0]
# 如果命令列表数据不为空
addr, cmds, pointNum = gc.getCmdsBySubId(subId)
dataList = []
# 测试指令和复位指令
if cmds:
# 发送测试指令
cmd = cmds[0]
data = measureClient(addr, a2b_hex(
cmd), measureType, houseType, pointNum, timeout)
dataList.extend(data)
# 发送复位指令
resetCmd = cmds[1]
try:
tcpSocket = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
logging.info(f"正在向虫害分机发送复位指令{resetCmd}")
tcpSocket.connect(addr)
tcpSocket.send(cmd)
except Exception as e:
logging.info(f"发送复位指令异常:{e}")
return dataList
elif measureType in ["air", "weather"]:
# 气体、气象站只有一个分机
subId = subIds[0]
# 如果命令列表数据不为空
addr, cmds, pointNum = gc.getCmdsBySubId(subId)
......@@ -329,7 +354,7 @@ def controlit(houseId, measureType="wind", flag="on", timeout=3):
cmd), measureType, houseType, None, timeout)
result.extend(data)
time.sleep(2)
return data
else:
logging.warning(f"无通风命令,请检查通风设置参数是否正确")
return []
......@@ -375,9 +400,9 @@ def handleCommand(command: str):
alldict["water"] = [
{"species": cerealsSpecies, "data": data}]
elif tp in ["temp", "temphumi", "bug", "air", "weather"]:
elif tp in ["temp", "temphumi", "bug", "air", "weather","wind"]:
alldict[tp] = [{"species": tp, "data": data}]
else:
pass
logging.info("已测试完所有指令数据")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment