Commit fd98141c authored by 方开's avatar 方开 🍔
Browse files

同步更新至云南主机版本

parent ce0ca931
......@@ -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:
#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)
......
......@@ -58,17 +58,18 @@
},
{
"004": [
"0301010000000101f001"
"0301010000000101f001",
"0301010000000101ff02"
]
},
{
"003": [
"030101000000010190",
"0301010000000101ff02"
"0301010000000101ff03"
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"005": [
"0301010000000101f101"
]
......@@ -168,17 +169,18 @@
},
{
"004": [
"0301020000000101f001"
"0301020000000101f001",
"0301020000000101ff02"
]
},
{
"003": [
"030102000000010190",
"0301020000000101ff02"
"0301020000000101ff03"
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"005": [
"0301020000000101f101"
]
......@@ -268,7 +270,7 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "玉米",
"003": [
"0301080000000101f101"
]
......@@ -322,7 +324,7 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "玉米",
"003": [
"0301040000000101f101"
]
......@@ -500,7 +502,7 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"003": [
"0301090000000101f101"
]
......@@ -536,8 +538,6 @@
"60",
"60",
"60",
"60",
"60",
"48"
],
"001": [
......@@ -554,9 +554,9 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"003": [
"0301050000000101f101"
"03010c0000000101f101"
]
}
]
......@@ -608,7 +608,7 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"003": [
"0301110000000101f101"
]
......@@ -662,7 +662,7 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "玉米",
"003": [
"03010f0000000101f101"
]
......@@ -774,7 +774,7 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"003": [
"0301100000000101f101"
]
......@@ -782,7 +782,7 @@
]
},
"735": {
"ip": "10.20.1.128",
"ip": "10.20.1.171",
"port": 8000,
"housetype": "multi",
"all": [
......@@ -832,9 +832,9 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"003": [
"03010c0000000101f101"
"0301050000000101f101"
]
}
]
......@@ -890,7 +890,7 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"003": [
"03010e0000000101f101"
]
......@@ -948,9 +948,9 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"003": [
"03010a0000000101f101"
"0301120000000101f101"
]
}
]
......@@ -1006,7 +1006,7 @@
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"003": [
"03010a0000000101f101"
]
......@@ -1058,11 +1058,11 @@
},
{
"002": [
"03012500000001012e"
"03012500000001012c"
]
},
{
"cerealsSpecies": "小麦",
"cerealsSpecies": "稻谷",
"003": [
"0301030000000101f101"
]
......@@ -2104,9 +2104,9 @@
]
},
"765": {
"ip": "10.20.1.22",
"ip": "10.20.1.128",
"port": 8000,
"housetype": "multi",
"housetype": "single",
"all": [
"001",
"002"
......@@ -2117,11 +2117,6 @@
"temphumi": [
"002"
],
"bug": [],
"air": [],
"wind": [],
"water": [],
"weather": [],
"cmds": [
{
"pointNum": [
......@@ -2135,25 +2130,25 @@
"20"
],
"001": [
"03010300000001011d",
"03010300000001011e",
"03010300000001011f",
"030103000000010120",
"030103000000010150",
"030103000000010151",
"030103000000010152",
"030103000000010153"
"2d0402e8003Ef7fa",
"2d040326003E97f9",
"2d040364003E37ed",
"2d0403a2003Ed7d0",
"2d0403e0003E77c4",
"2d04041e003E1740",
"2d04045c003Eb754",
"2d04049a003E5769"
]
},
{
"002": [
"030103000000010131"
"2d0405d0003E7743"
]
}
]
},
"766": {
"ip": "10.20.1.29",
"ip": "10.20.1.30",
"port": 8000,
"housetype": "single",
"all": [
......@@ -2179,19 +2174,51 @@
"20"
],
"001": [
"050402e8003Ef1d2",
"05040326003E91d1",
"05040364003E31c5",
"050403a2003Ed1f8",
"050403e0003E71ec",
"0504041e003E1168",
"0504045c003Eb17c",
"0504049a003E5141"
"2e0402e8003Ef7c9",
"2e040326003E97ca",
"2e040364003E37de",
"2e0403a2003Ed7e3",
"2e0403e0003E77f7",
"2e04041e003E1773",
"2e04045c003Eb767",
"2e04049a003E575a"
]
},
{
"002": [
"2e0405d0003E7770"
]
}
]
},
"769": {
"ip": "10.20.1.68",
"port": 8000,
"housetype": "single",
"all": [
"001",
"002"
],
"temp": [
"001"
],
"temphumi": [
"002"
],
"cmds": [
{
"pointNum": [
"32",
"32"
],
"001": [
"2c040000003E77a7",
"2c04003e003E166b"
]
},
{
"002": [
"050405d0003E716b"
"2c040516003E96af"
]
}
]
......
......@@ -2,6 +2,7 @@
"data": [{
"type": "control",
"houseId": "724",
"name": "L311",
"ip": "10.20.1.206",
"port": 50,
"subMachine": [{
......@@ -34,7 +35,7 @@
"type": "water",
"subAddr": "01",
"subId": "005",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
},
{
"channelId": "30",
......@@ -53,6 +54,7 @@
{
"type": "control",
"houseId": "725",
"name": "L312",
"ip": "10.20.1.207",
"port": 50,
"subMachine": [{
......@@ -85,7 +87,7 @@
"type": "water",
"subAddr": "02",
"subId": "005",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
},
{
"channelId": "30",
......@@ -106,6 +108,7 @@
"ip": "10.20.1.12",
"port": 8000,
"houseId": "723",
"name": "1",
"subMachine": [{
"channelId": "11-17",
"type": "temp",
......@@ -123,7 +126,7 @@
"type": "water",
"subAddr": "08",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "玉米"
}
]
},
......@@ -132,6 +135,7 @@
"ip": "10.20.1.19",
"port": 8000,
"houseId": "726",
"name": "2",
"subMachine": [{
"channelId": "11-15",
"type": "temp",
......@@ -149,7 +153,7 @@
"type": "water",
"subAddr": "04",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "玉米"
}
]
},
......@@ -158,6 +162,7 @@
"ip": "10.20.1.22",
"port": 8000,
"houseId": "727",
"name": "3",
"subMachine": [{
"channelId": "11-1c",
"type": "temp",
......@@ -184,6 +189,7 @@
"ip": "10.20.1.32",
"port": 8000,
"houseId": "728",
"name": "6",
"subMachine": [{
"channelId": "11-18",
"type": "temp",
......@@ -211,6 +217,7 @@
"ip": "10.20.1.47",
"port": 8000,
"houseId": "729",
"name": "10",
"subMachine": [{
"channelId": "11-15",
"type": "temp",
......@@ -228,7 +235,7 @@
"type": "water",
"subAddr": "09",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
}
]
},
......@@ -237,10 +244,11 @@
"ip": "10.20.1.57",
"port": 8000,
"houseId": "730",
"name": "12",
"subMachine": [{
"channelId": "11-15",
"type": "temp",
"pointNum": ["60", "60", "60", "60", "60", "60", "48"],
"pointNum": ["60", "60", "60", "60", "48"],
"subAddr": "0c",
"subId": "001"
}, {
......@@ -252,9 +260,9 @@
{
"channelId": "01",
"type": "water",
"subAddr": "05",
"subAddr": "0c",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
}
]
},
......@@ -263,6 +271,7 @@
"ip": "10.20.1.70",
"port": 8000,
"houseId": "731",
"name": "17",
"subMachine": [{
"channelId": "11-15",
"type": "temp",
......@@ -280,7 +289,7 @@
"type": "water",
"subAddr": "11",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
}
]
},
......@@ -289,6 +298,7 @@
"ip": "10.20.1.74",
"port": 8000,
"houseId": "732",
"name": "19",
"subMachine": [{
"channelId": "11-15",
"type": "temp",
......@@ -306,7 +316,7 @@
"type": "water",
"subAddr": "0f",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "玉米"
}
]
},
......@@ -315,6 +325,7 @@
"ip": "10.20.1.90",
"port": 8000,
"houseId": "733",
"name": "25",
"subMachine": [{
"channelId": "11-17",
"type": "temp",
......@@ -341,6 +352,7 @@
"ip": "10.20.1.92",
"port": 8000,
"houseId": "734",
"name": "26",
"subMachine": [{
"channelId": "11-17",
"type": "temp",
......@@ -358,15 +370,16 @@
"type": "water",
"subAddr": "10",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
}
]
},
{
"type": "multi",
"ip": "10.20.1.128",
"ip": "10.20.1.171",
"port": 8000,
"houseId": "735",
"name": "L131",
"subMachine": [{
"channelId": "11-18",
"type": "temp",
......@@ -382,9 +395,9 @@
{
"channelId": "01",
"type": "water",
"subAddr": "0c",
"subAddr": "05",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
}
]
},
......@@ -393,6 +406,7 @@
"ip": "10.20.1.164",
"port": 8000,
"houseId": "736",
"name": "L121",
"subMachine": [{
"channelId": "11-18",
"type": "temp",
......@@ -410,7 +424,7 @@
"type": "water",
"subAddr": "0e",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
}
]
},
......@@ -419,6 +433,7 @@
"ip": "10.20.1.183",
"port": 8000,
"houseId": "737",
"name": "L221",
"subMachine": [{
"channelId": "11-18",
"type": "temp",
......@@ -434,9 +449,9 @@
{
"channelId": "01",
"type": "water",
"subAddr": "0a",
"subAddr": "12",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
}
]
},
......@@ -445,6 +460,7 @@
"ip": "10.20.1.191",
"port": 8000,
"houseId": "738",
"name": "L231",
"subMachine": [{
"channelId": "11-18",
"type": "temp",
......@@ -462,7 +478,7 @@
"type": "water",
"subAddr": "0a",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
}
]
},
......@@ -471,6 +487,7 @@
"ip": "10.20.1.123",
"port": 8000,
"houseId": "739",
"name": "L313",
"subMachine": [{
"channelId": "11-17",
"type": "temp",
......@@ -478,7 +495,7 @@
"subAddr": "25",
"subId": "001"
}, {
"channelId": "2e",
"channelId": "2c",
"type": "temphumi",
"subAddr": "25",
"subId": "002"
......@@ -488,7 +505,7 @@
"type": "water",
"subAddr": "03",
"subId": "003",
"cerealsSpecies": "小麦"
"cerealsSpecies": "稻谷"
}
]
},
......@@ -497,6 +514,7 @@
"ip": "10.20.1.24",
"port": 8000,
"houseId": "740",
"name": "4",
"subMachine": [{
"channelId": "01-0c",
"type": "temp",
......@@ -515,6 +533,7 @@
"ip": "10.20.1.29",
"port": 8000,
"houseId": "741",
"name": "5",
"subMachine": [{
"channelId": "01-0c",
"type": "temp",
......@@ -533,6 +552,7 @@
"ip": "10.20.1.38",
"port": 8000,
"houseId": "742",
"name": "7",