Commit 6716085e authored by 方开's avatar 方开 🍔
Browse files

Merge branch 'stable' into 'master'

Stable

See merge request !1
parents 05a1058d 1d055fbc
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -26,19 +26,29 @@ def checkSpecies(species, tempHumi):
def checkWater(species, waterData):
# 通道数据列表存放每一路的水分值
channelDataList = []
channelNumlist = []
# 循环找到各点数据,没找到默认为None值,实时样例数据字符串每一路为62长度,返回所有路的数据
# 1F 00 00 00 44 01 AC 05 FB 12 A1 05 D1 13 4D 05 D1 13 43 FF FF FF FF FF FF FF FF FF FF FF FF
# 分割出每一路的水分数据进行处理
for i in range(0, len(waterData), 62):
try:
channelData = waterData[i:i + 62].split("ac")[1]
#channelNum=waterData[i+10:i+11]
channelNum=waterData[i+10:i+12]#冒号后的数不在数列内,多加一位
channelData = waterData[i:i + 62][14:]
channelDataList.append(channelData)
j=int(channelNum,16)
channelNumlist.append(j)
except Exception as e:
# 填充6个ffff ffff 对应着六个点的温湿度
logging.info(f"{e}")
channelDataList.append("ffffffff" * 6)
logging.info(f"接收到的水份通道数据是:{channelDataList}")
logging.info(f"接收到的水份通道数据是:{channelDataList},接受到的水分通道为{channelNumlist}")
for k in range (0,5):
if k+1 in channelNumlist:
pass
else:
channelDataList.insert(k,"ffffffff" * 6)
logging.info(f"补点后的水份通道数据是:{channelDataList}")
# 对每一路数据进行解析处理
# 水分数据存放列表
waterDataList = []
......@@ -67,6 +77,12 @@ def checkWater(species, waterData):
temp = (hiTemp * 256 + loTemp) / 100
# 湿度直接换算
humi = (hiHumi * 256 + loHumi) / 100
if temp > 30:
temp =30
if humi < 20:
humi = 20
elif humi >90:
humi=90
# 对温湿度取整,合并成 " 温度/湿度 " 的形式,进行下一步校验
tempHumi = str(int(temp)) + "/" + str(int(humi))
waterValue = checkSpecies(species, tempHumi)
......
File mode changed from 100644 to 100755
......@@ -103,7 +103,8 @@ def getConfig(configData: dict):
elif subType == "bug":
cmds = [
"0301" + subAddr + "0000000101f0" +
subMachineData.get("channelId")
subMachineData.get("channelId"),
"0301" + subAddr + "0000000101ff" + "02"
]
bugList.append(subId)
allList.append(subId)
......@@ -112,7 +113,8 @@ def getConfig(configData: dict):
cmds = [
"0301" + subAddr + "0000000101" +
subMachineData.get("channelId")
subMachineData.get("channelId"),
"0301" + subAddr + "0000000101ff" + "03"
]
airList.append(subId)
allList.append(subId)
......
......@@ -33,16 +33,18 @@ class GetCmds(object):
return self.houseData[types]
# 通过子模块编号来获取子模块的所有命令
def getCmdsBySubId(self, subId):
def getCmdsBySubId(self, subId,types=None):
# 对于通风状态区别开来
cmds = self.houseData["cmds"]
if self.houseType == "wind":
if types == "wind" and len(self.houseData["wind"]) != 0:
for subData in cmds:
if subId in subData:
windStatusCmd = subData[subId][0].get("status")
print(3)
return (self.host, self.port), windStatusCmd, None
else:
print(4)
for subData in cmds:
if subId in subData:
if "pointNum" in subData:
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
{
"extertemphumi": {
"ip": "127.0.0.1",
"port": 7000,
"cmd": "030102000000010123"
}
{
"extertemphumi": {
"ip": "10.20.1.164",
"port": 8000,
"cmd": "03011b00000001012f"
}
}
\ No newline at end of file
File mode changed from 100644 to 100755
This diff is collapsed.
astroid==2.2.5
autopep8==1.4.3
certifi==2019.3.9
cffi==1.12.1
gevent==1.4.0
greenlet==0.4.15
isort==4.3.15
lazy-object-proxy==1.3.1
mccabe==0.6.1
pycodestyle==2.5.0
pycparser==2.19
pylint==2.3.1
six==1.12.0
typed-ast==1.3.1
wrapt==1.11.1
tenacity
\ No newline at end of file
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